zarr-python
zarr-python copied to clipboard
WIP: Add custom json encoder and decoder
Add custom JsonEncoder
/ JsonDecoder
to properly handle nan and inf attributes, see #412.
Also adds a test to ensure these values are properly encoded / decoded.
This is still WIP because:
- I haven't tested the solution myself yet.
- Potentially one could simplify the code here and here with this solution, but I am not sure this is a good idea, because I don't know if we can always assume that the metadata passes through
zarr.util.json_dumps/json_loads
- Potentially one could also add json encoding for numpy dtypes; this is an error that always annoys me a lot, but it's unrelated to #412.
TODO:
- [x] Add unit tests and/or doctests in docstrings
- [ ] Add docstrings and API docs for any new/modified user-facing classes and functions
- [ ] New/modified features documented in docs/tutorial.rst
- [ ] Changes documented in docs/release.rst
- [ ] AppVeyor and Travis CI passes
- [ ] Test coverage is 100% (Coveralls passes)
Should the encoder/decoder bits be moved to Numcodecs?
Should the encoder/decoder bits be moved to Numcodecs?
Happy to move it there if you think that would make more sense. Would you put it here?
Tests pass, so the solution seems to be viable.
Sorry, @constantinpape. Somehow I missed this when reviewing https://github.com/zarr-developers/zarr-python/pull/933 which maybe should been considered together.
Zarr/JSON encoding came up again yesterday during the community call. I will try to resolve the conflicts here and see how things stand.
This has unfortunately gone stale. Will it be revived or should we close this?
Closing this out as stale. We'll keep the feature request open.