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.


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:

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

Kind regards,

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;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:

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

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.

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