Skip to content

Commit a468ade

Browse files
committed
negate *and* reindex depth in ds before fieldset creation
1 parent da86613 commit a468ade

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/virtualship/instruments/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def simulate(
120120

121121
def execute(self, measurements: list, out_path: str | Path) -> None:
122122
"""Run instrument simulation."""
123-
TMP = False # TODO: just for dev; remove before merging
123+
TMP = True # TODO: just for dev; remove before merging
124124
instrument_name = self.__class__.__name__.split("Instrument")[0]
125125

126126
if not self.verbose_progress:
@@ -220,6 +220,10 @@ def _generate_fieldset(self) -> parcels.FieldSet:
220220
# TODO: I think this is potentially slowing down simulations slightly... compared to v0.3 anyway for *drifters*
221221
ds.load() # TODO: tmp step during v4 alpha stage... probably to be updated on the Parcels end
222222

223+
# negate depth and reindex (to suit Parcels XGrid strictly increasing depth convention)
224+
ds["depth"] = -ds["depth"]
225+
ds = ds.reindex(depth=ds["depth"][::-1]) #
226+
223227
fields = {key: ds[field_var_name]}
224228
ds_fset = parcels.convert.copernicusmarine_to_sgrid(fields=fields)
225229
fs = parcels.FieldSet.from_sgrid_conventions(ds_fset)

0 commit comments

Comments
 (0)