Grid Differences in Sampling Files #1480
BenOwusu084
started this conversation in
General
Replies: 1 comment 2 replies
-
Hi @BenOwusu084, the simplest solution is to change the longitude at which you are sampling the NPP field. I've previously done this for an EEZ-field in the code at So in your case something like def SampleNPP(particle, fieldset, time):
plon = particle.lon
if plon < 0.5:
plon = plon + 360
particle.npp = fieldset.NPP[particle.time, particle.depth, particle.lat, plon] Does that help? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Erik,
So I am sampling nutrient fields (NPP,NO3,PO4,...). My NPP file does not have the regular grid dimensions for the lon and lat (by regular I mean, lon = -179.5 to 179.5 and lat = -89.5 to 89.5 on a 0.5 grid). My NPP file has lon = 0.5 to 360 and my lat = -79.5 to 79.5. The NO3 and PO4 files are from the WOA so they are on the regular 0.5 grid with the regular extends.
As a result of this when I include NPP samapling, it gives an:
OutOfBoundsError: 0 Particle P[400](lon=-40.000000, lat=10.000000, depth=10.000000, npp=0.000000, no3=0.069734, po4=0.093011, distance=0.000000, time=0.000000) Time: 1992-01-16T12:00:00.000000000, timestep dt: -0.000000 Out-of-bounds sampling by particle at (-40.000000, 10.000000, 10.000000)
My first intuition is that my NPP file is not on regular grid and particles gets out of the boundaries. I think this because sampling nutrient fields (NO3,PO4,..) that are on the regular grid does not give any error. I tried to set Parcels to rather use the grid dimensions from these NO3 fields but that wouldn't work.
Is there a way to transform my grid in the model or let Parcels know this grid dimensions of my NPP file.
Beta Was this translation helpful? Give feedback.
All reactions