Skip to content

Guided usage exercise

Stefaan Lippens edited this page Oct 16, 2020 · 6 revisions

Step 1: Setup your environment

This exercise will use a Jupyter notebook, but it's also possible to copy paste the code into a regular script.

Managed Jupyter notebook environments can also be used (e.g. https://notebooks.terrascope.be), this may require you to register for an account.

You just need a Python environment (3.6 or higher) and the ability to install packages.

Install the openEO Python client package in your environment, e.g. with:

pip install openeo

You should now be able to import it in your notebook or script as follows:

import openeo

Step 2: Get the notebook

Download the data_fusion.ipynb notebook hosted at

https://github.com/Open-EO/openeo-usecases/blob/master/vito_phenology_usecase/notebook/data_fusion.ipynb

e.g. open this "raw" link in your browser and user "Save As" to download it.

This notebook uses the VITO openEO backend at https://openeo.vito.be/openeo/ Other openEO backends may work, but keep in mind that names of data collections and supported processes will need to be adjusted!

Find your preferred backend at: https://hub.openeo.org/

Step 3: Connect and authenticate

Information about demo credentials will be provided in the session. Future warning: backends will allow you to log in with your institution (edugain) or social accounts. This will make demo credentials invalid. Always avoid sharing your credentials with others!

Try to run the initial connection steps in the notebook or your IDE.

Step 4: Try to download a very simple example

Learning goal: learn how to work in an interactive manner, and debug your code.

The notebook constructs a complex workflow, but when developing and debugging, you often want to check intermediate results. Please try this.

Tip: this notebook works on Terrascope data. You can explore the Sentinel-2 layer here: https://viewer.terrascope.be/?language=en&bbox=2.798217823728918,50.43992723836223,6.313842823728918,51.59490312270836&overlay=true&bgLayer=Satellite&date=2018-05-06&layer=CGS_S2_RADIOMETRY

4.1 Download image

Download a small area of the NDVI datacube (S2ndvi). Tip: 2018-05-06 has nice cloud free data!

You will have to choose a format:

  • GTiff (GeoTiff) is suitable for single dates, but does not support timeseries very well. (It will return data for some date.)
  • NetCDF does support full timeseries, but the format is somewhat more complex.

API docs: https://open-eo.github.io/openeo-python-client/basics.html#example-simple-band-math

4.2 Download timeseries

Downloading an aggregated timeseries for an area of interest is another great way to explore a dataset:

https://open-eo.github.io/openeo-python-client/basics.html#example-retrieving-aggregated-timeseries

It can give you a sense of how much data is available, and how the signal behaves for your area of interest.

Warning When debugging, it is recommmended to always work on smaller areas, also the time range can be limited. This improves interactivity, and avoids a network timeout when connecting with the backend.

When you do experience timeouts, and tuning parameters does not work, have a look at using batch jobs: https://open-eo.github.io/openeo-python-client/basics.html#managing-jobs-in-openeo

Note that the performance of requests can depend on the backend!

Step 5: Examine UDF's

At this point, you know how to use so called 'predefined' functions, and are able to download and inspect intermediate results. The next level of usage is mastering user defined functions: https://open-eo.github.io/openeo-python-client/udf.html

This example uses two UDF's: one that users Tensorflow, the other one applies Szavitky Golay smoothing. Try to understand how this works, or adjust them if you feel like a challenge!

Step 6: Play around

If you've gotten here, you've already mastered the most important openEO concepts, so play around, read the docs, and see where it gets you.