-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
needs mcvehttps://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reportshttps://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
Description
What happened?
Coordinate arrays of type object can not be written, read, and then written again.
Minimal Complete Verifiable Example
import xarray as xr
import numpy as np
data = xr.DataArray(data=np.zeros((2, 2)),
dims=['x', 'y'],
coords=dict(
y=np.array(['a', 'b'],
dtype=object)))
data.to_zarr("test.zarr", mode="w")
data = xr.open_zarr("test.zarr")
data.to_zarr("test2.zarr", mode="w")
# File "numcodecs/vlen.pyx", line 104, in numcodecs.vlen.VLenUTF8.encode
# TypeError: expected unicode string, found 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.
Environment
xarray==2025.9.0
Metadata
Metadata
Assignees
Labels
needs mcvehttps://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reportshttps://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports