Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Zarr = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99"

[compat]
CommonDataModel = "0.3.5"
CommonDataModel = "0.4"
DataStructures = "0.17, 0.18, 0.19"
DiskArrays = "0.3.22, 0.4"
DiskArrays = "0.4"
JSON = "0.21"
Zarr = "0.9.2"
julia = "1.6"
10 changes: 8 additions & 2 deletions src/ZarrDatasets.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module ZarrDatasets

import Base: checkbounds, getindex, setindex!, size
import Base:
checkbounds,
size

import CommonDataModel:
CFVariable,
Expand All @@ -22,7 +24,11 @@ import CommonDataModel:
parentdataset,
variable

import DiskArrays: eachchunk, haschunks
import DiskArrays:
eachchunk,
haschunks,
readblock!,
writeblock!

import CommonDataModel as CDM
using JSON: JSON
Expand Down
21 changes: 13 additions & 8 deletions src/variable.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Base interface methods

function Base.getindex(
v::ZarrVariable, ij::Union{Integer,Colon,AbstractVector{<:Integer}}...
)
parent(v)[ij...]
function readblock!(v::ZarrVariable{T, N},
aout,
indexes::Vararg{OrdinalRange, N}) where {T, N}

return readblock!(parent(v), aout, indexes...)
end
function Base.setindex!(
v::ZarrVariable, data, ij::Union{Integer,Colon,AbstractVector{<:Integer}}...
)
parent(v)[ij...] = data


function writeblock!(v::ZarrVariable{T,N},
data,
indexes::Vararg{OrdinalRange, N}) where {T, N}

return writeblock!(parent(v), data, indexes...)
end

Comment thread
rafaqz marked this conversation as resolved.
Base.size(v::ZarrVariable) = size(parent(v))
Base.parent(v::ZarrVariable) = v.zarray

Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Zarr = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99"

[compat]
Aqua = "0.8"
CommonDataModel = "0.3.6"
CommonDataModel = "0.4"
NCDatasets = "0.14"
julia = "1"
Zarr = "0.9.2"
Loading