Replies: 1 comment 1 reply
-
|
Hi @acceber96, thanks for reaching out! I think you're trying to do something (nesting CROCO grids) that no-one has tried before; which is why it wasn't tested. It seems that the implementation in the current v3 of Parcels just doesn't work for Croco on nested grids. However, I'm afraid I can't help you directly... We have stopped active development tof v3 - instead fully focussing on the new Parcels v4. But the good news is:nesting is much better implemented in v4, see https://docs.oceanparcels.org/en/main/user_guide/examples/tutorial_nestedgrids.html. I don't expect the issue you describe above to reoccur in v4. So if you want, you can give the new v4 a try; we are almost ready to officially release it - but it is fully functional already. See https://docs.oceanparcels.org/en/main/getting_started/installation.html for instructions how to install the new v4. We're very keen to hear how you experience the new Parcels |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to nest two ROMS domains (a fine 500m-resolution grid nested inside a coarser 4km-resolution grid, both native sigma-coordinate ROMS output) using FieldSet.from_croco() + NestedField. Each domain works fine on its own. Combining them fails in three different ways depending on how H/Zeta/Cs_w are handled. Is this combination currently supported, and if not, what's the recommended workaround?
Setup:
fieldset_fine = parcels.FieldSet.from_croco(files_fine, variables, dimensions, hc=hc_fine, deferred_load=True)
fieldset_coarse = parcels.FieldSet.from_croco(files_coarse, variables, dimensions, hc=hc_coarse, deferred_load=True)
U = parcels.NestedField('U', [fieldset_fine.U, fieldset_coarse.U])
V = parcels.NestedField('V', [fieldset_fine.V, fieldset_coarse.V])
W = parcels.NestedField('W', [fieldset_fine.W, fieldset_coarse.W])
fieldset = parcels.FieldSet(U, V, {'W': W, ...})
If H/Zeta are not attached to the combined FieldSet, interpolating any CROCO field fails with:
File ".../field.py", line 92, in _croco_from_z_to_sigma_scipy
zeta = fieldset.Zeta.eval(...)
AttributeError: 'FieldSet' object has no attribute 'Zeta'
This makes sense: add_field() reassigns each constituent field's .fieldset to the outer combined object when nesting, so self.fieldset.Zeta no longer resolves to fieldset_fine/fieldset_coarse.
If instead H/Zeta/Cs_w are nested the same way as U/V/W:
pythonH = parcels.NestedField('H', [fieldset_fine.H, fieldset_coarse.H])
it fails differently:
File ".../field.py", line 92, in _croco_from_z_to_sigma_scipy
h = fieldset.H.eval(...)
AttributeError: 'NestedField' object has no attribute 'eval'
Taking H/Zeta/Cs_w from the coarse domain only (not nested), with only U/V/W/T/S nested, gets past both of the above, but fails a third way, this time on U itself:
File ".../field.py", line 94, in _croco_from_z_to_sigma_scipy
sigma_levels = fieldset.U.grid.depth
AttributeError: 'NestedField' object has no attribute 'grid'
This matches exactly the internal algorithm shown in the official CROCO 3D tutorial (sigma_levels = fieldset.U.grid.depth, see https://docs.oceanparcels.org/en/latest/examples/tutorial_croco_3D.html#The-algorithms-used). Since U must stay a NestedField for the horizontal switching to work, this looks like a structural incompatibility rather than a config issue on my end.
Also worth noting: with JITParticle (instead of ScipyParticle), the same setup as above raises no error at all — pset.execute() completes, but particle displacement is silently exactly 0.0. That seems worse than a crash since it can go unnoticed.
Is nesting two from_croco() FieldSets supported at all? If not, is pre-converting to fixed z-levels (bypassing from_croco) the recommended workaround? Happy to share a minimal reproducible example if useful.
Beta Was this translation helpful? Give feedback.
All reactions