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

sometimes nodata value is incorrect in the original files e.g. fractional_snow_cover #300

Closed JeroenVerstraelen closed 1 month ago

JeroenVerstraelen commented 1 month ago

I had a look: it happens for sentinelhub based collections, that use the default sampletype, which is uint16. This sampletype is mapped to the default geotrellis uint16 celltype, with 0 as nodata value.

I'm not sure if sentinelhub supports nodata values at all, but it is perhaps best if we can effectively configure it in layercatalog.json. The 'quickfix' would be to set the default nodata value to something else (short.maxvalue), but that would suddenly change behaviour for a lot of collections. We would have to go over the list and think about it for each one of them.

Other 'quickfix' is to set sample type of fractional snow cover collection to float, this would solve thing in very short term, so maybe I'll start with that.

EmileSonneveld commented 1 month ago
import openeo
import sys

url = "https://openeo-dev.vito.be"
connection = openeo.connect(url).authenticate_oidc()

snow_cube = connection.load_collection(
    collection_id="FRACTIONAL_SNOW_COVER",
    spatial_extent={
        "west": 11.58,
        "east": 11.68,
        "south": 46.96,
        "north": 46.98,
    },
    temporal_extent=["2018-02-10", "2018-02-13"],
    bands=["NDSI"],
)

job = snow_cube.create_job(title="FRACTIONAL_SNOW_COVER")
job.start_and_wait()
job.get_results().download_files()

The nodata value should change from 0 to 255 for this layer image https://github.com/Open-EO/openeo-geotrellis-extensions/blob/3abdcb6f971102b21ab9d9d88f2eeb5ae4cf2165/geotrellis-sentinelhub/src/main/scala/org/openeo/geotrellissentinelhub/ProcessApi.scala#L212-L213

EmileSonneveld commented 1 month ago

Now on openeo-dev: image Note that clouds are marked as 205 an can be manually masked away: snow_cube = (snow_cube * 1.0).mask(snow_cube == 205) https://collections.sentinel-hub.com/hrsi-fsc/