Earth2Studio is now OSS!

earth2studio.io.ZarrBackend#

class earth2studio.io.ZarrBackend(file_name=None, chunks={}, backend_kwargs={'overwrite': False})[source]#

A backend that supports the zarr format.

Parameters:
  • file_name (str, optional) – Optional name to provide to the zarr store, if provided then this function will create a directory store with this file name. If none, will create a in-memory store., by default None

  • chunks (dict[str, int], optional) – An ordered dict of chunks to use with the data passed through data/coords, by default {}

  • backend_kwargs (dict[str, Any], optional) – Key word arguments for zarr.Group root object, by default {“overwrite”: False}

Note

For keyword argument options see: https://zarr.readthedocs.io/en/stable/api/hierarchy.html

add_array(coords, array_name, data=None, **kwargs)[source]#

Add an array to the existing zarr group.

Parameters:
  • coords (CoordSystem) – Ordered dict of coordinate information.

  • array_name (str) – Name to add to zarr group for the new array.

  • data (torch.Tensor | list[torch.Tensor], optional) – Optional data to initialize the array with. If None, then the array is NaN initialized (zarr default). Can also pass a list of tensors, which must match in length to the list of array_names passed. If a list of tensors is passed, it is assumed that each tensor share coords.

  • kwargs (Any) – Optional keyword arguments passed to zarr dataset constructor.

Return type:

None

write(x, coords, array_name)[source]#

Write data to the current zarr group using the passed array_name.

Parameters:
  • x (torch.Tensor | list[torch.Tensor]) – Tensor(s) to be written to zarr store.

  • coords (OrderedDict) – Coordinates of the passed data.

  • array_name (str | list[str]) – Name(s) of the array(s) that will be written to.

Return type:

None

Examples using earth2studio.io.ZarrBackend#

Running Deterministic Inference

Running Deterministic Inference

Running Diagnostic Inference

Running Diagnostic Inference

Running Ensemble Inference

Running Ensemble Inference

Generative Downscaling

Generative Downscaling

Single Variable Perturbation Method

Single Variable Perturbation Method

Model Hook Injection: Perturbation

Model Hook Injection: Perturbation

Distributed Manager Inference

Distributed Manager Inference

Extending Prognostic Models

Extending Prognostic Models

Extending Diagnostic Models

Extending Diagnostic Models

Extending Data Sources

Extending Data Sources