Skip to content

Commit 4e1a8af

Browse files
committed
Allow to open an array with a path in zarr
1 parent 079e030 commit 4e1a8af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/ZarrExt.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ end
1515
struct ZarrDataset
1616
g::ZGroup
1717
end
18-
function ZarrDataset(g::String; mode="r")
18+
function ZarrDataset(g::String; mode="r", path="", kwargs...)
1919
store = if endswith(g, "zip")
2020
ZipStore(ZipReader(SimpleFileDiskArray(g)))
2121
else
2222
g
2323
end
24-
ZarrDataset(zopen(store, mode, fill_as_missing=false))
24+
ZarrDataset(zopen(store, mode, fill_as_missing=false, path=path))
2525
end
2626

2727
YAB.get_var_dims(ds::ZarrDataset, name) = reverse(ds[name].attrs["_ARRAY_DIMENSIONS"])
@@ -70,7 +70,7 @@ YAB.create_empty(::Type{ZarrDataset}, path, gatts=Dict()) = ZarrDataset(zgroup(p
7070

7171
YAB.allow_parallel_write(::ZarrDataset) = true
7272
YAB.allow_missings(::ZarrDataset) = false
73-
YAB.to_dataset(g::ZGroup; kwargs...) = ZarrDataset(g)
73+
YAB.to_dataset(g::ZGroup; kwargs...) = ZarrDataset(g; kwargs...)
7474
YAB.iscompressed(a::ZArray{<:Any,<:Any,<:Compressor}) = true
7575

7676

src/datasets/datasetinterface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function backendfrompath(g::String; driver = :all)
9595
end
9696
end
9797

98-
to_dataset(g::String; driver=:all, kwargs...) = to_dataset(backendfrompath(g;driver),g,kwargs...)
98+
to_dataset(g::String; driver=:all, kwargs...) = to_dataset(backendfrompath(g; driver), g; kwargs...)
9999

100100
to_dataset(g; kwargs...) = g
101101
to_dataset(T::Type{<:Any}, g::String;kwargs...) = T(g;kwargs...)

0 commit comments

Comments
 (0)