Skip to main content
Tayyab Manan
Home
Projects
Blog
About
Contact
Resume
Tayyab Manan
HomeProjectsBlogAboutContactResume
  1. Home
  2. Projects
  3. WaterTrace Pakistan

Geospatial AI · January 2025

WaterTrace Pakistan

Groundwater Prediction Using Satellite Data and ML

Built with React · Flask · Pandas · Scikit-learn · Google Earth Engine · Leaflet · Recharts · Tailwind CSS

Live DemoSource Code
Previous projectTeacherRankNext project Face Expression Detection
Back to all projects
HomeProjectsBlogAboutContactResume
 

Islamabad, Pakistan · UTC+5

Tayyab Manan

©

    Overview

    WaterTrace predicts and monitors groundwater levels across Pakistan. It processes 22 years of satellite data from NASA's GRACE mission (2002-2017) and GLDAS land surface models (2018-2024) to forecast groundwater depletion across all 145 districts. The model reaches R²=0.89, and the results are served through a web dashboard with district-level maps and time-series charts.

    Read the full write-up →

    the live dashboard · 22-year anomaly series, observed to predicted · 145 districts
    the live dashboard · 22-year anomaly series, observed to predicted · 145 districts

    What it does

    It combines GRACE gravity-anomaly data and GLDAS soil-moisture measurements across 22 years, and a Gradient Boosting model (R² = 0.89) forecasts 6 months ahead for each of the 145 districts, with confidence intervals. The dashboard shows 22-year time-series charts with a data-source indicator on each, plus district maps, and it works on mobile. A REST API exposes the predictions and the underlying data.

    Stack

    The frontend is React 18 with Recharts for time-series charts. Flask serves the ML API. Pandas and NumPy handle feature engineering and data processing. Google Earth Engine provides the satellite datasets, and Scikit-learn runs the regression modelling, cross-validation, and hyperparameter tuning. District maps with depletion overlays are rendered with Leaflet. Tailwind CSS handles the responsive layout.

    Satellite data sources

    SourceDetails
    GRACE Satellites (2002-2017)Direct groundwater measurements via gravity anomalies
    GLDAS V021 (2018-2024)Deep soil moisture (100-200cm) as groundwater proxy
    Temporal ResolutionMonthly aggregated data points
    Spatial CoverageAll of Pakistan with district-level aggregation
    Data Volume163 GRACE observations + 72 GLDAS measurements

    Findings

    MetricValue
    Total groundwater loss (2002-2017)13.71 cm
    Average depletion rate0.81 cm/year (p-value < 0.001)
    Worst-hit areasQuetta (-15.3 cm), Lahore (-12.5 cm), Punjab belt
    Recent trend (GLDAS era)+1.5 kg/m²/year improvement in some regions
    Districts in critical stress15+

    ML pipeline

    ComponentDetails
    Feature EngineeringLag features (1-12 months), seasonal sine/cosine transforms, rolling means, spatial features, trend coefficients
    Models ComparedLinear Regression (R²=0.71), Random Forest (R²=0.84), Gradient Boosting (R²=0.89)
    ValidationTime-series cross-validation (5 splits, chronological) to prevent leakage
    PerformanceRMSE = 0.67 cm, MAE = 0.52 cm, R² = 0.89
    Prediction Horizon6 months ahead with confidence intervals
    InterpretabilitySHAP values for feature importance

    What I learned

    Satellite data engineering

    Merging 22 years of data from two sources with different formats and temporal coverage was the first real problem. GRACE gives gravity anomalies through 2017; GLDAS gives deep soil moisture from 2018, which only works as a groundwater proxy after correlation analysis and calibration. Aggregating pixel-level rasters to irregular district boundaries was fiddly, and Google Earth Engine meant learning to process data I never downloaded. Getting the pipeline to handle 145 districts across 235 monthly observations without being painfully slow took work too. Most of the project's time went into this stage, which turned out to be normal rather than a sign something was wrong.

    Forecasting

    Model performance went from R² 0.65 to 0.89 almost entirely through feature engineering (lag variables, seasonal sine/cosine terms, rolling means), not through swapping algorithms. Temporal cross-validation mattered more than I expected: random splits leak future information into training, so the chronological splits are the only scores I trust. Monsoon seasonality and irrigation cycles, domain facts rather than ML ones, were the features that moved the number.

    Communicating uncertainty

    I came in knowing ML but not hydrology. Building a tool that could feed into policy decisions changed how the outputs are presented: confidence intervals instead of point estimates, district maps instead of tables, and a data-source indicator on every chart so nobody mistakes a GLDAS proxy for a GRACE measurement.

    What's next

    Integrating GRACE Follow-On (GRACE-FO) data for direct measurements beyond 2018, trying LSTM and Transformer architectures for multi-step forecasting, and adding real-time climate data (temperature, rainfall) as model inputs. I'd also like a district-level alert system for sudden depletion events, and an MLOps pipeline that retrains automatically as new satellite data lands.