cngi.dio.write_image

write_image(xds, outfile, chunks_return={}, chunks_on_disk={}, consolidated=True, compressor=None, graph_name='write_zarr')[source]

Write image xarray dataset to zarr format on disk. When chunks_on_disk is not specified the chunking in the input dataset is used. When chunks_on_disk is specified that dataset is saved using that chunking. :param xds: Dataset to write to disk :type xds: xarray.core.dataset.Dataset :param outfile: outfile filename, generally ends in .zarr :type outfile: str :param chunks_on_disk: A dictionary with the chunk size that will be used when writing to disk. For example {‘time’: 20, ‘chan’: 6}.

If chunks_on_disk is not specified the chunking of dataset will be used.

Parameters
  • compressor (numcodecs.blosc.Blosc) – The blosc compressor to use when saving the converted data to disk using zarr. If None the zstd compression algorithm used with compression level 2.

  • graph_name (string) – The time taken to execute the graph and save the dataset is measured and saved as an attribute in the zarr file. The graph_name is the label for this timing information.