You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError Traceback (most recent call last)
<ipython-input-11-4e7ad4f0a599> in <module>
----> 1 ds.to_zarr('ll.zarr', mode='w')
/srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/core/dataset.py in to_zarr(self, store, mode, synchronizer, group, encoding, compute, consolidated, append_dim)
1614 compute=compute,
1615 consolidated=consolidated,
-> 1616 append_dim=append_dim,
1617 )
1618
/srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/backends/api.py in to_zarr(dataset, store, mode, synchronizer, group, encoding, compute, consolidated, append_dim)
1299 # validate Dataset keys, DataArray names, and attr keys/values
1300 _validate_dataset_names(dataset)
-> 1301 _validate_attrs(dataset)
1302
1303 if mode == "a":
/srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/backends/api.py in _validate_attrs(dataset)
209 # Check attrs on the dataset itself
210 for k, v in dataset.attrs.items():
--> 211 check_attr(k, v)
212
213 # Check attrs on each variable within the dataset
/srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/backends/api.py in check_attr(name, value)
204 "a string, an ndarray or a list/tuple of "
205 "numbers/strings for serialization to netCDF "
--> 206 "files".format(value)
207 )
208
TypeError: Invalid value for attr: {'bar': 1} must be a number, a string, an ndarray or a list/tuple of numbers/strings for serialization to netCDF files
Additionally the error message mentions netCDF -- even if I am writing a Zarr file.
Workaround is to save as a list, i.e.
ds.attrs['foo'] = [{'bar': 1}]
The text was updated successfully, but these errors were encountered:
Similar to #2868, but for Zarr. In this case Zarr should support saving nested dictionaries.
Error message:
Additionally the error message mentions netCDF -- even if I am writing a Zarr file.
Workaround is to save as a list, i.e.
The text was updated successfully, but these errors were encountered: