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
Currently, we disallow to save complex values to a netCDF file.
Maybe netCDF itself does not support complex values, but there may be some workarounds.
It would be very handy for me.
The most naive workaround may be to split each complex value into a real and imaginary part, add some flags, and restore it when loading them from the file.
Maybe we may add a special suffix to the variable name?
I think there may be a better way.
Any thoughts are welcome :)
p.s.
I just found that engine=h5netcdf can save complex values, but the file becomes an invalid netcdf file.
I'm not sure if it worth the trouble just to make a valid netCDF file.
The text was updated successfully, but these errors were encountered:
For others reading this issue, the h5netcdf workaround was discussed in #3297, with further discussion on supporting complex numbers in netCDF in cf-convention/discuss#369.
The short version: engine="h5netcdf", invalid_netcdf=True will save these files, but the netCDF-C library doesn't understand the result. Reading with engine="h5netcdf" may be able to round-trip these files, but I haven't checked that.
There is a longer discussion of why netCDF-C doesn't understand these files at Unidata/netcdf-c#267. That specific issue is for booleans, but complex numbers are likely the same.
Currently, we disallow to save complex values to a netCDF file.
Maybe netCDF itself does not support complex values, but there may be some workarounds.
It would be very handy for me.
The most naive workaround may be to split each complex value into a real and imaginary part, add some flags, and restore it when loading them from the file.
Maybe we may add a special suffix to the variable name?
I think there may be a better way.
Any thoughts are welcome :)
p.s.
I just found that
engine=h5netcdf
can save complex values, but the file becomes an invalid netcdf file.I'm not sure if it worth the trouble just to make a valid netCDF file.
The text was updated successfully, but these errors were encountered: