xarray-contrib/xarray-simlab

Error when storing output arrays with object dtype

benbovy opened this issue · 0 comments

Reported by @bgailleton.

Xarray-simlab fails to store snapshots for output variables with object dtype even when a object_codec is given, e.g,

xs.variable(..., intent='out',  encoding={'object_codec' : numcodecs.JSON, 'dtype': object})

It yields ValueError: missing object_codec for object array

We should provide a dummy object codec when the given dtype is object here: https://github.com/benbovy/xarray-simlab/blob/45359e99cbf6341464b02cb937618c051a58a31c/xsimlab/stores.py#L74-L77