zarr-python
zarr-python copied to clipboard
Attributes are not updated when using a dictionary
Minimal, reproducible code sample, a copy-pastable example if possible
Run the following twice:
import zarr
if __name__ == "__main__":
foo = zarr.open_group("/tmp/foo.zarr")
if "bla" in foo.attrs:
print("after loading:", foo.attrs["bla"]["foo"])
foo.attrs["bla"] = {"foo": 13}
print("after initialize:", foo.attrs["bla"]["foo"])
foo.attrs["bla"]["foo"] = 42
print("after update:", foo.attrs["bla"]["foo"])
Problem description
If storing a dictionary in the attributes of a group, it will be initialised correctly but changes don't seem to be written to disk.
When running the above example multiple times, I would expect the following output:
after loading: 42
after initialize: 13
after update: 42
However, I am getting
after loading: 13
after initialize: 13
after update: 42
I do not have the issue when directly writing an integer to foo.attrs["bla"]
, only when using the dictionary.
Version and installation information
Please provide the following:
- Value of
zarr.__version__
: 2.6.1 - Value of
numcodecs.__version__
: 0.7.3 - Version of Python interpreter: 3.6.5
- Operating system: Ubuntu 18.04
- How Zarr was installed:
pip3 install zarr