1
1
2
- Base. getindex (v:: ZarrVariable ,ij:: Union{Integer,Colon,AbstractVector{<:Integer}} ...) = v. zarray[ij... ]
3
- CDM. load! (v:: ZarrVariable ,buffer,ij... ) = buffer .= view (v. zarray,ij... )
4
-
2
+ Base. getindex (v:: ZarrVariable ,ij:: Union{Integer,Colon,AbstractVector{<:Integer}} ...) = parent (v)[ij... ]
5
3
function Base. setindex! (v:: ZarrVariable ,data,ij:: Union{Integer,Colon,AbstractVector{<:Integer}} ...)
6
- v . zarray [ij... ] = data
4
+ parent (v) [ij... ] = data
7
5
end
8
- Base. size (v:: ZarrVariable ) = size (v. zarray)
9
- CDM. name (v:: ZarrVariable ) = Zarr. zname (v. zarray)
10
- CDM. dimnames (v:: ZarrVariable ) = Tuple (reverse (v. zarray. attrs[" _ARRAY_DIMENSIONS" ]))
6
+ Base. size (v:: ZarrVariable ) = size (parent (v))
7
+ Base. parent (v:: ZarrVariable ) = v. zarray
8
+
9
+
10
+ CDM. load! (v:: ZarrVariable ,buffer,ij... ) = buffer .= view (parent (v),ij... )
11
+ CDM. name (v:: ZarrVariable ) = Zarr. zname (parent (v))
12
+ CDM. dimnames (v:: ZarrVariable ) = Tuple (reverse (parent (v). attrs[" _ARRAY_DIMENSIONS" ]))
11
13
CDM. dataset (v:: ZarrVariable ) = v. parentdataset
12
14
13
15
function _iscoordvar (v)
@@ -19,36 +21,36 @@ function _iscoordvar(v)
19
21
end
20
22
21
23
function CDM. attribnames (v:: ZarrVariable )
22
- names = filter (!= (" _ARRAY_DIMENSIONS" ),keys (v . zarray . attrs))
23
- if ! isnothing (v . zarray . metadata. fill_value) && ! _iscoordvar (v)
24
+ names = filter (!= (" _ARRAY_DIMENSIONS" ),keys (parent (v) . attrs))
25
+ if ! isnothing (parent (v) . metadata. fill_value) && ! _iscoordvar (v)
24
26
push! (names," _FillValue" )
25
27
end
26
28
return names
27
29
end
28
30
29
31
function CDM. attrib (v:: ZarrVariable{T} ,name:: SymbolOrString ) where T
30
- if String (name) == " _FillValue" && ! isnothing (v . zarray . metadata. fill_value)
31
- return T (v . zarray . metadata. fill_value)
32
+ if String (name) == " _FillValue" && ! isnothing (parent (v) . metadata. fill_value)
33
+ return T (parent (v) . metadata. fill_value)
32
34
end
33
- return v . zarray . attrs[String (name)]
35
+ return parent (v) . attrs[String (name)]
34
36
end
35
37
36
38
function CDM. defAttrib (v:: ZarrVariable ,name:: SymbolOrString ,value)
37
39
@assert iswritable (dataset (v))
38
40
@assert String (name) != = " _FillValue"
39
41
40
- v . zarray . attrs[String (name)] = value
42
+ parent (v) . attrs[String (name)] = value
41
43
42
- storage = v . zarray . storage
44
+ storage = parent (v) . storage
43
45
io = IOBuffer ()
44
- JSON. print (io, v . zarray . attrs)
45
- storage[v . zarray . path," .zattrs" ] = take! (io)
46
+ JSON. print (io, parent (v) . attrs)
47
+ storage[parent (v) . path," .zattrs" ] = take! (io)
46
48
end
47
49
48
50
49
51
# DiskArray methods
50
- eachchunk (v:: ZarrVariable ) = eachchunk (v . zarray )
51
- haschunks (v:: ZarrVariable ) = haschunks (v . zarray )
52
+ eachchunk (v:: ZarrVariable ) = eachchunk (parent (v) )
53
+ haschunks (v:: ZarrVariable ) = haschunks (parent (v) )
52
54
eachchunk (v:: CFVariable{T,N,<:ZarrVariable} ) where {T,N} = eachchunk (v. var)
53
55
haschunks (v:: CFVariable{T,N,<:ZarrVariable} ) where {T,N} = haschunks (v. var)
54
56
0 commit comments