Skip to content
Merged

Fixs #121

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
ludwigVonKoopa committed Dec 8, 2021
commit b0eecd9c5db74ac60e4478b3a6a9e1b0e62f168c
7 changes: 4 additions & 3 deletions src/py_eddy_tracker/observations/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,8 @@ def load_from_zarr(
h_zarr = zarr.open(filename)
var_list = cls.build_var_list(list(h_zarr.keys()), remove_vars, include_vars)

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

if indexs is not None and "obs" in indexs:
sl = indexs["obs"]
Expand Down Expand Up @@ -1040,6 +1039,7 @@ def from_zarr(cls, handler):
eddies.obs[variable] = handler.variables[variable][:]
else:
eddies.obs[VAR_DESCR_inv[variable]] = handler.variables[variable][:]
eddies.sign_type = handler.rotation_type
return eddies

@classmethod
Expand All @@ -1058,6 +1058,7 @@ def from_netcdf(cls, handler):
eddies.obs[variable] = handler.variables[variable][:]
else:
eddies.obs[VAR_DESCR_inv[variable]] = handler.variables[variable][:]
eddies.sign_type = handler.rotation_type
return eddies

def propagate(
Expand Down
3 changes: 3 additions & 0 deletions src/py_eddy_tracker/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ def load_state(self):
self.virtual_obs = VirtualEddiesObservations.from_netcdf(
general_handler.groups["LastVirtualObs"]
)
self.previous_virtual_obs = VirtualEddiesObservations.from_netcdf(
general_handler.groups["LastPreviousVirtualObs"]
)
# Load and last previous virtual obs to be merge with current => will be previous2_obs
# TODO : Need to rethink this line ??
self.current_obs = self.current_obs.merge(
Expand Down