Earth2Studio is now OSS!

earth2studio.io.ZarrBackend#

class earth2studio.io.ZarrBackend(file_name=None, chunks={})[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 not, will create a memory store.

  • chunks (dict[str, int]) – An ordered dict of chunks to use with the data passed through data/coords.

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 Simple Inference

Running Simple 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

Extending Prognostic Models

Extending Prognostic Models

Extending Diagnostic Models

Extending Diagnostic Models

Extending Data Sources

Extending Data Sources