S5p and eo-learn

I want to get time series of data from sentinel hub using eo-learn. I have this piece of python code that works for S2 :

# import
from eolearn.io import S2L1CWCSInput 
from eolearn.io.sentinelhub_service import SentinelHubOGCInput 
from sentinelhub import BBox, CRS, ServiceType
from eolearn.core import EOTask, EOPatch, LinearWorkflow

# define task
input_task = S2L1CWCSInput(layer='1_TRUE_COLOR', resx='20m', resy='20m', maxcc=0.5, instance_id=INSTANCE_ID)
workflow = LinearWorkflow(input_task)

#BBox definition
bbox = BBox(bbox=[-1.8, 44.2, 1.7, 45.9], crs=CRS.WGS84)

# time interval definition
time_interval = ['2016-01-01','2019-3-1']

# execute the workflow
result = workflow.execute({
    input_task: {
        'bbox': bbox,
        'time_interval': time_interval

I have tried to adapt it to S5P but I am failing to get it to work.

The overall code stays the same except the instance ID (another configuration where I have S5p) and the input task:

input_task = SentinelHubOGCInput(layer='CO', service_type = ServiceType.WCS,instance_id=INSTANCE_ID,data_source='Sentinel-5P')

The error I am getting comes from the parameter data_source : AttributeError: ‘str’ object has no attribute ‘value’ in file ‘constant.py’

Has anyone succeeded in making S5P work with eo-learn ?


Can you please try to add the following:

from eolearn.io.sentinelhub_service import SentinelHubWCSInput
from sentinelhub import BBox, CRS, ServiceType, DataSource

# replace SentinelHubOGCInput with SentinelHubWCSInput
input_task = SentinelHubWCSInput(layer='CO',  data_source=DataSource.SENTINEL5P, instance_id=INSTANCE_ID)
1 Like

Thank you for your answer. It solved the first error but got me a new one, apparently S5p_L2.TILE is an invalid typename (FYI : The instance ID points to the the standard S5p configuration):

DownloadFailedException: During execution of task SentinelHubWCSInput: Failed to download from:
with HTTPError:
400 Client Error: Bad Request for url: https://services.sentinel-hub.com/ogc/wfs/myid?SERVICE=wfs&WARNINGS=False&REQUEST=GetFeature&TYPENAMES=S5p_L2.TILE&BBOX=44.2%2C-1.8%2C45.9%2C1.7&OUTPUTFORMAT=application%2Fjson&SRSNAME=EPSG%3A4326&TIME=2019-03-01T00%3A00%3A00%2F2019-03-01T23%3A59%3A59&MAXCC=100.0&MAXFEATURES=100&FEATURE_OFFSET=0
Server response: "TYPENAME=S5p_L2.TILE is invalid!"

Hello Alice,

I got a similar problem when I tried to use Sentinel5P with SentinelHub. If you are using an ID that access EOCLOUD, the DataSource used for S5P is in fact S5p_L2.TILE, but in case you are using CREODIAS or any other, the DataSource is DSS7.

To solve it, I edited the ‘constants.py’ file of SentinelHub, renaming the available DataSource variable for Sentinel5P, like this:

constants.py, line 229 -> cls.SENTINEL5P: ‘S5p_L2.TILE’ ,

constants.py, line 229 ->cls.SENTINEL5P: ‘S5p_L2.TILE’ if is_eocloud else ‘DSS7’,

Hope this helps.

Thank you @ibustamante for following-up.

This is the solution to deal with both services. Data on creodias has been added since we released that version of sentinelhub-py. We will try to support this and harmonise S5P data as soon as possible.

Don’t forget to change the sh_base_url in SHConfig() when using creodias to "https://creodias.sentinel-hub.com", and to use corresponding instance ID and layers.

I think the problem might be that I don’t have EO cloud credential. I thought it was sufficient to do exactly the same as S2.

For CreoDIAS service you do not need any additional credentials. You can simply change the end-point.
EO Cloud is our deprecated system, which is not needed in the case of this dataset.