Skip to content

Commit 44f850f

Browse files
committed
Add leaves with setindex
1 parent 070d5e7 commit 44f850f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/SentinelDataSource.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using DimensionalData: DimTree
33
using Zarr: zopen
44
using ZarrDatasets: ZarrDataset
55
using CommonDataModel: CommonDataModel as CDM
6+
using Rasters:Raster
67

78
function open_eopf(path)
89
zd = ZarrDataset(path)
@@ -17,22 +18,24 @@ function open_tree(dataset)
1718
alldimnames = nesteddimnames(dataset)
1819
for v in setdiff(varnames, alldimnames)
1920
@show v
20-
setproperty!(stem, Symbol(v), Raster(CDM.variable(dataset, v), lazy=true))
21+
setindex!(stem, Raster(CDM.variable(dataset, v), lazy=true),Symbol(v))
2122
end
2223
for g in groupnames
23-
setproperty!(stem, Symbol(g), open_tree(CDM.group(dataset, g)))
24+
setindex!(stem, open_tree(CDM.group(dataset, g)),Symbol(g))
2425
end
2526
stem
2627
end
2728
#zopen()
2829
# Write your package code here.
2930

30-
end
31+
3132

3233
function nesteddimnames(zarrdataset)
3334
alldims = []
3435
for v in CDM.varnames(zarrdataset)
3536
append!(alldims, CDM.dimnames(CDM.variable(zarrdataset, v)))
3637
end
3738
unique(alldims)
39+
end
40+
3841
end

test/runtests.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ using SentinelDataSource
22
using Test
33
using Aqua
44
using Zarr
5+
using ZarrDatasets
56

67
@testset "SentinelDataSource.jl" begin
78
@testset "Code quality (Aqua.jl)" begin
@@ -11,8 +12,8 @@ using Zarr
1112

1213
@testset "S1 L1 GRD" begin
1314
s1grdpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S1A_IW_GRDH_1SDV_20240201T164915_20240201T164940_052368_065517_750E.zarr"
14-
s1grd = zopen(s1grdpath)
15-
@test s1grd isa ZGroup
15+
s1grd = ZarrDataset(s1grdpath)
16+
s1grdtree = SentinelDataSource.open_tree(s1grd)
1617
end
1718
@testset "S1 L1 SLC" begin
1819
s1slcpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S1A_IW_SLC__1SDV_20231119T170635_20231119T170702_051289_063021_178F.zarr"

0 commit comments

Comments
 (0)