NDWI: custom script for QGIS to match the EO browser

  • 26 April 2024
  • 4 replies
  • 22 views

Hi!

I am having trouble in obtaining the same image in the QGIS throgh the plugin compared to the EO browser for the NDWI. I have gone through some posts and the proposed scripts but it does shows the same image still… neither the custom scripts stored in the custom scripts repository, it is all black in the background.

I would really appreciate some help, I am quite new with the tool.

Thanks in advance!

Rafa


4 replies

Hi @rcalvo ,

Could you please describe the issue with more details? What layer on the EO Browser you’re trying to create, the default one or a self-defined one? What is the parameters set for the QGIS plugin? What is the current behaviour and what is the expected result?

It would be really helpful if you could provide all the details so we can reproduce the issue and figure out how to solve it.

Thanks for your swift reply Mr. Chung.

I am comparing the EO browser for NDWI:

apps.sentinel-hub.com 0d605cf007e70fef63de75e75f6672e960701301.jpg

Sentinel-hub EO-Browser3

Sentinel-2 L2A imagery taken on August 18, 2018

which is different than what it appears in the Sentinel Hub plugin in the QGIS for NDWI:

The script used to obtain the image in the QGIS plugin is the NDWI. I tried some but all with black background, and the following is the one that it is more similar to the EO browser image results:

//VERSION=3

var colorRamp1 = [
[0, 0xFFFFFF],
[1, 0x008000]
];
var colorRamp2 = [
[0, 0xFFFFFF],
[1, 0x0000CC]
];

let viz1 = new ColorRampVisualizer(colorRamp1);
let viz2 = new ColorRampVisualizer(colorRamp2);

function evaluatePixel(samples) {

var val = index(samples.B03, samples.B08);
if (val < -0) {
return [...viz1.process(-val), samples.dataMask];

} else {
return […viz2.process(Math.sqrt(Math.sqrt(val))), samples.dataMask];
}
}

function setup() {
return {
input: [{
bands: [
“B03”,
“B08”,
“dataMask”
]
}],
output: {
bands: 4
}
}
}

As I mentioned, the images do not match. It seems that the one in the EO browser represents better the reality.

Thank you very much

Hi @rcalvo ,

I compared your evalscript with the default NDWI evalscript on EO Browser and concluded that they are returning the same data.

I displayed data over a testing AOI and time interval on EO Browser and QIS plugin; unfortunately, I cannot reproduce the issue you described and both layer look the same. Could you please provide the AOI and the time interval you are working with and other parameters that allow me to reproduce the black background effect you mentioned previously?

Thank you!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

Reply


Planet Monitoring
Investors

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use