-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
to_netcdf broken encoding: dtype='S1' + chunksizes #2219
Copy link
Copy link
Closed as not planned
Labels
plan to closeMay be closeable, needs more eyeballsMay be closeable, needs more eyeballs
Description
xarray.Dataset({'x': ['foo', 'bar', 'baz']}).to_netcdf(
'foo.nc', engine='h5netcdf',
encoding={'x': {'dtype': 'S1', 'zlib': True, 'chunksizes': (2, )}})
ValueError: "chunks" must have same rank as dataset shape
Same with engine='netcdf4'. The issue is present in 0.10.6 as well as in 0.10.3.
The problem is obviously that dtype=S1 changes the shape of the variable before passing it to the backend, but while doing so doesn't also change an eventual chunksizes setting.
The workaround is to omit chunksizes or set it to True.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
plan to closeMay be closeable, needs more eyeballsMay be closeable, needs more eyeballs