Skip to content

Commit

Permalink
fix(sat-etl): Guard against write exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Jun 20, 2024
1 parent ba90d4d commit 4916735
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions containers/sat/download_process_sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,17 @@ def _write_to_zarr(dataset: xr.Dataset, zarr_name: str, mode: str, chunks: dict)
},
}
extra_kwargs = mode_extra_kwargs[mode]
dataset.isel(x_geostationary=slice(0, 5548)).chunk(chunks).to_zarr(
store=zarr_name,
compute=True,
consolidated=True,
mode=mode,
**extra_kwargs,
)
sliced_ds: xr.Dataset = dataset.isel(x_geostationary=slice(0, 5548)).chunk(chunks)
try:
sliced_ds.to_zarr(
store=zarr_name,
compute=True,
consolidated=True,
mode=mode,
**extra_kwargs,
)
except Exception as e:
log.error(f"Error writing to zarr: {e}")


def _rewrite_zarr_times(output_name: str) -> None:
Expand Down

0 comments on commit 4916735

Please sign in to comment.