Development Status
- 5 - Production/Stable
Intended Audience
- Science/Research
- Developers
License
- OSI Approved :: Apache Software License
Programming Language
- Python :: 3
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
Topic
- Software Development
- Scientific/Engineering
Typing
- Typed
Operating System
- Microsoft :: Windows
- POSIX
- Unix
- MacOS
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
httpsors3protocols; - to open entire products as
xarray.DataTreeorxarray.Dataset; - to open a subgroup as
xarray.Dataset. This works with local filesystem ors3-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.Datasetobjects. - All bands and quality images resampled to a single, user provided
resolution, hence, spatial dimensions will be just
xandy. - 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