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
I'm trying to convert a Zarr dataset in the Zarr format/version 3 to 2. Xarray can successfully read zarr v2 or v3. I can make an xarray dataset in memory and write to disc in either zarr v2 or v3. I seem to find this problem only when reading an existing zarr v3 and and attempting to write to a zarr v2. However i can successfully convert the opposite direction by reading an existing zarr v2 and writing to zarr v3. Given that all the other read/write scenarios that i've tried work fine, i'm guessing there's some internal config set when reading a dataset from zarr v3 which maybe doesn't exist or has an incompatible default for in zarr v2.
importxarrayasxrimportnumpyasnp# generate a random array and write it to zarr v3arr=np.random.rand(100, 100)
(
xr
.DataArray(arr, dims=['x', 'y'], name='data')
.to_zarr(
'./test-v3.zarr',
zarr_format=3
)
)
# now try to convert it to a zarr 2
(
xr
.open_zarr('./test-v3.zarr')
.to_zarr('test-v2.zarr', zarr_format=2)
)
MVCE confirmation
Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
Complete example — the example is self-contained, including all data and the text of any traceback.
Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
New issue — a search of GitHub Issues suggests this is not a duplicate.
Recent environment — the issue occurs with the latest version of xarray and its dependencies.
I'm happy to make a pull request but I need explanation of what serializer is/does. The "does not support" language in the error makes me unsure if this is intended behavior or not. Either way, i feel that it should be possible to make this conversion.
What happened?
I'm trying to convert a Zarr dataset in the Zarr format/version 3 to 2. Xarray can successfully read zarr v2 or v3. I can make an xarray dataset in memory and write to disc in either zarr v2 or v3. I seem to find this problem only when reading an existing zarr v3 and and attempting to write to a zarr v2. However i can successfully convert the opposite direction by reading an existing zarr v2 and writing to zarr v3. Given that all the other read/write scenarios that i've tried work fine, i'm guessing there's some internal config set when reading a dataset from zarr v3 which maybe doesn't exist or has an incompatible default for in zarr v2.
What did you expect to happen?
I expected this to be possible
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment
This is on a google colab machine but i've also replicated this on so Mac and Windows installations
xarray: 2025.3.1
pandas: 2.2.2
numpy: 2.0.2
scipy: 1.15.3
netCDF4: None
pydap: None
h5netcdf: 1.6.1
h5py: 3.13.0
zarr: None
cftime: None
nc_time_axis: None
iris: None
bottleneck: 1.4.2
dask: 2024.12.1
distributed: 2024.12.1
matplotlib: 3.10.0
cartopy: None
seaborn: 0.13.2
numbagg: None
fsspec: 2025.3.2
cupy: 13.3.0
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 75.2.0
pip: 24.1.2
conda: None
pytest: 8.3.5
mypy: None
IPython: 7.34.0
sphinx: 8.2.3
The text was updated successfully, but these errors were encountered: