Skip to main content

xcube datastore for accessing datasets of ESA EOPF data products.

Project description

Build Status codecov PyPI Version Anaconda-Server Badge Ruff License

xcube-eopf

xcube-eopf is a Python package and xcube plugin that adds a data store named eopf-zarr to xcube. The data store is used to access ESA EOPF data products as an analysis-ready datacube (ARDC).

Features

IMPORTANT
xcube-eopf is currently under active development.
Some features may be partially implemented or still in progress.

The EOPF xcube data store is designed to provide analysis-ready data cubes from the EOPF Sentinel Zarr samples for Sentinel-1, Sentinel-2, and Sentinel-3 missions. The main features are summarized below. A more in depth documentation is given in the User Guide.

Currently, support is focused on Sentinel-2 products.

Sentinel-1

Support for Sentinel-1 will be added in an upcoming release.

Sentinel-2

The current implementation supports two Sentinel-2 product levels, available as data_id values:

  • sentinel-2-l1c: Level-1C top-of-atmosphere reflectance
  • sentinel-2-l2a: Level-2A atmospherically corrected surface reflectance

Cube Generation Workflow

The workflow for building 3D analysis-ready cubes from Sentinel-2 products involves the following steps:

  1. Query products using the EOPF STAC API for a given time range and spatial extent.
  2. Retrieve observations as cloud-optimized Zarr chunks via the xarray-eopf backend.
  3. Mosaic spatial tiles into single images per timestamp.
  4. Stack the mosaicked scenes along the temporal axis to form a 3D cube.

Supported Variables

  • Surface reflectance bands:
    b01, b02, b03, b04, b05, b06, b07, b08, b8a, b09, b11, b12
  • Classification/Quality layers (L2A only):
    cld, scl, snw

Example: Sentinel-2 L2A

from xcube.core.store import new_data_store

store = new_data_store("eopf-zarr")
ds = store.open_data(
    data_id="sentinel-2-l2a",
    bbox=[9.7, 53.4, 10.3, 53.7],
    time_range=["2025-05-01", "2025-05-07"],
    spatial_res=10 / 111320,  # meters to degrees (approx.)
    crs="EPSG:4326",
    variables=["b02", "b03", "b04", "scl"],
)

Sentinel-3

Support for Sentinel-3 products will be added in an upcoming release.

Usage

The xcube-eopf package can be installed from PyPI (pip install xcube-eopf) or conda-forge (conda install -c conda-forge xcube-eopf). After installation, you are ready to go and use the "eopf-zarr" argument to initiate a xcube EOPF data store.

from xcube.core.store import new_data_store

store = new_data_store("eopf-zarr")
ds = store.open_data(
    data_id="sentinel-2-l2a",
    bbox=[9.7, 53.4, 10.3, 53.7],
    time_range=["2025-05-01", "2025-05-07"],
    spatial_res=10 / 111320,  # meters converted to degrees (approx.)
    crs="EPSG:4326",
    variables=["b02", "b03", "b04", "scl"],
)

Development

Setting up a development environment

The recommended Python distribution for development is miniforge which includes conda, mamba, and their dependencies.

git clone https://github.com/EOPF-Sample-Service/xcube-eopf.git
cd xcube-eopf
mamba env create
mamba activate xcube-eopf
pip install -ve .

Install the library locally and test

mamba activate xcube-eopf
pip install -ve .
pytest

By default, this will run all unit tests. To run integration tests, use:

pytest integration

To run tests and generate a coverage report, use:

pytest --cov xcube_eopf --cov-report html tests

Some notes on the strategy of unit-testing

The unit test suite uses pytest-recording to mock STAC catalogs. During development an actual HTTP request is performed to a STAC catalog and the responses are saved in cassettes/**.yaml files. During testing, only the cassettes/**.yaml files are used without an actual HTTP request. During development, to save the responses to cassettes/**.yaml, run

pytest -v -s --record-mode new_episodes

Note that --record-mode new_episodes overwrites all cassettes. If the user only wants to write cassettes which are not saved already, --record-mode once can be used. pytest-recording supports all records modes given by VCR.py. After recording the cassettes, testing can be performed as usual.

Setting up a documentation environment

mamba activate xcube-eopf
pip install .[doc]

Testing documentation changes

mkdocs serve

Deploying documentation changes

mkdocs gh-deploy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcube_eopf-0.3.1.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcube_eopf-0.3.1-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file xcube_eopf-0.3.1.tar.gz.

File metadata

  • Download URL: xcube_eopf-0.3.1.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xcube_eopf-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e87503792045c33a18d8fc1df95694bbc0eac2c1972fb259f5b07fd5b44a7507
MD5 5f5edbe5085833dd677c164f85865f84
BLAKE2b-256 3c10c3796b31aab0a4d4b1bd09b3a5c5aec179e4abd704089a8fe25d8c6b53b4

See more details on using hashes here.

File details

Details for the file xcube_eopf-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: xcube_eopf-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xcube_eopf-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a39d047a0509fe9e46e5c4be796f4abcff81071077194948efeb22f194512fd3
MD5 e46085742cd234d5f0f758411ad7300a
BLAKE2b-256 b8e2710215829ebe56060d4bd51d39a93dce528036d934eb8ed29fdab3ff9a0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page