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

EOPF Zarr Data Access with openEO and STAC

Learn how to use the EOPF Zarr data through STAC and openEO

Authors
Affiliations
German Aerospace Center
Eurac Research
ESA EOPF Zarr Logo

🚀 Launch in JupyterHub

Run this notebook interactively with all dependencies pre-installed

Introduction

This is a practical introduction to showcasing the interoperability of EOPF Zarr with openEO by accessing and processing EOPF Zarr products via STAC and the openEO API. OpenEO is a unified interface that makes earth observation workflows more standardised, portable, and reproducible.

Setup

Start importing the necessary libraries

pip install openeo-processes-dask[implementations]
pip install openeo-pg-parser-networkx
Did not load machine learning processes due to missing dependencies: Install them like this: `pip install openeo-processes-dask[implementations, ml]`

Connect to openEO

Connect to an openEO backend.

More information on openEO and how to use openEO with some tutorials.

Load a virtual data cube

First, we’ll define the extents in time and space we are interested in

Define the URL to the STAC resource you want to query. And the band names - they are often specific to the STAC Catalogs used.

Reproject the bbox to the native crs of the STAC items, so that xcube-eopf(which is used under the hood in load_stac()) does not trigger reprojection internally. See detailed behavior here.

Create a virtual data cube via the funtion load_stac() according to the chosen extents. This also includes the search on the STAC API. Data is not loaded into the working environment here.

Inspect the load_stac() process visually.

Loading...

Create a processing workflow

Apply processing. We’re calculating the NDVI. And getting a monthly mean.

Inspect the worflow visually.

Loading...

Finalize the workflow via .execute() for the locally executed openEO version or .download() when connected to an openeo backend. The data is not loaded into the working environment now!

Note: Currently we are using the local processing version of openEO. It is not sending any requests to an actual backend. It is converting the openEO process graph to an executable Python code. It’s interacting only with the STAC API and the data buckets.

Note: .execute() also redoes the STAC API search currently.

True

But we can inspect the dimensionality of the virtual cube.

Loading...

Process and load the data into the working environment.

False
Loading...

Plot the map.

<Figure size 640x480 with 2 Axes>

Compare to other sources

We’ll reuse the process graph we have created and only change the URL to the STAC API to use other sources of input. This is a good example of portability and reproducibility.

MS Planetary Computer

MS Planetary Computer is a stable source of satellite data made available via a STAC API. The Sentinel-2 L2A data has been transformed to Cloud Optimized GeoTiffs (COG) in this collection.

Finalize the reused workflow via .execute(). The data is not loaded into the working environment yet.

True

But we can inspect the dimensionality of the virtual cube already. The spatial extents are slightly different than what we have received from the EOPF STAC API. This is probably due to the internal reprojection of the bbox. The data is not loaded into the working environment yet.

Loading...

Now we are processing and loading the data into the working enviornment.

Loading...
<Figure size 640x480 with 2 Axes>

Let’s check the differences of the two results. Note: Differences occur mainly due to the older processing version (2.11) of Sentinel-2 used on MS Planetary Computer.

count 55426.000000 mean 0.055157 std 0.025907 min -0.036408 25% 0.037149 50% 0.054587 75% 0.071017 max 0.172499 dtype: float64

CDSE - via openEO

Connect to openEO on CDSE. This also authorizes us to request data from the CDSE STAC API.

Loading...
Loading...
Authenticated using device code flow.

Since we’re connected to the CDSE openEO backend we need to download the result (only JSON can be received via .exectue()). This triggers the processing on the openEO backend as a synchronous call. To register a batch job on the backend and execute it asynchronously use .execute_batch()

And load it into the working environment.

Here we get the same extents as from EOPF. By loading via rioxarray the ndvi values are encoded into a band dimension.

Loading...
<Figure size 640x480 with 2 Axes>

Let’s check the differences. Very marginal, likely due to different software used in the different openEO implementations used.

count 55426.000000 mean 0.078158 std 0.023538 min -0.006268 25% 0.062287 50% 0.077005 75% 0.092643 max 0.174986 dtype: float64

Takeaway

This tutorial has shown how to:

  • Access EOPF Zarr Data via STAC and openEO

  • Apply reusable processing workflows via openEO

  • Compared the EOPF Zarr Data to other available Sentinel-2 sources