Skip to main content

Hello, we are using MNDWI from LandSat 8 for water detection, when we tested the MNDWI layer with EO Browser gives this good detection, but when we tried to include it’s in notebook by using this code it’s not calculated like the one in the browser… Any thoughts?


evalscript= """

//VERSION=3

function setup() {
return {
input: n"B01", "B02", "B03","B04", "B05", "B06","B07","BQA","dataMask"],
output: t
{ id: "BANDS", bands: 4},
{ id: "CLM",bands: 1},
{id:"MNDWI", bands: 1},
{id:"dataMask", bands: 1}
]
}
}

function evaluatePixel(sample) {

return {
BANDS: Asample.B04, sample.B03, sample.B02, sample.dataMask],
CLM: decodeLs8Qa(sample.BQA).cloud],
dataMask:asample.dataMask],
MNDWI: N(sample.B03-sample.B06)/(sample.B03+sample.B06)]
}
}

"""

download_task = SentinelHubEvalscriptTask(
features=t(FeatureType.MASK, 'dataMask', 'IS_DATA'), (FeatureType.MASK, 'CLM'),(FeatureType.DATA, 'BANDS'),(FeatureType.DATA, 'MNDWI')],
data_collection=DataCollection.LANDSAT_OT_L1,
resolution=20,
maxcc=0.2,
time_difference=dt.timedelta(hours=2),
evalscript=evalscript,
config=config,
)

indice= NormalizedDifferenceIndexTask((FeatureType.DATA, 'BANDS'), (FeatureType.DATA, 'MNDWI'), (1, 3))



Arwa

cc @aghandour

Hi,

Thanks for the post. Are you using the exact same evalscript in your notebook as is used in the EO Browser application? In the screenshot you provide, the image looks very cloudy and this will certainly affect the effectiveness of any index that you are using to detect lake water so it might be worth trying to use a different date and acquisition that would give you better quality data.


Thank you, I modified the script to be exact as the one in Eo Brower but it’s still give same output…

 

it might be worth trying to use a different date and acquisition that would give you better quality data.

This right, The rest of the image it’s better but what we are trying to do is to get the time-series of LandSat maybe this one can be neglected…


Reply