Replies: 4 comments 8 replies
-
Thanks for your question, @hblumberg. Indeed, Parcels expects longitudes to be monotonously increasing. In your example about, you would use Note that for dealing with periodic boundaries, you may then also need to add a halo. See for example the tutorial at https://nbviewer.org/github/OceanParcels/parcels/blob/master/parcels/examples/tutorial_periodic_boundaries.ipynb An alternative to using a halo is to change the kernels themselves, and add modulo statements to for example a custom Advection Kernel. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your quick response (and I’m sorry for the delay on my end)! Yes, modifying the Creating a custom kernel would be an alternative to modifying the
This doesn’t seem to work for me, but I'm thinking it might be because my longitudes are really Thanks again for your help!! |
Beta Was this translation helpful? Give feedback.
-
Hi Erik! Hannah and I implemented your suggestion to ensure field longitudes are monotonically increasing. After kernel execution, we want to convert the longitude values of the output particle trajectories back to ensure their range is [0, 360). However, we are not sure how to access and modify output longitudes before exporting the file. Currently, we reload the file as an xarray dataset, modify the longitudes, and then overwrite the original output file:
While this execution runs, we wanted to see if you had any recommendations regarding how to go about modifying output values to avoid reloading/overwriting the original output file. Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
-
Hi Erik, @hblumberg and I have a follow-up question regarding fieldset modification. First, we verified that when we adjust the dataset directly (before fieldset creation) by loading the data into an xarray and adjusting the longitude coordinates to be monotonically increasing, the simulation works as intended. However, if we instead load the original dataset in which the longitude bounds are, for example, [350, 10], and then try to adjust the fieldset after fieldset creation, the simulation breaks. Please find this approach below for a dataset with bounds [350, 10]:
Does parcels store the longitude coordinates elsewhere in the fieldset? Are there other attributes we need to be modifying beyond We are happy to share a minimal, executable example if that would be helpful in answering our questions. Thank you in advance for any clarification! |
Beta Was this translation helpful? Give feedback.
-
My team has noticed that if we construct a
Fieldset
using NetCDF data in which longitudes are in the range [0, 360), we see out of bounds errors when a particle tries to move across the Prime Meridian. This is the case even when the longitudes are ordered "correctly" (e.g.[358, 359, 0, 1, 2]
).We could change our longitudes to be in the range [-180, 180), but then we'd have the problem along the International Date Line.
Our questions are:
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions