Skip to content

Commit

Permalink
fix(tensorstore): Name zarr store appropriately in S3
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Nov 11, 2024
1 parent 9f55084 commit b21e477
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/nwp_consumer/internal/entities/tensorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def initialize_empty_store(
"region_name": os.getenv("AWS_REGION", "eu-west-1"),
},
)
store = s3fs.mapping.S3Map(zarrdir, fs, check=True, create=True)
path = zarrdir
path = zarrdir + "/" + TensorStore.gen_store_filename(coords=coords)
store = s3fs.mapping.S3Map(path, fs, check=True, create=True)
except Exception as e:
return Failure(OSError(
f"Unable to create file mapping for ZARRDIR '{zarrdir}'. "
Expand All @@ -164,7 +164,7 @@ def initialize_empty_store(
# Write the coordinates to a skeleton Zarr store
# * 'compute=False' enables only saving metadata
# * 'mode="w"' overwrites any existing store
log.info("Initialising zarr store at '%s'", store)
log.info("Initialising zarr store at '%s'", path)
da: xr.DataArray = coords.as_zeroed_dataarray(name=model)
encoding = {
model: {"write_empty_chunks": False},
Expand All @@ -184,7 +184,7 @@ def initialize_empty_store(
except Exception as e:
return Failure(
OSError(
f"Failed writing blank store to disk: {e}",
f"Failed writing blank store to '{path}': {e}",
),
)

Expand All @@ -194,7 +194,7 @@ def initialize_empty_store(
return Failure(
OSError(
f"Error reading back coordinates of initialized store "
f"from disk (possible corruption): {coordinate_map_result}",
f"from path '{path}' (possible corruption): {coordinate_map_result}",
),
)

Expand Down

0 comments on commit b21e477

Please sign in to comment.