Guide
Monitoring Water with Multi-Temporal NDWI in Google Earth Engine: A Pokhara Lekhnath Guide
In short
For open-water detection with Sentinel-2, use McFeeters NDWI = (B3 − B8) / (B3 + B8): water is positive and land is negative. Gao's NDWI (NDMI, B8 and B11) measures leaf water instead. Multi-temporal analysis in Google Earth Engine builds cloud-masked seasonal composites, thresholds NDWI to map water area, and compares seasons and years, as in Bishal Neupane's Pokhara Lekhnath analysis.
- Study area
- Pokhara Lekhnath, Kaski, Nepal
- Data and platform
- Sentinel-2 in Google Earth Engine
- Index
- McFeeters NDWI = (B3 − B8) / (B3 + B8)
- Findings (site)
- Seasonal pulses of water presence; persistent negative NDWI patterns
- Water threshold
- NDWI > 0 (adjust after checking known pixels)
Why monitor water with NDWI in Pokhara Lekhnath?
Pokhara Lekhnath Metropolitan City in Kaski district holds several lakes, including Phewa, Begnas and Rupa, along with rivers, wetlands and irrigated rice land, all shaped by a strong monsoon cycle. Water extent changes with season, sedimentation and land-use change, and much of that change is gradual enough to be missed without consistent records. Satellite water indices provide such a record at no data cost.
Bishal Neupane carried out a multi-temporal NDWI analysis of Pokhara Lekhnath using Sentinel-2 imagery in Google Earth Engine (GEE). As described on his methods page and CV, the analysis tracked seasonal water presence, identified seasonal pulses of water presence and persistent negative NDWI patterns, and produced maps that make water-body changes visible for decision-makers, with relevance to urban resilience, sustainable tourism and conservation. He summarised it in a LinkedIn post. This guide explains how to build that kind of analysis and how to read the results.
McFeeters NDWI vs Gao NDWI (NDMI) vs MNDWI
"NDWI" refers to more than one index, and mixing them up is the most common error in water studies.
| Index | Formula | Sentinel-2 | Measures |
|---|---|---|---|
| NDWI (McFeeters 1996) | (Green − NIR) / (Green + NIR) | (B3 − B8) / (B3 + B8) | Open surface water |
| NDWI / NDMI (Gao 1996) | (NIR − SWIR) / (NIR + SWIR) | (B8 − B11) / (B8 + B11) | Liquid water in vegetation canopies |
| MNDWI (Xu 2006) | (Green − SWIR) / (Green + SWIR) | (B3 − B11) / (B3 + B11) | Open water, with better suppression of built-up areas |
McFeeters designed his index to delineate open water: water reflects more green than near-infrared light, so it gives positive values, while vegetation and soil reflect strongly in the NIR and give negative values. Gao's index answers a different question, namely how much water leaves hold, and is useful for crop water stress rather than lake mapping. Xu's modification swaps NIR for SWIR to reduce confusion between water and built-up surfaces, which is relevant in a growing city. Formulas and band mappings follow the Awesome Spectral Indices catalogue. Note that B11 is a 20 m band, so NDMI and MNDWI carry less spatial detail than McFeeters NDWI at 10 m.
How to interpret negative NDWI values
With McFeeters NDWI, negative values are the normal state of land. Vegetated fields, forest and dry soil are all negative, with dense green vegetation usually more strongly negative because of its high NIR reflectance. So a "persistent negative NDWI pattern" means an area that consistently behaves like land rather than open water across the time series. Whether that is ecologically interesting depends on context:
- Persistently negative pixels on a lake margin that were once positive can indicate shoreline change, sediment deposition or encroachment.
- Persistently negative pixels in cropland are expected and say nothing about soil moisture on their own; use NDMI or field data for moisture questions.
- Values near zero are ambiguous: mixed water–land pixels, turbid or shallow water, aquatic vegetation, or flooded rice fields early in the season.
A threshold of 0 is the textbook dividing line for open water, but turbidity, shadows from steep terrain and thin cloud can shift the best threshold. Checking a few known water and land pixels before fixing a threshold is worth the time.
Step 1: Build a clean NDWI collection in Google Earth Engine
The script below uses the harmonised Sentinel-2 surface reflectance collection, masks cloud, shadow and cirrus with the Scene Classification Layer, and computes both McFeeters NDWI and NDMI for every scene.
// aoi: your boundary, e.g. an uploaded Pokhara Lekhnath polygon asset
function prep(img) {
var scl = img.select('SCL');
var clear = scl.neq(3).and(scl.neq(8)).and(scl.neq(9)).and(scl.neq(10));
var r = img.select(['B3', 'B8', 'B11']).updateMask(clear).divide(10000);
return r.normalizedDifference(['B3', 'B8']).rename('NDWI')
.addBands(r.normalizedDifference(['B8', 'B11']).rename('NDMI'))
.copyProperties(img, ['system:time_start']);
}
var s2 = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
.filterBounds(aoi)
.filterDate('2019-01-01', '2025-12-31')
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 40))
.map(function (img) { return ee.Image(prep(img)); });
Step 2: Seasonal composites and water area
Single scenes are noisy and often cloudy, especially in the monsoon. Seasonal median composites smooth that out and give a fair comparison between periods. The example uses three seasons for one year; repeat for several years to separate a trend from normal seasonal variation.
// Seasonal median composites for one year
function season(start, end, label) {
return s2.filterDate(start, end).median().clip(aoi)
.set('season', label).set('system:time_start', ee.Date(start).millis());
}
var pre = season('2024-03-01', '2024-06-01', 'pre-monsoon');
var mon = season('2024-06-01', '2024-10-01', 'monsoon');
var post = season('2024-10-01', '2025-01-01', 'post-monsoon');
// Open-water area (NDWI > 0) in hectares
function waterHa(img) {
var water = img.select('NDWI').gt(0);
var area = water.multiply(ee.Image.pixelArea()).divide(10000);
return area.reduceRegion({reducer: ee.Reducer.sum(), geometry: aoi, scale: 10, maxPixels: 1e10});
}
print('Pre-monsoon water (ha)', waterHa(pre));
print('Monsoon water (ha)', waterHa(mon));
print('Post-monsoon water (ha)', waterHa(post));
// Time series of mean NDWI across all clear scenes
print(ui.Chart.image.series({imageCollection: s2.select('NDWI'), region: aoi,
reducer: ee.Reducer.mean(), scale: 20}));
Map.centerObject(aoi, 12);
Map.addLayer(post.select('NDWI'), {min: -0.6, max: 0.4, palette: ['brown', 'white', 'blue']}, 'NDWI post-monsoon');
The water-area function counts pixels with NDWI above 0, multiplies by pixel area and converts to hectares. Comparing the same season across years shows long-term change; comparing seasons within a year shows the seasonal pulse.
Practical problems you will meet
- Monsoon clouds. June to September has few clear optical scenes. Expect gaps, widen the date window, or complement with Sentinel-1 radar, which sees through cloud.
- Terrain shadow. Steep slopes around the valley can produce dark pixels that resemble water. A slope or hillshade mask helps.
- Urban surfaces. Some roofs and roads can return positive McFeeters NDWI. MNDWI reduces this confusion.
- Turbid water. Sediment-laden water after heavy rain raises NIR reflectance and can lower NDWI towards zero.
- Validation. Compare the water mask with high-resolution imagery or field observations before reporting areas.
Why this matters for agriculture and planning
For farming around Pokhara, seasonal water maps show which irrigated and lowland areas flood, when ponds and canals hold water, and how lake margins used for cultivation change. For planners, consistent maps turn anecdotal observations about shrinking or silting lakes into evidence. The same index stack also feeds land-cover work; see the Kaski K-Means land-cover guide and the Sentinel-2 vegetation indices guide for NDVI, SAVI, GCI and PSRI.
Researchers working on water, wetlands or irrigated agriculture in Nepal who would like to collaborate can contact Bishal through the contact page.
Frequently asked questions
What does a negative NDWI value mean?
For McFeeters NDWI, negative values mean the pixel reflects more near-infrared than green light, which is typical of vegetation, soil and built-up land. Open water is usually positive. A negative value therefore indicates land, not drought. For questions about crop or soil moisture, use the NIR–SWIR index (NDMI) or field measurements instead.
What is the difference between McFeeters NDWI and Gao NDWI?
McFeeters (1996) NDWI uses green and NIR bands, (B3 − B8) / (B3 + B8) on Sentinel-2, to map open surface water. Gao (1996) NDWI uses NIR and SWIR, (B8 − B11) / (B8 + B11), to estimate liquid water in vegetation; it is often called NDMI. They share a name but answer different questions.
Is NDWI or MNDWI better for mapping lakes?
Both work for clear open water. MNDWI, proposed by Xu in 2006, replaces NIR with SWIR and usually separates water from built-up surfaces better, which helps in urban areas such as Pokhara. Its drawback on Sentinel-2 is that B11 is a 20 m band, so shorelines are less detailed than with 10 m McFeeters NDWI.
How do I calculate water area from NDWI in Google Earth Engine?
Threshold the NDWI band, for example ndwi.gt(0), multiply the resulting mask by ee.Image.pixelArea(), and sum it over your region with reduceRegion using ee.Reducer.sum(). Dividing by 10,000 converts square metres to hectares. Use cloud-masked composites and check the threshold against known water and land pixels first.
Why use seasonal composites instead of single images?
Single Sentinel-2 scenes are often partly cloudy, especially during the monsoon, and can be affected by haze or shadow. A median composite over a season combines all clear observations, reduces noise and makes different periods comparable. Comparing the same season across years separates long-term change from normal seasonal variation.
Sources
- McFeeters (1996) The use of the Normalized Difference Water Index (NDWI) in the delineation of open water features. Int. J. Remote Sensing 17:1425-1432
- Gao (1996) NDWI: a normalized difference water index for remote sensing of vegetation liquid water from space. Remote Sensing of Environment 58:257-266
- Xu (2006) Modification of normalised difference water index (NDWI) to enhance open water features in remotely sensed imagery. Int. J. Remote Sensing 27:3025-3033
- Awesome Spectral Indices catalogue (formulas and Sentinel-2 band mapping)
- Harmonized Sentinel-2 MSI Level-2A, Earth Engine Data Catalog
- Bishal Neupane, LinkedIn post on NDWI analysis for Pokhara Lekhnath