Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

earth and related environmental sciences

Working with Sentinel-2 in Julia SentinelDataSource.jl package

Direct access to analysis-ready data cubes

Max Planck Institute for Biogeochemistry
ESA EOPF Zarr Logo

πŸš€ Launch in JupyterHub

Run this notebook interactively with all dependencies pre-installed

IntroductionΒΆ

SentinelDataSource.jl is a Julia package that extends DimensionalData to load EOPF Zarr data. This backend enables seamless access to ESA EOPF data products stored in the Zarr format, presenting them as analysis-ready data structures.

This notebook demonstrates how to use the SentinelDataSource package to explore and analyze EOPF Zarr datasets. It highlights the key features currently supported.


Install the SentinelDataSource packageΒΆ

The SentinelDataSource package can be installed as any Julia package via the internal package manager.

] add https://github.com/JuliaGeo/SentinelDataSource.jl.git

Import PackageΒΆ

The SentinelDataSource package is the library to open EOPF datasets. This is integrated into the DimensionalData ecosystem and the JuliaGeo ecosystem.

using SentinelDataSource
using YAXArrays

Main Features of the SentinelDataSource packageΒΆ

The SentinelDataSource package will at the moment open the EOPF datasets in Native Mode and will return a DimTree of the data.


Open the Product in Native ModeΒΆ

Sentinel-2 Level-2AΒΆ

We begin with a simple example by accessing a Sentinel-2 L2A product in native mode. To obtain the product URL, you can use the STAC Browser to locate a tile and retrieve the URL from the β€œEOPF Product” asset.

path = joinpath(
    "https://objects.eodc.eu/e05ab01a9d56408d82ac32d69a5aae2a:notebook-data/tutorial_data/",
    "cpm_v262/S2A_MSIL2A_20200707T101031_N0500_R022_T32TPS_20230614T182201.zarr"
)
"https://objects.eodc.eu/e05ab01a9d56408d82ac32d69a5aae2a:notebook-data/tutorial_data/cpm_v262/S2A_MSIL2A_20200707T101031_N0500_R022_T32TPS_20230614T182201.zarr"

We can use SentinelDataSource.open_datatree to open the EOPF Zarr product as an DimensionalData.DimTree.

dt = SentinelDataSource.open_tree(path)
β”Œ DimTree ┐ β”œ branches ─ :measurements └─ :reflectance β”œβ”€ :r20m dims: X, Y size: 5490Γ—5490 layers: :b12, :b11, :b07, :b04, :b01, :b02, :b03, :b8a, :b06, :b05 β”œβ”€ :r60m dims: X, Y size: 1830Γ—1830 layers: :b12, :b11, :b07, :b09, :b04, :b01, :b02, :b03, :b06, :b8a, :b05 └─ :r10m dims: X, Y size: 10980Γ—10980 layers: :b02, :b03, :b08, :b04 :conditions β”œβ”€ :mask β”‚ β”œβ”€ :detector_footprint β”‚ β”‚ β”œβ”€ :r20m dims: X, Y size: 5490Γ—5490 layers: :b8a, :b06, :b12, :b11, :b07, :b05 β”‚ β”‚ β”œβ”€ :r60m dims: X, Y size: 1830Γ—1830 layers: :b10, :b01, :b09 β”‚ β”‚ └─ :r10m dims: X, Y size: 10980Γ—10980 layers: :b02, :b03, :b08, :b04 β”‚ β”œβ”€ :l1c_classification β”‚ β”‚ └─ :r60m dims: X, Y size: 1830Γ—1830 layers: :b00 β”‚ └─ :l2a_classification β”‚ β”œβ”€ :r20m dims: X, Y size: 5490Γ—5490 layers: :scl β”‚ └─ :r60m dims: X, Y size: 1830Γ—1830 layers: :scl β”œβ”€ :geometry dims: X, Y, angle, Band, detector size: 23Γ—23Γ—2Γ—13Γ—6 layers: :sun_angles, :mean_sun_angles, :mean_viewing_incidence_angles, :viewing_incidence_angles └─ :meteorology β”œβ”€ :cams dims: X, Y size: 9Γ—9 layers: :aod865, :aod670, :aod550, :aod1240, :omaod550, :z, :aod469, :ssaod550, :suaod550, :duaod550, :bcaod550 └─ :ecmwf dims: X, Y size: 9Γ—9 layers: :u10, :msl, :tco3, :r, :tcwv, :v10 :quality β”œβ”€ :atmosphere β”‚ β”œβ”€ :r20m dims: X, Y size: 5490Γ—5490 layers: :aot, :wvp β”‚ β”œβ”€ :r60m dims: X, Y size: 1830Γ—1830 layers: :aot, :wvp β”‚ └─ :r10m dims: X, Y size: 10980Γ—10980 layers: :aot, :wvp β”œβ”€ :mask β”‚ β”œβ”€ :r20m dims: X, Y size: 5490Γ—5490 layers: :b8a, :b06, :b12, :b11, :b07, :b05 β”‚ β”œβ”€ :r60m dims: X, Y size: 1830Γ—1830 layers: :b10, :b01, :b09 β”‚ └─ :r10m dims: X, Y size: 10980Γ—10980 layers: :b02, :b03, :b08, :b04 └─ :probability └─ :r20m dims: X, Y size: 5490Γ—5490 layers: :cld, :snw β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

As an example, we plot the 60 meters red band to view the image.

using CairoMakie
data = dt.measurements.reflectance.r60m[:b04]
fig, ax, h = image(data)
Loading...

ConclusionΒΆ

This notebook presents the current development state of the SentinelDataSource.jl package, which enables seamless access to EOPF Zarr products in the familiar DimensionalData ecosystem. The key takeaways are summarized below:

  • EOPF products are opened without modification using DimensionalData DimTree and structures.

  • These DimTree objects can be queried with the selectors as other DimensionalData objects.

Future Development StepsΒΆ