Skip to content

Giving a group identifier to particles released with each repeatdt timestep #1720

Answered by VeckoTheGecko
TomMBIO asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @TomMBIO , yes, that looks like it should work. minor note is that release_time would need to be a datetime object.

So something like

+ from datetime import datetime, timedelta
iterations = range(9)  # Say to simulate for 9 weeks
psets = [] 

cohort = 0  
- release_time = 0
+ # Create a datetime object for October 3, 2024, at 14:30:00
+ release_time = datetime(2024, 10, 3, 14, 30, 0)
for i in iterations:
    # Create a new ParticleSet for each iteration with updated release time and cohort ID
    pset = ParticleSet(
        fieldset=fieldset,
        pclass=JITParticle,
        lon=lon,
        lat=lat,
        time=release_time, 
        cohort=cohort 
    )
    
    psets.append(pset…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@TomMBIO
Comment options

@VeckoTheGecko
Comment options

Answer selected by TomMBIO
@TomMBIO
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants