Skip to content

KVBackend

Import path: earth2studio.io.KVBackend

View source on GitHub

Documentation

A key-value (dict) backend holding Torch tensors.

Stored arrays are Torch tensors on device, keyed by name in root. Dimension and auxiliary coordinates are kept in coords and the store is available as an xarray.Dataset from to_xarray.

Parameters:

  • device (str, default: 'cpu' ) –

    Device to keep array tensors on, by default "cpu"

add_array

add_array(template: DataArray) -> None

Create the arrays a template describes.

Parameters:

  • template (DataArray) –

    Concrete coordinate signature; field values are never read.

write

write(x: DataArray) -> None

Write a field at the positions its coordinate labels identify.

Parameters:

  • x (DataArray) –

    NumPy-, CuPy- or Torch-backed field. It is never modified; its data is copied onto the store's device.

Examples using earth2studio.io.KVBackend