Skip to main content

I have downloaded a NDSI layer, but rather many large lakes are shown as snow fields. What is the best way to differentiate real lakes from snowfields. The ndwi layer shows the laked correctly.

One option would be to combine NDWI and NDSI and show water if NDWI identifies water and NDSI otherwise, e.g.:


let viz = new Identity();
function setup(ds) {
setInputComponents([ds.B03, ds.B11, ds.B04, ds.B02, ds.B08]);
setOutputComponentCount(3);
}
function evaluatePixel(samples) {
let ndsi = index(samples[0].B03, samples[0].B11);
let ndwi = index(samples[0].B03, samples[0].B08);

//if ndwi is more than 0, show water
if (ndwi>0) return colorBlend(Math.pow(ndwi,0.25), [0,1], [[1,1,1],[0,0,0.8]]);

//otherwise process snow mask
else
{
if (ndsi>0.42) return [1,0,0];
else return [2.5*samples[0].B04, 2.5*samples[0].B03,2.5*samples[0].B02];
return viz.process(ndsi);
}
}

However, in a few cases I tried, the script above showed water in some places where there is snow (not so difficult to understand…). Perhaps you need to fine-tune the thresholds a bit.


Thanks for your proposal.

What module should I use for this?
EOBroswer, snap, …?
What is the programming language?
With kind regards


I changed your script, and I got a result where I can differentiate snowfields and lakes.Snow%20fields%20and%20lakes|690x388

I would like your help on how to calculate the area for the snow field within Sentinel EOBrowser…

I can do this with ArcGIS and “maximum liklyhood”, by using “test polygons”, but I would prefer to do this within EOBrrowser.

Is this possible?
With kind regards


The language above is JavaScript and you can configure Sentinel Hub processing with it.

Check this link:
https://www.sentinel-hub.com/custom-processing-scripts

and
Sentinel-Hub custom scripts

Collection of custom scripts



A repository of custom scripts that can be used with Sentinel-Hub services.







You can simply copy-paste it in EO Browser (or Playgroung) in “Custom” tag, then clicking the “advanced” switch.


Can you send changed script in some other way, e.g. copy-pasting it here. The link above does not work for some reason. Do also send lat/lon and date, which you used for testing, so that I can take a look myself.


Would you like to get area in sq. km? This is unfortunately not possible directly. You could output the result in JSON/SHP (https://www.sentinel-hub.com/develop/documentation/api/output-formats) and then use some other GIS tool to measure the area.


There is a “measure” tool in EO Browser, but you need to do manual polygon drawing…


Reply