Skip to content

Commit

Permalink
fix persist_dataset was missing zarr format
Browse files Browse the repository at this point in the history
  • Loading branch information
gtramonte committed Jan 31, 2025
1 parent 979bfb3 commit 0c36682
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions executor/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def persist_datacube(
format_args = message.content.format_args
else:
format = "netcdf"
for var in kube.fields.values():
if '_FillValue' in kube[var.name].encoding and 'missing_value' in kube[var.name].encoding:
del kube[var.name].encoding['missing_value']
match format:
case "netcdf":
full_path = os.path.join(base_path, f"{path}.nc")
Expand Down Expand Up @@ -178,6 +181,9 @@ def _persist_single_datacube(dataframe_item, base_path, format, format_args=None
message.request_id,
]
)
for var in dcube.fields.values():
if '_FillValue' in dcube[var.name].encoding and 'missing_value' in dcube[var.name].encoding:
del dcube[var.name].encoding['missing_value']
match format:
case "netcdf":
full_path = os.path.join(base_path, f"{path}.nc")
Expand All @@ -194,6 +200,11 @@ def _persist_single_datacube(dataframe_item, base_path, format, format_args=None
case "csv":
full_path = os.path.join(base_path, f"{path}.csv")
dcube.to_csv(full_path)
case "zarr":
full_path = os.path.join(base_path, f"{path}.zarr")
dcube.to_zarr(full_path, mode='w', consolidated=True)
case _:
raise ValueError(f"format `{format}` is not supported")
return full_path

if isinstance(message.content, GeoQuery):
Expand Down

0 comments on commit 0c36682

Please sign in to comment.