xarray_beam.Dataset.map_blocks

Dataset.map_blocks(func, *, template=None, chunks=None, label=None)[source]

Map a function over the chunks of this dataset.

Parameters:
  • func (Callable[[Dataset], Dataset]) – any function that does not change the size of dataset chunks, called like func(chunk), where chunk is an xarray.Dataset.

  • template (Dataset | None) – new template for the resulting dataset. If not provided, an attempt will be made to infer the template by applying func to the existing template, which requires that func is implemented using dask compatible operations.

  • chunks (Mapping[str, int] | None) – explicit new chunks sizes created by applying func. If not provided, an attempt will be made to infer the new chunks based on the existing chunks, dimensions sizes and the new template.

  • label (str | None) – A unique name for this stage of the pipeline. Defaults to None, in which case a name will be generated.

Returns:

New Dataset with updated chunks.

Return type:

Dataset