Zarr.jl
Zarr.jl copied to clipboard
adding and editing attributes to an existing zarr array
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.
Maybe functions like the put
, update
, and refresh
methods in https://zarr.readthedocs.io/en/stable/api/attrs.html would be useful.