Skip to main content

A backend implmentation for xarray that allows for analysis-ready reading of ESA EOPF data products.

Project description

Build Status codecov PyPI Version Anaconda-Server Badge Ruff License

xarray-eopf

An xarray backend implementation for ESA EOPF data products in Zarr format.

Features

After installing this package, user can specify a new xarray backend named "eopf-zarr" to open EOPF sample products. The backend has two modes of operation, default analysis mode and the native mode. Both modes allow

  • to open EOPF sample products from the local filesystem or from their original object storage using URLs with both https or s3 protocols;
  • to open entire products as xarray.DataTree or xarray.Dataset;
  • to open a subgroup as xarray.Dataset. This works with local filesystem or s3-URLs.

The default analysis mode has the aim to represent the EOPF data products in an analysis-ready and convenient way. It provides the following features:

  • Open the deeply nested EOPF products as flat xarray.Dataset objects.
  • All bands and quality images resampled to a single, user provided resolution, hence, spatial dimensions will be just x and y.
  • User-specified resampling by passing interpolation methods for up-scaling and aggregation methods for downscaling.
  • CF-compliant spatial referencing of datasets using a shared grid mapping variable spatial_ref.
  • Attach other CF-compliant metadata enhancements such as flag values and meanings for pixel quality information, such as the Sentinel-2 scene classification (variable scl).

The analysis mode is currently implemented Sentinel-2 products only. Support for Sentinel-1 and Sentinel-3 is coming soon.

The native mode does not modify any contents or data, instead it basically delegates to the built-in "zarr" backend.

More information can be found in the package documentation.

Usage

The xarray-eopf package can be installed from PyPI (pip install xarray-eopf) or conda-forge (conda install -c conda-forge xarray-eopf). Now you can open EOPF sample products using xarray by specifying the "eopf-zarr" backend in your Python code:

import xarray as xr

s2_l2a_url = (
    "https://stac.browser.user.eopf.eodc.eu/collections/sentinel-2-l2a/"
    "items/S2B_MSIL2A_20250821T084559_N0511_R107_T37VDD_20250821T095143"
)
s2_l2a_dataset = xr.open_dataset(s2_l2a_url, engine="eopf-zarr", resolution=10)

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/xarray-eopf.git
cd xarray-eopf
mamba env create
mamba activate eopf-xr
pip install -ve .

Install the library locally and test

mamba activate eopf-xr
pip install -ve .
pytest

By default, this will run all unit tests. To run unit tests and generate a coverage report, use:

pytest --cov xarray_eopf --cov-report html tests

To run the integration tests, use:

pytest integration

Setting up a documentation environment

mamba activate eopf-xr
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

xarray_eopf-0.2.7.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

xarray_eopf-0.2.7-py3-none-any.whl (48.5 kB view details)

Uploaded Python 3

File details

Details for the file xarray_eopf-0.2.7.tar.gz.

File metadata

  • Download URL: xarray_eopf-0.2.7.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for xarray_eopf-0.2.7.tar.gz
Algorithm Hash digest
SHA256 cc035c2138dbb14fec51e87fe6e1be5083e78a410c7ae68ef8ab4195038337fb
MD5 f6dbcc28f6e74c649ce3d003bb0c0141
BLAKE2b-256 4438a0aa9bf4f729ea1ba955753255fd1d1a14dc80f0294d08aed596a2d36ed5

See more details on using hashes here.

File details

Details for the file xarray_eopf-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: xarray_eopf-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 48.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for xarray_eopf-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ee1902f4cd93690a5b8627f64c9bb9e6297d45851052038f69ffb974fddac155
MD5 2c71c9093192543222bcac96b2313720
BLAKE2b-256 112147b80f96bcef58b9607b30c3bfaff5ccde48f90791051a20ecdc3978d048

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