Skip to content

Commit 016c3c4

Browse files
committed
solve issue AntSimi#9
1 parent 09cb948 commit 016c3c4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/py_eddy_tracker/observations/observation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ def zarr_dimension(filename):
416416

417417
@classmethod
418418
def load_file(cls, filename, **kwargs):
419-
if filename.endswith(".zarr"):
419+
end = b".zarr" if isinstance(filename, bytes) else ".zarr"
420+
if filename.endswith(end):
420421
return cls.load_from_zarr(filename, **kwargs)
421422
else:
422423
return cls.load_from_netcdf(filename, **kwargs)

src/py_eddy_tracker/tracking.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ def period(self):
142142
143143
"""
144144
date_start = datetime(1950, 1, 1) + timedelta(
145-
int(self.class_method.load_from_netcdf(self.datasets[0]).obs['time'][0]))
145+
int(self.class_method.load_file(self.datasets[0]).obs['time'][0]))
146146
date_stop = datetime(1950, 1, 1) + timedelta(
147-
int(self.class_method.load_from_netcdf(self.datasets[-1]).obs['time'][0]))
147+
int(self.class_method.load_file(self.datasets[-1]).obs['time'][0]))
148148
return date_start, date_stop
149149

150150
def swap_dataset(self, dataset, raw_data=False):
@@ -652,7 +652,7 @@ def get_unused_data(self, raw_data=False):
652652
j = 0
653653
for i, dataset in enumerate(self.datasets):
654654
logger.debug('Loaf file : (%d) %s', i, dataset)
655-
current_obs = self.class_method.load_from_netcdf(dataset, raw_data=raw_data)
655+
current_obs = self.class_method.load_file(dataset, raw_data=raw_data)
656656
if i == 0:
657657
eddies.sign_type = current_obs.sign_type
658658
unused_obs = current_obs.observations[list_mask[i]]

0 commit comments

Comments
 (0)