# Why mNDWI can detect the shallow water area but ignores the deep water area?

I'm using Landsat 8 in Google Earth Engine to detect the water body in Jiangsu and Zhejiang area, China.

The formula is:

mNDWI = (Green-SWIR)/(Green+SWIR)

I applied this formula to GEE code, and it shows as follow:

As we can see, the blue area corresponds to the land, while the red area corresponds to the water body. The coastal line is clearly and correctly displayed. However, that only works for the shallow water area: As the distance to the coast increases, the red color fades away and the deep water area shows in blue.

The EVI result has the similar issue, I applied the formula:

EVI = 2.5*(NIR-RED)/(NIR+6*RED-7.5*BLUE+1)

And it shows as follow:

I promise that can't be cloud or some other disturb factors, I have already removed them before computing the indices. The shape of the abnormally displayed area is highly related to the shape of shallow water area, as shown below as a kind of yellow water:

I will also share my code here, hope anyone could figure out why it occurs, or is there any mistake I made, and how can I make the deep water area shown as what it should be.

//Choose Area
var region = ee.Geometry.Polygon({
coords: [[[119.65, 36.28], [125.08, 30.63], [119.56, 29.65],[118.07, 33.81]]],
geodesic: false
});

var landsat8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR');

var non_mosaic = landsat8 .filterBounds(region) .filterDate('2017-01-01', '2017-12-31');

var getQABits = function(image, start, end, newName) {
// Compute the bits we need to extract.
var pattern = 0;
for (var i = start; i <= end; i++) {
pattern += Math.pow(2, i);
}
// Return a single band image of the extracted QA bits, giving the band
// a new name.
return image.select([0], [newName])
.bitwiseAnd(pattern)
.rightShift(start);
};

// Select the QA band.
var QA = image.select(['pixel_qa']);
// Get the internal_cloud_algorithm_flag bit.
// Return an image masking out cloudy areas.
};

// A function to mask out cloud pixels.
var clouds = function(image) {
// Select the QA band.
var QA = image.select(['pixel_qa']);
// Get the internal_cloud_algorithm_flag bit.
return getQABits(QA, 5,5, 'Cloud').eq(0);
// Return an image masking out cloudy areas.
};

var c = clouds(image);
};

//Will be used for frequency calculaton

//display the mosaicked origional image and cloud free image
var visParams = {bands: ['B4', 'B3', 'B2'],min: [0,0,0],max: [2000, 2000, 2000]};
Map.setCenter(121.07, 33.02, 6);

//The index results on a single day (Dec 31st 2017) are shown below

// Display the mNDWI.
// Define the visualization parameters.
var vizParams = {bands: ['B6', 'B5', 'B2'], min: 0, max: 0.5,gamma: [0.95, 1.1, 1]};
// Create an mNDWI image, define visualization parameters and display.
var mndwi = mosaic_free.normalizedDifference(['B3', 'B6']);
var mndwiViz = {min: 0, max: 1, palette: ['0000FF', 'FF0000']};

// Display the EVI.
// Define the visualization parameters.
var vizParams = {bands: ['B6', 'B5', 'B2'], min: 0, max: 0.5,gamma: [0.95, 1.1, 1]};
// Create an EVI image, define visualization parameters and display.
var evi = mosaic_free.expression(
'(NIR - RED)/(NIR+6*RED-7.5*BLUE+1)*2.5', {
'BLUE': mosaic_free.select('B2'),
'RED': mosaic_free.select('B4'),
'NIR': mosaic_free.select('B5'),
});
var eviViz = {min: 0, max: 1, palette: ['0000FF', 'FF0000']};