Skip to content

Commit 5237ccc

Browse files
Refactoring _format_output_location
1 parent d1cb597 commit 5237ccc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

parcels/particleset.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import xarray as xr
99
from scipy.spatial import KDTree
1010
from tqdm import tqdm
11+
from zarr.storage import DirectoryStore
1112

1213
from parcels._core.utils.time import TimeInterval, maybe_convert_python_timedelta_to_numpy
1314
from parcels._reprs import particleset_repr
@@ -535,11 +536,7 @@ def execute(
535536

536537
# Set up pbar
537538
if output_file:
538-
if hasattr(output_file.store, "path"):
539-
zarr_path = output_file.store.path
540-
else:
541-
zarr_path = output_file.store
542-
logger.info(f"Output files are stored in {zarr_path}")
539+
logger.info(f"Output files are stored in {_format_output_location(output_file.store)}")
543540

544541
if verbose_progress:
545542
pbar = tqdm(total=(end_time - start_time) / np.timedelta64(1, "s"), file=sys.stdout)
@@ -653,3 +650,9 @@ def _get_start_time(first_release_time, time_interval, sign_dt, runtime):
653650

654651
start_time = first_release_time if not np.isnat(first_release_time) else fieldset_start
655652
return start_time
653+
654+
655+
def _format_output_location(zarr_obj):
656+
if isinstance(zarr_obj, DirectoryStore):
657+
return zarr_obj.path
658+
return repr(zarr_obj)

0 commit comments

Comments
 (0)