Open naught101 opened 5 years ago
netCDF4-Python doesn't seem to support this:
In [1]: import netCDF4
In [2]: f = netCDF4.Dataset('test.nc', 'w')
In [3]: f.foo = {'bar': 2}
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-45a6eb241d31> in <module>()
----> 1 f.foo = {'bar': 2}
netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Dataset.__setattr__()
netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Dataset.setncattr()
netCDF4/_netCDF4.pyx in netCDF4._netCDF4._set_att()
TypeError: illegal data type for attribute b'foo', must be one of dict_keys(['S1', 'i1', 'u1', 'i2', 'u2', 'i4', 'u4', 'i8', 'u8', 'f4', 'f8']), got O
It is supporter in netcdf4
Compound types should be used. See: https://github.com/Unidata/netcdf4-python/issues/905
Code Sample, a copy-pastable example if possible
A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
Problem description
I'm not entirely sure if this should be possible, but it seems like it should be from this email: https://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg10502.html
Nested attributes would be nice as a way to namespace metadata.
Expected Output
Netcdf with nested global attributes.
Output of
xr.show_versions()