FieldOutOfBoundSurfaceError in OceanParcels #1528
Replies: 3 comments 1 reply
-
Hi @cristinarumi, your error in the screenshot seems to point to a Capturing particles that go through the surface requires a different StatusCode (see this part of the tutorial), so you could try changing your kernel to def DeleteErrorParticle(particle, fieldset, time):
if (particle.state == StatusCode.ErrorOutOfBounds) or (particle.state == StatusCode.ErrorThroughSurface):
particle.delete() |
Beta Was this translation helpful? Give feedback.
-
Hi Erik,
Thank you!
Should I algo move kernel submerge to the end before deleteparticle?
Obtén l'aplicació Outlook per a l'iOS<https://aka.ms/o0ukef>
…________________________________
De: Erik van Sebille ***@***.***>
Enviat el: Tuesday, April 2, 2024 8:36:28 AM
Per a: OceanParcels/parcels ***@***.***>
A/c: Cristina Arumí Planas ***@***.***>; Mention ***@***.***>
Tema: Re: [OceanParcels/parcels] FieldOutOfBoundSurfaceError in OceanParcels (Discussion #1528)
Hi @cristinarumi<https://urldefense.com/v3/__https://github.com/cristinarumi__;!!D9dNQwwGXtA!V3ofCnT5445vuXEkBqUsnPUCvQ6pMmewiWRgVqSp7Wks53I2j3rbx5PreOE2VYXj-DhhKpC25eGYtgeChhGLUE7r0UkW$>, your error in the screenshot seems to point to a StatusCode.ErrorThroughSurface (field out of bounds at the surface), but your DeleteErrorParticle kernel only captures StatusCode.ErrorOutOfBounds.
Capturing particles that go through the surface requires a different StatusCode (see this part of the tutorial<https://urldefense.com/v3/__https://docs.oceanparcels.org/en/latest/examples/tutorial_kernelloop.html*Working-with-Status-Codes__;Iw!!D9dNQwwGXtA!V3ofCnT5445vuXEkBqUsnPUCvQ6pMmewiWRgVqSp7Wks53I2j3rbx5PreOE2VYXj-DhhKpC25eGYtgeChhGLUKpWXhuX$>), so you could try changing your kernel to
def DeleteErrorParticle(particle, fieldset, time):
if (particle.state == StatusCode.ErrorOutOfBounds) or (particle.state == StatusCode.ErrorThroughSurface):
particle.delete()
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/OceanParcels/parcels/discussions/1528*discussioncomment-8979770__;Iw!!D9dNQwwGXtA!V3ofCnT5445vuXEkBqUsnPUCvQ6pMmewiWRgVqSp7Wks53I2j3rbx5PreOE2VYXj-DhhKpC25eGYtgeChhGLUCM1e0Kd$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/BA3LNB5ZVFQ3STIGKA2GOY3Y3JGWZAVCNFSM6AAAAABFRJDJQ2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DSNZZG43TA__;!!D9dNQwwGXtA!V3ofCnT5445vuXEkBqUsnPUCvQ6pMmewiWRgVqSp7Wks53I2j3rbx5PreOE2VYXj-DhhKpC25eGYtgeChhGLUL4q9FI3$>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Well, you only have a kernel |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Erik,
during my simulation I have included the kernel DeleteErrorParticle at the end of the Kernels but I still encountered the error: "File "media/disk/Cristina/ParcelsRun/1993_2018/parcels/parcels/kernel.py", line 587, in execute
r: Field sampled out-of-bound at the surface, at (12.091083428090098,n-6.190445023616803, -0.04458211335611706)"
raise FieldOutOfBoundSurfaceError (p.lon,p.lat,p.depth)
parcels.tools.statuscodes.
My code is the following:
def DeleteErrorParticle(particle, fieldset, time): #Per les particules que surten de la meva regio
if particle.state == StatusCode.ErrorOutOfBounds:
particle.delete()
def SampleT(particle, fieldset, time):
particle.T = fieldset.T[time, particle.depth, particle.lat, particle.lon]
def SampleS(particle, fieldset, time):
particle.S = fieldset.S[time, particle.depth, particle.lat, particle.lon]
def KeepInOcean(particle, fieldset, time): #per les particules que s'escapen per la superficie
if particle.state == StatusCode.ErrorThroughSurface:
particle_ddepth = 0.52
particle.state = StatusCode.Success
class sParticle(JITParticle):
VT = Variable('VT', initial=0, dtype=np.float32, to_write='once')
T = Variable( 'T', dtype=np.float32)
S = Variable( 'S', dtype=np.float32)
pset = ParticleSet(fieldset=fieldset, pclass=sParticle, lon=lons.astype(float), lat=lats.astype(float), depth=deps.astype(float), time=times, VT=VTS.astype(float))
adv = pset.Kernel(AdvectionRK4_3D)
sampT = pset.Kernel(SampleT)
sampS = pset.Kernel(SampleS)
submerge = pset.Kernel(KeepInOcean)
deleteparticle = pset.Kernel(DeleteErrorParticle)
kernels=adv+submerge+sampT+sampS+deleteparticle
pset.execute(kernels, runtime=delta(days=9491), dt=-delta(days=timest_calc), output_file=ParticleFile(outdir, pset, outputdt=delta(days=timest_out)), verbose_progress=True)
How can I solve the problem? Thank you very much in advanced.
Beta Was this translation helpful? Give feedback.
All reactions