How to get Landsat-8 Level-2 in EOLearn

I would like to know hot to get Landsat-8 Level-2 data in EO-Learn.
Whe I try to download it, it returns broken data, mostly 0’s.

What I am doing right now:

DataCollection.define_from(
            DataCollection.LANDSAT8,
            "LOTL2",
            service_url="https://services-uswest2.sentinel-hub.com",
            wfs_id="DSS13",  # https://www.sentinel-hub.com/develop/api/ogc/standard-parameters/wfs/
            api_id="LOTL2",
            catalog_id="landsat-8-l1c", 
            processing_level="L2",
            bands=("B01", "B02", "B03", "B04", "B05", "B06", "B07", "B10"),
        )

inputTask = SentinelHubInputTask(data_collection=DataCollection.LOTL2,
                                  bands_feature=(FeatureType.DATA, "BANDS"),
                                  bands=["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B10"],
                                  maxcc=0.4,
                                  time_difference=datetime.timedelta(hours=2),
                                  config=config,
                                  resolution=10,
                                )

eopatch = inputTask.execute(eopatch=eopatch,
                  bbox=bbox,
                  time_interval=time_interval)

The eopatch returned is mostly full of 0’s.

The RGB channels look like this:
Unknown

If I define de DataCollection for Landsat-8 L1 like this it works fine:

DataCollection.define_from(
            DataCollection.LANDSAT8,
            "LOTL1",
            service_url="https://services-uswest2.sentinel-hub.com",
            wfs_id="DSS12",  # https://www.sentinel-hub.com/develop/api/ogc/standard-parameters/wfs/
            api_id="LOTL1",
            catalog_id="landsat-8-l1c",
            processing_level="L1C",
            bands=("B01", "B02", "B03", "B04", "B05", "B06", "B07", "B10"),
        )

And the RGB bands look as excpected (every band looks okay).

BBox(((-61.2310704366043, -35.1691415369006), (-61.2112672803696, -35.1528325736498)), crs=CRS(‘4326’))
TimeStamp: datetime.datetime(2020, 3, 20, 13, 56, 48, 275000)

Any help would be very helpful!

P.S: When I try the DataCollection definition with a WCS Request from the Sentinelhub Python library directly it works fine

wcs_true_color_request = WcsRequest(
    data_collection=DataCollection.LOTL2,
    layer='RGB-L8-LOTL2',
    bbox=bbox,
    time=('2020-03-01', '2020-03-31'),
    resx='10m',
    resy='10m',
    maxcc=0.01,
    time_difference=datetime.timedelta(hours=2),
    config=config
)

Hi @Uriel,

Your code is completely correct. The problem is that SentinelHubInputTask in the background creates an evalscript with an output sample type SampleType.UINT16 and for some reason, this sample type doesn’t work correctly for LOTL2 collection. I will check with Sentinel Hub service developers if this is a bug.

In the meantime, you can use an alternative to SentinelHubInputTask. In the latest eo-learn 0.9.0 we added SentinelHubEvalscriptTask which is a more general and less strict version of SentinelHubInputTask. It requires a user-defined evalscript and is not optimized to save processing units by requesting digital numbers and rescaling them on the client-side.

Here is how to initialize it for your example:

from eolearn.io import SentinelHubEvalscriptTask

evalscript = """
//VERSION=3

function setup() {
    return {
        input: [{
            bands: ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B10", "dataMask"]
        }],
        output: [
            { id:"BANDS", bands:8, sampleType: SampleType.FLOAT32 },
            { id:"IS_DATA", bands:1, sampleType: SampleType.UINT8 }
        ]
    }
}

function evaluatePixel(sample) {
    return {
        BANDS: [sample.B01, sample.B02, sample.B03, sample.B04, sample.B05, sample.B06, sample.B07, sample.B10],
        IS_DATA: [sample.dataMask]
    };
}
"""

input_task = SentinelHubEvalscriptTask(
    features=[(FeatureType.DATA, 'BANDS'), (FeatureType.MASK, 'IS_DATA')],
    evalscript=evalscript,
    data_collection=DataCollection.LOTL2,
    resolution=resolution,
    maxcc=0.4,
    time_difference=datetime.timedelta(hours=2),
    config=config
)
1 Like