Open-EO / openeo-geotrellis-extensions

Java/Scala extensions for Geotrellis, for use with OpenEO GeoPySpark backend.
Apache License 2.0
5 stars 3 forks source link

apply Sentinel-2 scale + offset for new products #144

Closed jdries closed 1 year ago

jdries commented 1 year ago

Sentinel-2 L2A products processed with latest version have a scale and offset that needs to be applied, otherwise users will get unexpected results.

Please note that starting with 25th January 2022 (PB 04.00), to allow encoding negative surface reflectances that may occur over very dark surfaces, the dynamic range of Level-2A products is shifted by a band-dependent constant BOA_ADD_OFFSET. The value of this offset is available in the product metadata.

The default offset seems to be -1000 for all bands, but need to check product baseline.

EmileSonneveld commented 1 year ago

@jdries Where should the scaling happen? I checked behind connection.load_collection("SENTINEL2_L2A", ... that in it's turn loaded this URL, but there is no BOA_ADD_OFFSET here.

jdries commented 1 year ago

no, because that loads from terrascope, which has the offset already applied. The problem only occurs on creodias/CDSE. You can use the new copernicus dataspace website to look for an example product.

EmileSonneveld commented 1 year ago

The scala code now gives the same values as in Terrascope: image