netcdf-c
netcdf-c copied to clipboard
Zarr scalars aren't not correctly handled
As an example here's some python code that writes a xarray dataset into netcdf and zarr (version 2):
import xarray as xr
ds = xr.Dataset({'var':123456789})
ds.to_netcdf('xr.nc')
ds.to_zarr('xr.zarr')
In netcdf the scalar is well interpreted:
$ ncdump xr.nc
netcdf xr {
variables:
int var ;
data:
var = 123456789 ;
}
In zarr the scalar variable is suppressed:
$ ncdump -L 0 file://${PWD}/xr.zarr#mode=zarr,file
WARN: Empty shape for variable var suppressed
netcdf xr {
}
You are using Zarr V3, correct?
No, zarrV2 still...
I created the dataset with python3.10, using xarray=2025.1.1 and zarr-python=2.18.2. To check, I built netcdf-c from the current main.
#3109 tries to patch this but it seems that constants/scalar where not contemplated/supported to begin-with!?
(not much relevant for the moment, but for the I also patched it )