Add tutorial for SCHISM model for lake ontario.#2660
Conversation
This is a minimum working example that illustrates primarily how to do 2D (lateral) particle advection with SCHISM model output. It walks through handling issues with uxarray, which assumes that the input grid is in units of degrees for latitude and longitude. The SCHISM output provided here uses x,y in cartesian coordinates in units of meters. Since uxarray automatically wraps longitude to be between [0,360] we have to overwrite the `node_lon` values stored in the uxgrid object. We show how to rename the SCHISM velocity field components, lateral node coordinate, and vertical grid names to match what Parcels expects to see. Note that we intentionally create a ficticious vertical grid in this example; Parcels currently does not support the LSC2 vertical grid that is used in SCHISM and this is documented clearly in the tutorial.
for more information, see https://pre-commit.ci
A few minor changes to the tutorial - Change to Australian spelling (metres -> meters) (#2376) - increase the number of particles to 1500 (and set as a variable) - Add grid mesh as black lines in plot - Clarify that Parcels built-in Kernels require U and V (not Parcels itself) - Change 'drift' to the more general 'end up' - changed the Delete Kernel to use more intuitive boolean indexing
erikvansebille
left a comment
There was a problem hiding this comment.
Nice tutorial! I made some minor changes to the text in f1eb2a0
A few questions
- Should StatusCodes become part of the public API? So users can import it as
parcels.StatusCodes? @VeckoTheGecko, what do you think? - It seems that UXARRAY/uxarray#1525 is close to being fixed. Should we wait for it? Or merge this now and update when a new version of
uxarrayis released? - I'm getting a warning (below) in the
pset.execute(), is this a problemm?
/Users/erik/Codes/parcels/src/parcels/_core/spatialhash.py:592: RuntimeWarning: invalid value encountered in cast
xq = np.clip((xn * bitwidth).astype(np.uint32), 0, bitwidth)
Parcels/docs/user_guide/v4-migration.md Line 10 in 6ef510d
I just checked, it is already public API |
VeckoTheGecko
left a comment
There was a problem hiding this comment.
for name, field in fieldset.fields.items():
interp = getattr(field, "interp_method", None)
print(
f"{name:>4s} -> {type(field).__name__:<11s} interp={interp.__name__ if interp else '-'}"
)Just curious: I'm surprised that the interp_method is None sometimes here, is this from the vector fields?
Indeed, VectorField interpolator defaults to If I recall correctly |
I'm 99% certain that these are coming from the particles that subsequently get removed from the simulation - they're lat/lon positions end up as We could suppress this warning moving the |
Maybe to prevent "documentation whiplash", it'd be good to keep this one open and wait for the uxarray fix to come in. Let's give it a couple of days to see how the uxarray PR progresses. |
Description
This is a minimum working example that illustrates primarily how to do 2D (lateral) particle advection with SCHISM model output. It walks through handling issues with uxarray, which assumes that the input grid is in units of degrees for latitude and longitude.
The SCHISM output provided here uses x,y in cartesian coordinates in units of meters. Since uxarray automatically wraps longitude to be between [0,360] we have to overwrite the
node_lonvalues stored in the uxgrid object.We show how to rename the SCHISM velocity field components, lateral node coordinate, and vertical grid names to match what Parcels expects to see. Note that we intentionally create a ficticious vertical grid in this example; Parcels currently does not support the LSC2 vertical grid that is used in SCHISM and this is documented clearly in the tutorial.
Checklist
mainfor normal development,v3-supportfor v3 support)AI Disclosure