Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when storing output arrays with object dtype #144

Closed
benbovy opened this issue Nov 12, 2020 · 0 comments · Fixed by #145
Closed

Error when storing output arrays with object dtype #144

benbovy opened this issue Nov 12, 2020 · 0 comments · Fixed by #145
Labels

Comments

@benbovy
Copy link
Member

benbovy commented Nov 12, 2020

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

@benbovy benbovy added the bug label Nov 12, 2020
bgailleton added a commit to bgailleton/xarray-simlab that referenced this issue Nov 12, 2020
…able dtype is object or np.object. It works at runtime and the variable is successfully saved in the Dataset, but it fails at sabing to file xarray-contrib#144
benbovy added a commit that referenced this issue Nov 12, 2020
* I added a test that provides a dummy object_codec to zarr if the variable dtype is object or np.object. It works at runtime and the variable is successfully saved in the Dataset, but it fails at sabing to file #144

* add test + minor fixes

* black

* update release notes

Co-authored-by: Benoit Bovy <benbovy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant