From 471e49db071643936976b9f8338bdfeea6f31b59 Mon Sep 17 00:00:00 2001 From: Alex Gardner Date: Thu, 15 Oct 2026 14:32:41 -0700 Subject: [PATCH 1/3] Read a group's Zarr format from its field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ZGroup has no metadata field in ZarrCore 0.11.1, so zarr_format(ds) raised a FieldError and every add_var call failed. The format is the group's zarr_format field, a ZarrFormat{N} that converts to Int. Co-authored-by: Claude 🤖 --- ext/ZarrCoreExt.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ZarrCoreExt.jl b/ext/ZarrCoreExt.jl index 1d6e100..959b33c 100644 --- a/ext/ZarrCoreExt.jl +++ b/ext/ZarrCoreExt.jl @@ -94,7 +94,7 @@ end YAB.create_empty(::Type{ZarrDataset}, path, gatts=Dict(); format=2, kwargs...) = ZarrDataset(zgroup(ZarrCore.storefromstring(path, true)..., format; attrs=gatts)) -zarr_format(ds::ZarrDataset) = zarr_format(ds.g.metadata) +zarr_format(ds::ZarrDataset) = Int(ds.g.zarr_format) From cca585981bb34ae24d2850dc0648046b6bcf5a70 Mon Sep 17 00:00:00 2001 From: Alex Gardner Date: Thu, 15 Oct 2026 14:32:49 -0700 Subject: [PATCH 2/3] Pass zarr_format to ZarrCore.zcreate in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ZarrCore.zcreate takes the format as the zarr_format keyword. The tests that call it directly passed format, which zcreate rejects; format is the keyword of the YAXArrayBase functions only. Co-authored-by: Claude 🤖 --- test/datasets.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/datasets.jl b/test/datasets.jl index c5e4f44..74e7898 100644 --- a/test/datasets.jl +++ b/test/datasets.jl @@ -73,7 +73,7 @@ end h = get_var_handle(ds_loaded, "tas") @test h[:, :] == reshape(1:12, 3, 4) @test !YAXArrayBase.iscompressed(h) - @test !YAXArrayBase.iscompressed(zcreate(Float32, 3, 4, format=3)) + @test !YAXArrayBase.iscompressed(zcreate(Float32, 3, 4; zarr_format=3)) @test_throws "ZarrZip" to_dataset(tempname() * ".zarr.zip") end @@ -81,8 +81,8 @@ using ZarrHTTP, ZarrBlosc, ZarrZip @testset "Zarr iscompressed" begin for format in (2, 3) - @test YAXArrayBase.iscompressed(zcreate(Float32, 3, 4; format)) - @test !YAXArrayBase.iscompressed(zcreate(Float32, 3, 4; format, compressor=ZarrCore.NoCompressor())) + @test YAXArrayBase.iscompressed(zcreate(Float32, 3, 4; zarr_format=format)) + @test !YAXArrayBase.iscompressed(zcreate(Float32, 3, 4; zarr_format=format, compressor=ZarrCore.NoCompressor())) end end From 3e768682f86ac811f715697536c3015f6b5922e1 Mon Sep 17 00:00:00 2001 From: Alex Gardner Date: Thu, 15 Oct 2026 14:35:09 -0700 Subject: [PATCH 3/3] Check the zarr_format key of v3 metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Zarr v3 zarr.json files carry the format version under the key zarr_format; there is no key named format. Co-authored-by: Claude 🤖 --- test/datasets.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/datasets.jl b/test/datasets.jl index 74e7898..45b2862 100644 --- a/test/datasets.jl +++ b/test/datasets.jl @@ -203,7 +203,7 @@ import JSON @test length(nodes) == 6 for n in nodes j = JSON.parsefile(n) - @test j["format"] == 3 + @test j["zarr_format"] == 3 if j["node_type"] == "array" @test haskey(j, "dimension_names") @test !haskey(get(j, "attributes", Dict()), "_ARRAY_DIMENSIONS")