Skip to content

NetCDF4Backend

Import path: earth2studio.io.NetCDF4Backend

View source on GitHub

Documentation

A backend that supports the NetCDF4 format.

Parameters:

  • file_name (str) –

    Location of the netCDF4 file to open or create.

  • backend_kwargs (dict[str, Any], default: {'mode': 'r+', 'diskless': False} ) –

    Key word arguments for netCDF.Dataset root object, by default

Note

For keyword argument options see: unidata.github.io/netcdf4-python/#netCDF4.Dataset

Note

Attribute values netCDF cannot store natively, such as lists and dictionaries, are stored as JSON strings and are read back as strings.

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.

Examples using earth2studio.io.NetCDF4Backend