diff --git a/src/anemoi/datasets/commands/inspect/__init__.py b/src/anemoi/datasets/commands/inspect/__init__.py index 29472232..4c8cad0e 100644 --- a/src/anemoi/datasets/commands/inspect/__init__.py +++ b/src/anemoi/datasets/commands/inspect/__init__.py @@ -17,7 +17,7 @@ class Inspect(Command, InspectZarr): def add_arguments(self, command_parser): # g = command_parser.add_mutually_exclusive_group() - command_parser.add_argument("path", metavar="PATH", nargs="+") + command_parser.add_argument("path", metavar="DATASET") command_parser.add_argument("--detailed", action="store_true") # command_parser.add_argument("--probe", action="store_true") command_parser.add_argument("--progress", action="store_true") @@ -25,13 +25,7 @@ def add_arguments(self, command_parser): command_parser.add_argument("--size", action="store_true", help="Print size") def run(self, args): - dic = vars(args) - for path in dic.pop("path"): - if os.path.isdir(path) or path.endswith(".zarr.zip") or path.endswith(".zarr"): - self.inspect_zarr(path=path, **dic) - else: - raise ValueError(f"Unknown file type: {path}") - # self.inspect_checkpoint(path=path, **dic) + self.inspect_zarr(**vars(args)) command = Inspect diff --git a/src/anemoi/datasets/commands/inspect/zarr.py b/src/anemoi/datasets/commands/inspect/zarr.py index 9a23ecee..fcced9e3 100644 --- a/src/anemoi/datasets/commands/inspect/zarr.py +++ b/src/anemoi/datasets/commands/inspect/zarr.py @@ -24,6 +24,7 @@ from anemoi.datasets import open_dataset from anemoi.datasets.data.stores import open_zarr +from anemoi.datasets.data.stores import zarr_lookup LOG = logging.getLogger(__name__) @@ -616,14 +617,7 @@ def inspect_zarr(self, path, **kwargs): raise def _info(self, path): - if path.endswith("/"): - path = path[:-1] - - try: - z = open_zarr(path) - except Exception as e: - LOG.error("Error opening zarr file '%s': %s", path, e) - raise + z = open_zarr(zarr_lookup(path)) metadata = dict(z.attrs) version = metadata.get("version", "0.0.0")