From b54b88401b790b8ed6617d9625c6e7a17b271983 Mon Sep 17 00:00:00 2001 From: Felix Cremer Date: Wed, 6 Aug 2025 12:42:40 +0200 Subject: [PATCH 1/3] Add tests that check that open_tree returns a DimTree --- Project.toml | 2 ++ src/SentinelDataSource.jl | 2 ++ test/Project.toml | 1 + test/runtests.jl | 26 +++++++++++++------------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Project.toml b/Project.toml index 1438780..da1f611 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Felix Cremer and contributors"] version = "0.1.0-DEV" [deps] +CFTime = "179af706-886a-5703-950a-314cd64e0468" CommonDataModel = "1fbeeb36-5f17-413c-809b-666fb144f157" DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0" DiskArrayTools = "fcd2136c-9f69-4db6-97e5-f31981721d63" @@ -15,6 +16,7 @@ Zarr = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99" ZarrDatasets = "519a4cdf-1362-424a-9ea1-b1d782dbb24b" [compat] +CFTime = "0.2.1" CommonDataModel = "0.3.8" DimensionalData = "0.29.12" DiskArrayTools = "0.1.12" diff --git a/src/SentinelDataSource.jl b/src/SentinelDataSource.jl index a9f9549..34618e2 100644 --- a/src/SentinelDataSource.jl +++ b/src/SentinelDataSource.jl @@ -5,6 +5,8 @@ using ZarrDatasets: ZarrDataset using CommonDataModel: CommonDataModel as CDM using Rasters:Raster +export open_tree + open_tree(path::AbstractString) = open_tree(ZarrDataset(path)) function open_tree(dataset::ZarrDataset) diff --git a/test/Project.toml b/test/Project.toml index 18aa358..0c5ff45 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zarr = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99" diff --git a/test/runtests.jl b/test/runtests.jl index 81c609f..4bf6133 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,7 @@ using SentinelDataSource using Test using Aqua using Zarr -using ZarrDatasets +using DimensionalData @testset "SentinelDataSource.jl" begin @testset "Code quality (Aqua.jl)" begin @@ -12,33 +12,33 @@ using ZarrDatasets @testset "S1 L1 GRD" begin s1grdpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S1A_IW_GRDH_1SDV_20240201T164915_20240201T164940_052368_065517_750E.zarr" - s1grd = ZarrDataset(s1grdpath) - s1grdtree = SentinelDataSource.open_tree(s1grd) + s1grdtree = open_tree(s1grdpath) + @test s1grdtree isa DimTree end @testset "S1 L1 SLC" begin s1slcpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S1A_IW_SLC__1SDV_20231119T170635_20231119T170702_051289_063021_178F.zarr" - s1slc = zopen(s1slcpath) - @test s1slc isa ZGroup + s1slc = open_tree(s1slcpath) + @test s1slc isa DimTree end @testset "S1 L1 NRB" begin s1nrbpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S1A_IW_SLC__1SDV_20240106T170607_20240106T170635_051989_064848_04A6.zarr" - s1nrb = zopen(s1nrbpath) - @test s1nrb isa ZGroup + s1nrb = open_tree(s1nrbpath) + @test s1nrb isa DimTree end @testset "S1 L2 OCN" begin s1ocnpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S1A_IW_OCN__2SDV_20250224T054940_20250224T055005_058034_072A26_160E.zarr" - s1ocn = zopen(s1ocnpath) - @test s1ocn isa ZGroup + s1ocn = open_tree(s1ocnpath) + @test s1ocn isa DimTree end @testset "S2 L1C MSI" begin s2l1cpath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S2B_MSIL1C_20250113T103309_N0511_R108_T32TLQ_20250113T122458.zarr" - s2l1c = zopen(s2l1cpath) - @test s2l1c isa ZGroup + s2l1c = open_tree(s2l1cpath) + @test s2l1c isa DimTree end @testset "S2 L2A MSI" begin s2l2apath = "https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S2A_MSIL2A_20240101T102431_N0510_R065_T32TNT_20240101T144052.zarr" - s2l2a = zopen(s2l2apath) - @test s2l2a isa ZGroup + s2l2a = open_tree(s2l2apath) + @test s2l2a isa DimTree end end From fa6b7adb54afb8a87405935e1dfe0a64b3f7d941 Mon Sep 17 00:00:00 2001 From: Felix Cremer Date: Mon, 15 Sep 2025 21:16:54 +0200 Subject: [PATCH 2/3] remove restriction on ZarrDatasets --- Project.toml | 6 ++---- src/SentinelDataSource.jl | 10 ++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index da1f611..9aa778f 100644 --- a/Project.toml +++ b/Project.toml @@ -7,7 +7,6 @@ version = "0.1.0-DEV" CFTime = "179af706-886a-5703-950a-314cd64e0468" CommonDataModel = "1fbeeb36-5f17-413c-809b-666fb144f157" DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0" -DiskArrayTools = "fcd2136c-9f69-4db6-97e5-f31981721d63" DiskArrays = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3" Rasters = "a3a2b9e3-a471-40c9-b274-f788e487c689" YAXArrayBase = "90b8fcef-0c2d-428d-9c56-5f86629e9d14" @@ -17,13 +16,12 @@ ZarrDatasets = "519a4cdf-1362-424a-9ea1-b1d782dbb24b" [compat] CFTime = "0.2.1" -CommonDataModel = "0.3.8" +CommonDataModel = "0.3.8, 0.4" DimensionalData = "0.29.12" -DiskArrayTools = "0.1.12" DiskArrays = "0.4.11" Rasters = "0.14.4" YAXArrayBase = "0.7.5" YAXArrays = "0.6.1" Zarr = "0.9.4" ZarrDatasets = "0.1.3" -julia = "1.6.7" +julia = "1.6.7" \ No newline at end of file diff --git a/src/SentinelDataSource.jl b/src/SentinelDataSource.jl index 34618e2..559399e 100644 --- a/src/SentinelDataSource.jl +++ b/src/SentinelDataSource.jl @@ -7,18 +7,20 @@ using Rasters:Raster export open_tree -open_tree(path::AbstractString) = open_tree(ZarrDataset(path)) +open_tree(path::AbstractString;kwargs...) = open_tree(ZarrDataset(path);kwargs...) -function open_tree(dataset::ZarrDataset) +function open_tree(dataset; prefer_datetime=true) stem = DimTree() groupnames = CDM.groupnames(dataset) varnames = CDM.varnames(dataset) alldimnames = nesteddimnames(dataset) + @show varnames for v in setdiff(varnames, alldimnames) - setindex!(stem, Raster(CDM.variable(dataset, v), lazy=true),Symbol(v)) + r = Raster(CDM.variable(dataset, v); lazy=true, prefer_datetime) + setindex!(stem, r,Symbol(v)) end for g in groupnames - setindex!(stem, open_tree(CDM.group(dataset, g)),Symbol(g)) + setindex!(stem, open_tree(CDM.group(dataset, g);prefer_datetime),Symbol(g)) end stem end From d753b5336dc91acb1ef81ec8fca57133ae6f6c95 Mon Sep 17 00:00:00 2001 From: Felix Cremer Date: Tue, 30 Sep 2025 14:07:55 +0300 Subject: [PATCH 3/3] Add introduction.qmd --- docs/introduction.qmd | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docs/introduction.qmd diff --git a/docs/introduction.qmd b/docs/introduction.qmd new file mode 100644 index 0000000..3c46f3e --- /dev/null +++ b/docs/introduction.qmd @@ -0,0 +1,57 @@ +# Introduction to the SentinelDataSource julia package + +A user friendly way to open the EOPF Zarr products in Julia. + + +## Introduction + +SentinelDataSource is a julia package that extends the DimensionalData.jl ecosystem to enable seamless access to ESA EOPF data products stored in the Zarr format. +This notebook demonstrates how to use SentinelDataSource.jl to explore and analyse EOPF Zarr datasets. +It highlights the key features currently supported. + +## Install SentinelDataSource.jl + +To install the SentinelDataSource.jl package use the julia package manager. + +In the julia REPL first press `]` to enter the pkg mode and then do + +``` +add SentinelDataSource +``` + +This will install SentinelDataSource into your current environment. + +## Import Modules + +```{julia} +using Pkg +Pkg.activate(".") +Pkg.instantiate() +``` + +```{julia} +using SentinelDataSource: SentinelDataSource as SDS +using ZarrDatasets +``` + + +# Open the product in Native Mode + +## Sentinel-2 Level-2A + +```{julia} +path ="https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:202505-s02msil2a/18/products/cpm_v256/S2B_MSIL2A_20250518T112119_N0511_R037_T29RLL_20250518T140519.zarr" +``` + +```{julia} +dt = SDS.open_tree(path) +``` + +```{julia} +dt.quality.l2a_quicklook.r60m[:tci] +``` + +```{julia} +using GLMakie +plot() +``` \ No newline at end of file