Definition of nodata-value in WCS-Request

Hi Sinergise,

while using your WCS-request via Python to produce NDVI images, I got an image at an orbit boundary, as you can see in the images I attached. However, the nodata-value is 1, which is similar to the maximum possible NDVI.

I was wondering, if it is possible to define the nodata values either in the JS-code of the layer (within the WMS-Configurator) or within the Python-WCS-Request as a parameter.

Greetings,
Johannes

image%20(1) image

Could you share URL of this request (without instance ID) so that we could “debug” it better.
Generally no data values are 0, e.g. B01=0, B02=0,… So you could catch this in the script e.g.
if (B04==0) return [0,0,0]; (or similar)
I am guessing (but not sure) that you get 1 due to division with 0.

Hi @gmilcinski ,
thank you for the fast answer!
The request is the following:

https://services.sentinel-hub.com/ogc/wcs/INSTANCE_ID?SERVICE=wcs&REQUEST=GetCoverage&VERSION=1.3.0&COVERAGE=NDVI&BBOX=614641.6993672735%2C5752378.298124972%2C618093.1355100481%2C5756542.893842303&CRS=EPSG%3A32631&MAXCC=100.0&RESY=10m&TIME=2018-04-18T10%3A45%3A12%2F2018-04-18T10%3A45%3A12&RESX=10m&FORMAT=image%2Ftiff%3Bdepth%3D32f

By the way, if I download a single band, the nodata value seems to be 1 as well.

Kind regards,
Johannes

I see. This is a consequence of a (not really best) default of OGC standard, which states, that if no TRANSPARENT parameter is provided, no-data pixels are provided as white, therefore resulting in 1.
So to fix this issue, you should set TRANSPARENT=true in the WCS call.
@maleksandrov - it might be good to consider to implement this behaviour in sentinelhub-py by default?

A side note - we are now working on a proprietary API, which will expose satellite data without all these OGC constraints. This will probably solve most of these issues…

is this related to the EO-Learn Library? :slight_smile:

No, this is a parallel development of our core services. We are developing a POST based API, which will act as an interface for advanced users. It will not have any OGC-specific defaults and it will make it possible to query geometry of any size (current API is limited to number of chars in the URL).

eo-learn and sentinelhub-py libraries will be then upgraded to work with this API rather than going through OGC.

1 Like

Is it possible to define in the JS-code that - if any of the bands contains no-data (i.e. if any pixel contain the value zero) then the data of this date should not be returned?

This is not possible. The script needs to return some value.

I also fight with this feature! I tried the TRANSPARENT keyword and get very different results for different predefined layers. For instance, the enclosed link will give me background values with 0. But, If I exchange SAVI with NDVI, I get background values as NaN. I compared settings for both layers and could not spot a difference. Thanks for your time providing suggestions. Marcela

http://services.sentinel-hub.com/ogc/wcs/594a84f5-b1bd-4a3e-MASKED?REQUEST=GetCoverage&COVERAGE=SAVI&GEOMETRY=POLYGON%20((549960.1728284411%205227068.861892271%2C%20550132.3805685466%205227110.581801083%2C%20550135.4154003166%205227126.160645362%2C%20550142.2846296944%205227142.146935389%2C%20550148.4939520095%205227157.327570369%2C%20550149.0946399623%205227173.71421758%2C%20550130.3141877163%205227186.385342263%2C%20550102.2496054186%205227198.078373215%2C%20550083.1347019626%205227201.371428646%2C%20550066.2252146411%205227205.876819684%2C%20550054.1845795605%205227203.017950951%2C%20550028.4366681555%205227195.300630672%2C%20550000.3295872406%205227187.039421842%2C%20549955.0998025769%205227172.599045924%2C%20549960.1728284411%205227068.861892271))&TIME=2018-04-06/2018-04-06&CRS=EPSG%3A32633&maxcc=100&ATMFILTER=NONE&resx=10m&resy=10m&SHOWLOGO=false&TRANSPARENT=true&format=image/tiff;depth=32f

This looks quite a bit strange. We will investigate the processing and come back with our findings.

This came from our team:

In short: the data is OK, its just QGIS being QGIS.

In more detail:
This isn’t a bug but it does behave somewhat counter-intuitively so there is potential for improvement.
Basically outside the bounding polygon it still runs the evalscript but takes the band values as zero.

in this case:

SAVI:
let val = 1.5* ((samples[0].B08-samples[0].B04)/(samples[0].B08+samples[0].B04+0.5));

NDVI:
let val = (samples[0].B08 - samples[0].B04)/ (samples[0].B08 + samples[0].B04);

NDVI will divide by zero returning NaN, SAVI will return 0.

The masks themselves are correct and identical for both (note that float masks alpha range is 0-1 which isn’t qgis friendly which expects 0-255).

Ideally the values would be NaN for pixels outside the bounding polygon (where their alpha value is 0).

We will take this into consideration with the next version of the API.
Thanks for pointing it out.

1 Like

2 posts were split to a new topic: Querying large polygons