Skip to content

properties dataset attribute cannot be written to netCDF #17

@observingClouds

Description

@observingClouds

The properties global attribute is a dictionary that cannot be written to netCDF as it is not serialized automatically to one of the netCDF supported types.

Minimal example

Minimal example following the structure expected by

def properties_from_attrs(ds) -> Properties:

import xarray as xr
ds = xr.Dataset()
ds.attrs['properties'] = {'space': 'point', 'time':'observations', 'uncertainty': 'deterministic'}
ds.to_netcdf("bla.nc")

causing

*** TypeError: Invalid value for attr 'properties': {'space': 'point', 'time': 'observations', 'uncertainty': 'deterministic'}. For serialization to netCDF files, its value must be of one of the following types: str, Number, ndarray, number, list, tuple, bytes

Current work-around is to store these datasets as zarr.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions