Skip to content

Commit b0eecd9

Browse files
correction multiple bug for tracking and zarr loading
- correction of bug in zarr nb_obs & track_array_variables, if no vars with 2 dimensions was selected - bug when loading EddiesObservation, rotation_type was not loaded - bug in tracking, previous_virtual_obs was not loaded from VirtualEddiesObservations
1 parent bc7254e commit b0eecd9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/py_eddy_tracker/observations/observation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,8 @@ def load_from_zarr(
767767
h_zarr = zarr.open(filename)
768768
var_list = cls.build_var_list(list(h_zarr.keys()), remove_vars, include_vars)
769769

770-
# FIXME must be investigated, in zarr no dimensions name (or could be add in attr)
771-
# so we assume first dimension is number of observation, second is number of contours
772-
nb_obs, track_array_variables = getattr(h_zarr, var_list[0]).shape
770+
nb_obs = getattr(h_zarr, var_list[0]).shape[0]
771+
track_array_variables = h_zarr.attrs["track_array_variables"]
773772

774773
if indexs is not None and "obs" in indexs:
775774
sl = indexs["obs"]
@@ -1040,6 +1039,7 @@ def from_zarr(cls, handler):
10401039
eddies.obs[variable] = handler.variables[variable][:]
10411040
else:
10421041
eddies.obs[VAR_DESCR_inv[variable]] = handler.variables[variable][:]
1042+
eddies.sign_type = handler.rotation_type
10431043
return eddies
10441044

10451045
@classmethod
@@ -1058,6 +1058,7 @@ def from_netcdf(cls, handler):
10581058
eddies.obs[variable] = handler.variables[variable][:]
10591059
else:
10601060
eddies.obs[VAR_DESCR_inv[variable]] = handler.variables[variable][:]
1061+
eddies.sign_type = handler.rotation_type
10611062
return eddies
10621063

10631064
def propagate(

src/py_eddy_tracker/tracking.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ def load_state(self):
350350
self.virtual_obs = VirtualEddiesObservations.from_netcdf(
351351
general_handler.groups["LastVirtualObs"]
352352
)
353+
self.previous_virtual_obs = VirtualEddiesObservations.from_netcdf(
354+
general_handler.groups["LastPreviousVirtualObs"]
355+
)
353356
# Load and last previous virtual obs to be merge with current => will be previous2_obs
354357
# TODO : Need to rethink this line ??
355358
self.current_obs = self.current_obs.merge(

0 commit comments

Comments
 (0)