Replies: 1 comment
-
Hi @keli559, yes there has been a new version of parcels released, v3.0.0, please see here: https://github.com/OceanParcels/parcels/releases/tag/v3.0.0 There is a tutorial here: https://docs.oceanparcels.org/en/latest/examples/tutorial_kernelloop.html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried to run an old code from last September on current OceanParcels.
It looks like the treatment for the particles that travel out of bounds
has been changed.
from parcels import ErrorCode
The code above does not work any more. It reports an error, saying that ErrorCode does not exsit.
Here is the error from the notebook:
`
ImportError Traceback (most recent call last)
Cell In[60], line 1
----> 1 from parcels import (
2 AdvectionRK4,
3 FieldSet,
4 JITParticle,
5 ParticleSet,
6 Variable,
7 download_example_dataset,
8 ErrorCode
9 )
ImportError: cannot import name 'ErrorCode' from 'parcels' (C:\Users\kl591\AppData\Local\anaconda33\envs\parcels\lib\site-packages\parcels_init_.py)
`
The following is my old code from last september to deal with out of bound particles.
pset.execute( AdvectionRK4, runtime=timedelta(days=10), dt=timedelta(minutes=30), output_file=output_file, recovery={ErrorCode.ErrorOutOfBounds: DeleteParticle} )
Is there an update that I missed inbetween time, since last September?
Here is the error regarding out of bounds:
`
FieldOutOfBoundError Traceback (most recent call last)
Cell In[9], line 6
4 def DeleteParticle(particle, fieldset, time):
5 particle.delete()
----> 6 pset.execute(
7 AdvectionRK4,
8 runtime=timedelta(days=10),
9 dt=timedelta(minutes=30),
10 output_file=output_file
11 )
File ~\AppData\Local\anaconda33\envs\parcels\lib\site-packages\parcels\particleset.py:948, in ParticleSet.execute(self, pyfunc, pyfunc_inter, endtime, runtime, dt, output_file, verbose_progress, postIterationCallbacks, callbackdt)
946 # If we don't perform interaction, only execute the normal kernel efficiently.
947 if self.interaction_kernel is None:
--> 948 res = self.kernel.execute(self, endtime=next_time, dt=dt)
949 if res == StatusCode.StopAllExecution:
950 return StatusCode.StopAllExecution
File ~\AppData\Local\anaconda33\envs\parcels\lib\site-packages\parcels\kernel.py:585, in Kernel.execute(self, pset, endtime, dt)
583 raise TimeExtrapolationError(p.time)
584 elif p.state == StatusCode.ErrorOutOfBounds:
--> 585 raise FieldOutOfBoundError(p.lon, p.lat, p.depth)
586 elif p.state == StatusCode.ErrorThroughSurface:
587 raise FieldOutOfBoundSurfaceError(p.lon, p.lat, p.depth)
FieldOutOfBoundError: Field sampled out-of-bound, at (14.412651062011719, -26.000455856323242, 0.0)
`
Beta Was this translation helpful? Give feedback.
All reactions