Open-EO / openeo-geopyspark-driver

OpenEO driver for GeoPySpark (Geotrellis)
Apache License 2.0
25 stars 4 forks source link

Raise clear error for 'SENTINEL_5P_L2' with only 'dataMask' #741

Closed EmileSonneveld closed 3 months ago

EmileSonneveld commented 3 months ago

There was already a check on collection_id here, so a test for SENTINEL_5P_L2 seems acceptable. If more checks like this get added in the future something more generic in the layercatalog might be nice.

jdries commented 3 months ago

seems to be a spelling error 'cant' in the error message should we immediately add a second error for the case where multiple bands are used? (Which also won't work afaik.)

EmileSonneveld commented 3 months ago

When using multiple bands, the error from SH is already clear: "The script can only use one product type at once! Instead it uses: [CO, O3]."

Typo fixed

EmileSonneveld commented 3 months ago

The error when using multiple bands is actually quite verbose and take a while. I'll block it early too. OpenEO batch job failed: Exception during Spark execution: org.openeo.geotrellissentinelhub.SentinelHubException: Sentinel Hub returned an error response: HTTP/1.1 400 Bad Request with body: {"error":{"status":400,"reason":"Bad Request","message":"The script can only use one product type at once! Instead it uses: [O3, CO].","code":"RENDERER_EXCEPTION"}} request: POST https://creodias.sentinel-hub.com/api/v1/process with (possibly abbreviated) body: { "input": { "bounds": { "bbox": [5.540042760864049, 42.90896435887362, 19.5082967291157, 51.79785324776091], "properties": { "crs": "http://www.opengis.net/def/crs/EPSG/0/4326" } }, "data": [ { "type": "sentinel-5p-l2", "dataFilter": {"timeRange":{"from":"2023-04-11T00:00:00Z","to":"2023-04-12T00:00:00Z"}}, "processing": {} } ] }, "output": { "width": 256, "height": 256, "responses": [ { "identifier": "default", "format": { "type": "image/tiff" } } ] }, "evalscript": "//VERSION=3\nfunction setup() {\n return {\n input: [{\n \"bands\": [\"CO\", \"O3\"]\n }],\n output: {\n bands: 2,\n sampleType: \"FLOAT32\",\n }\n };\n}\n\nfunction evaluatePixel(sample) {\n return [sample.CO, sample.O3];\n}" }

EmileSonneveld commented 3 months ago

@jdries Good message?"Collection 'SENTINEL_5P_L2' got requested with multiple bands: ['CO', 'O3']. Only one band is supported, with or without the 'dataMask' band."

jdries commented 3 months ago

Sure!