Mondaic

salvus.flow.acta.serializers.data_array

salvus.flow.acta.serializers.data_array salvus flow acta serializers data_array

Acta serialization for xarray.DataArray.

Salvus’ own types define their own via __acta_serialize__ / __acta_deserialize__ and so on.

This module is for external types.

Functions

dataarray_to_netcdf_bytes()

def dataarray_to_netcdf_bytes(da: DataArray) -> bytes: ...

Serialize an xarray.DataArray to in-memory NetCDF bytes.

The stationxml/MultiIndex conversions run on a copy; the object passed in — its data, coordinates, and .attrs — is untouched. The copies are shallow (they share the data buffer, so a large array is never duplicated) because only .attrs is ever rewritten.

Parameters
  • da DataArray — The array to serialize.
Returns bytes

netcdf_bytes_to_dataarray()

def netcdf_bytes_to_dataarray(data: bytes) -> DataArray: ...

Invert dataarray_to_netcdf_bytes.

Parameters
  • data bytes — The NetCDF bytes.
Returns DataArray