Replies: 2 comments 6 replies
-
Hi @Xyx105, I'm not entirely sure what is causing your error, could you paste in the result of: Additionally, you're loading in the 40th level of your depth, but your particle is initialised at depth 0m (so even if your code didn't throw an error, your particle is unlikely to move about). Cheers, |
Beta Was this translation helpful? Give feedback.
-
I have the same error, out-of-bounds error. And code |
Beta Was this translation helpful? Give feedback.
-
Hi,
I keep getting a "OutOfBoundsError: 0" error. I have tried the fix in #973 but I still keep getting the same error.
Here is my code:
`filenames = {
"U": {
"lon": f"output.nc",
"lat": f"output.nc",
"data": f"NC Files/NEATL*.nc",
},
"V": {
"lon": f"output.nc",
"lat": f"output.nc",
"data": f"NC Files/NEATL*.nc",
},
}
variables = {'U': 'u',
'V': 'v'}
dimensions = {"lon": "lon_u", "lat": "lat_u", "time": "ocean_time"}
indices = {'depth' : [40]}
fieldset = FieldSet.from_nemo(
filenames, variables, dimensions, indices, allow_time_extrapolation=True,
)
#indices = {'depth' : [40]}
fieldset.computeTimeChunk(fieldset.U.grid.time[0], 6)
fieldset.computeTimeChunk(fieldset.V.grid.time[0], 6)
npart = 1
lonp = 4.7
latp = 60
pset = ParticleSet.from_list(fieldset, JITParticle, lon=lonp, lat=latp, )
pfile = ParticleFile("nemo_particles", pset, outputdt=delta(days=5))
kernels = pset.Kernel(AdvectionRK4)
pset.show(fieldset.U)
pset.execute(kernels, runtime=delta(days=1), dt=delta(hours=6), output_file=pfile)`
It produces this result
and I get this error message:
`---------------------------------------------------------------------------
OutOfBoundsError Traceback (most recent call last)
Cell In[16], line 82
78 kernels = pset.Kernel(AdvectionRK4)
80 pset.show(fieldset.U)
---> 82 pset.execute(kernels, runtime=delta(days=1), dt=delta(hours=6), output_file=pfile)
File ~\Anaconda3\envs\parcels\Lib\site-packages\parcels\particleset\baseparticleset.py:548, in BaseParticleSet.execute(self, pyfunc, pyfunc_inter, endtime, runtime, dt, moviedt, recovery, output_file, movie_background_field, verbose_progress, postIterationCallbacks, callbackdt)
546 # If we don't perform interaction, only execute the normal kernel efficiently.
547 if self.interaction_kernel is None:
--> 548 self.kernel.execute(self, endtime=next_time, dt=dt, recovery=recovery, output_file=output_file,
549 execute_once=execute_once)
550 # Interaction: interleave the interaction and non-interaction kernel for each time step.
551 # E.g. Inter -> Normal -> Inter -> Normal if endtime-time == 2*dt
552 else:
553 cur_time = time
File ~\Anaconda3\envs\parcels\Lib\site-packages\parcels\kernel\kernelsoa.py:213, in KernelSOA.execute(self, pset, endtime, dt, recovery, output_file, execute_once)
211 recovery_kernel = recovery_map[p.state]
212 p.set_state(StateCode.Success)
--> 213 recovery_kernel(p, self.fieldset, p.time)
214 if p.isComputed():
215 p.reset_state()
File ~\Anaconda3\envs\parcels\Lib\site-packages\parcels\tools\statuscodes.py:182, in recovery_kernel_out_of_bounds(particle, fieldset, time)
178 """Default sampling error kernel that throws OutOfBoundsError."""
179 if particle.exception is None:
180 # TODO: JIT does not yet provide the context that created
181 # the exception. We need to pass that info back from C.
--> 182 raise OutOfBoundsError(particle, fieldset)
183 else:
184 error = particle.exception
OutOfBoundsError: 0
Particle P[14](lon=4.700000, lat=60.000000, depth=0.000000, time=0.000000)
Time: 2022-01-01T00:00:00.000000000
timestep dt: 3600.0
Out-of-bounds sampling by particle at (4.7, 60.0, 0.0)`
Any idea why this is happening?
Beta Was this translation helpful? Give feedback.
All reactions