From a30564cd547a1a47b46bd09e2f2804a32e650ff0 Mon Sep 17 00:00:00 2001 From: devsjc <47188100+devsjc@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:17:10 +0000 Subject: [PATCH] fix(tensorstore): Swap path to str --- src/nwp_consumer/internal/entities/tensorstore.py | 10 +++++----- src/nwp_consumer/internal/services/archiver_service.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nwp_consumer/internal/entities/tensorstore.py b/src/nwp_consumer/internal/entities/tensorstore.py index b0626764..131b7d6f 100644 --- a/src/nwp_consumer/internal/entities/tensorstore.py +++ b/src/nwp_consumer/internal/entities/tensorstore.py @@ -55,7 +55,7 @@ class TensorStore(abc.ABC): name: str """Identifier for the store and the data within.""" - path: pathlib.Path + path: str """The path to the store.""" coordinate_map: NWPDimensionCoordinateMap @@ -355,7 +355,7 @@ def scan_parameter_values(self, p: Parameter) -> ResultE[ParameterScanResult]: ), ) - def postprocess(self, options: PostProcessOptions) -> ResultE[pathlib.Path]: + def postprocess(self, options: PostProcessOptions) -> ResultE[str]: """Post-process the store. This creates a new store, as many of the postprocess options require @@ -374,14 +374,14 @@ def postprocess(self, options: PostProcessOptions) -> ResultE[pathlib.Path]: else: return Success(self.path) - def update_attrs(self, attrs: dict[str, str]) -> ResultE[pathlib.Path]: + def update_attrs(self, attrs: dict[str, str]) -> ResultE[str]: """Update the attributes of the store. This method updates the attributes of the store with the given dictionary. """ - group: zarr.Group = zarr.open_group(self.path.as_posix()) + group: zarr.Group = zarr.open_group(self.path) group.attrs.update(attrs) - zarr.consolidate_metadata(self.path.as_posix()) + zarr.consolidate_metadata(self.path) return Success(self.path) def missing_times(self) -> ResultE[list[dt.datetime]]: diff --git a/src/nwp_consumer/internal/services/archiver_service.py b/src/nwp_consumer/internal/services/archiver_service.py index 37fc6309..2edf08b5 100644 --- a/src/nwp_consumer/internal/services/archiver_service.py +++ b/src/nwp_consumer/internal/services/archiver_service.py @@ -140,3 +140,4 @@ def archive(self, year: int, month: int) -> ResultE[pathlib.Path]: return Failure( TypeError(f"Unexpected result type: {type(init_store_result)}"), ) +