Skip to main content

How are the values calculated within Sentinel Hub and how are they returned as an output for NDWI?

I am assuming you are using Sentinel Hub OGC services, not one of our applications (it should not be too difficult to apply the answer to EO Browser either).


If you want to get NDWI as a value rather than a color, you should do the following steps:



  1. Go to Configuration utility and create a new layer, e.g. naming it “NDWI - value”.

    You will find instructions on how to do this here and in this video.




  2. In data processing field click “Edit data processing”.




  3. You need to find the appropriate band combination for NDWI. We have one option listed on this page:
    return >(B03 - B08) / (B03 + B08)];




  4. If you are using our Statistical API, you can get values directly in JSON.

    In case you are using some other tool, you might want to check this post to see, how values are then reflected in the output depending on the format.




The reference calculation for NDWI should be (NIR-SWIR)/(NIR+SWIR). How is the use of the green band and the formula (Green-NIR)/(Green+NIR) providing a proper NDWI index? Is this a documentation issue?


There are actually two common implementation of NDWI, check the script for more info:
github.com

sentinel-hub/custom-scripts/blob/master/sentinel-2/ndwi/script.js


//Source: https://en.wikipedia.org/wiki/Normalized_difference_water_index

//option 1, used to monitor changes in water content of leaves, proposed by Gao
//http://ceeserver.cee.cornell.edu/wdp2/cee6150/Readings/Gao_1996_RSE_58_257-266_NDWI.pdf
var ndwi = (B08-B11)/(B08+B11);

//option 2, used to monitor changes related to water content in water bodies, using green and NIR wavelengths, defined by McFeeters (1996):
//var ndwi = (B03 - B08) / (B03 + B08);

if (ndwi < -0) {
return colorBlend(-ndwi, [0,1], [[1,1,1],[0,0.5,0]]);

} else {
return colorBlend(Math.pow(ndwi,0.25), [0,1], [[1,1,1],[0,0,0.8]]);
}







Reply