i7aof.io_zarr¶
Utilities for writing NetCDF and related I/O helpers. See i7aof.io, i7aof.io_zarr and i7aof.download for developer details.
Utilities for writing chunked datasets to Zarr and finalizing to NetCDF.
This module centralizes the common pattern used across workflows:
Append one or more chunked xarray Datasets to a temporary Zarr store
Open the consolidated Zarr dataset, optionally apply a postprocess
Write the final NetCDF once and remove the Zarr store
The helpers wrap xarray’s to_zarr/open_zarr and reuse i7aof.io.write_netcdf for consistent NetCDF writing options (fill values, progress bar, engine).
- i7aof.io_zarr.append_to_zarr(*, ds: Dataset, zarr_store: str, first: bool, append_dim: str | None) bool¶
Append a dataset to a Zarr store, creating it if
firstis True.Returns the updated value for
first(False after first write).
- i7aof.io_zarr.finalize_zarr_to_netcdf(*, zarr_store: str, out_nc: str, postprocess: Callable[[Dataset], Dataset] | None = None, **kwargs) None¶
Open a Zarr store, optionally postprocess, then write NetCDF and clean.
- Parameters:
zarr_store (str) – Path to the Zarr store directory to consolidate.
out_nc (str) – Target NetCDF output path.
postprocess (callable, optional) – Function mapping
xr.Dataset -> xr.Datasetapplied before writing NetCDF to allow attribute fixes, coordinate/bounds injection, etc.**kwargs – Additional keyword arguments passed to
i7aof.io.write_netcdf.