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

adding and editing attributes to an existing zarr array #129

Open
Alexander-Barth opened this issue Nov 24, 2023 · 1 comment
Open

adding and editing attributes to an existing zarr array #129

Alexander-Barth opened this issue Nov 24, 2023 · 1 comment

Comments

@Alexander-Barth
Copy link
Contributor

I am wondering if it is possible to add or edit attributes of a zarr array after it has been created.

Here is a naive attempt to do so:

using Zarr 
fname = tempname()
z1 = zcreate(Int, 1000,1000,path = fname,chunks=(100, 100),attrs = Dict(
    "bar" => "foo",
))
z2 = zopen(fname,"w")
z2.attrs["bar"]  = 42
# need a zclose?

z2 = zopen(fname,"r")
z2.attrs["bar"]
# still "foo"

Maybe we would need a zclose that synchronizes z2.attrs with the json file .zattrs.

I am using Zarr v0.9.1.

@nhz2
Copy link
Member

nhz2 commented Nov 26, 2023

Maybe functions like the put, update, and refresh methods in https://zarr.readthedocs.io/en/stable/api/attrs.html would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants