You can either use region=
or extend along a single dimension with to_zarr()
, but you can’t do both at the same time.
You can of course edit the Zarr metadata yourself, but personally I like to stick with Xarray for this sort of thing:
- Create a lazy Xarray dataset in Dask the size of the entire result. I would typically do this with some combination of indexing,
xarray.zeros_likes
andxarray.concat
/expand_dims
on a single time slice, like in this example from Xarray-Beam. - Write the Zarr metadata using
to_zarr()
withcompute=False
- Write each chunk using
region=
from a separate processes.
These notes may also be helpful. Beam is just a convenient way to map over many tasks – the same pattern also works for other distributed engines.