WaterTrace is a comprehensive groundwater monitoring and analysis system for Pakistan, leveraging 22 years of satellite data (2002-2024) to track and predict water resource changes. This project combines advanced remote sensing data from GRACE satellites and GLDAS models with machine learning to provide actionable insights into Pakistan's critical water crisis.
- Real-time Dashboard: Interactive web application displaying groundwater trends and predictions
- Multi-Source Data Integration: Combines GRACE satellite data (2002-2017) with GLDAS soil moisture data (2018-2024)
- Machine Learning Predictions: Advanced models trained on historical data for future trend analysis
- District-Level Analysis: Detailed groundwater mapping across 145 districts in Pakistan
- Responsive Design: Fully responsive interface optimized for all devices
Our analysis reveals a severe water crisis in Pakistan:
- ๐ Historical Depletion (2002-2017): -13.71 cm total groundwater loss
- ๐ Annual Decline Rate: -0.81 cm/year consistent depletion
- ๐ Recent Trends (2018-2024): Slight stabilization indicated by GLDAS data (+1.5 kg/mยฒ/year)
โ ๏ธ Critical Regions: Quetta (-15.3 cm), Lahore (-12.5 cm), and Punjab agricultural belt showing severe stress
- Cloudflare Workers: Ultra-fast edge API (migrated from Flask)
- TypeScript: Type-safe API development
- Embedded Data: Zero-latency data access
- Global CDN: <50ms response times worldwide
- Google Earth Engine: Satellite data processing
- React 18: Modern UI framework
- Recharts: Data visualization
- Leaflet: Interactive mapping
- Tailwind CSS: Responsive styling
- Vercel: Production hosting
- GRACE Satellites: NASA/DLR gravity anomaly measurements
- GLDAS: NASA/NOAA land surface model outputs
- Pakistan Shapefiles: Official administrative boundaries
- GRACE data: Monthly groundwater anomalies (2002-2017)
- GLDAS data: 3-hourly soil moisture aggregated to monthly (2018-2024)
- Spatial resolution: District-level aggregation for Pakistan
# Example processing pipeline
- Temporal aggregation to monthly averages
- Spatial clipping to Pakistan boundaries
- Unit conversion and normalization
- Anomaly calculation from baseline- Feature engineering with seasonal indicators
- Model comparison: Linear Regression, Random Forest, Gradient Boosting
- Time series validation with 80/20 split
- Performance metrics: Rยฒ = 0.89, RMSE = 0.67 cm
The interactive map displays:
- Color-coded markers indicating groundwater stress levels
- District-wise statistics and trends
- Real-time data updates
- Mobile-responsive interface
- Complete 22-year timeline with data source indicators
- Seasonal pattern analysis
- Trend lines and statistical summaries
- Export capabilities for further analysis
Key Metrics:
- Average groundwater anomaly: -7.6 cm (current estimate)
- Seasonal variation: ยฑ3.2 cm
- Most stressed province: Balochistan
- Recovery potential: Limited without intervention
- Python 3.11+
- Node.js 16+
- Git
# Clone repository
git clone https://github.com/TayyabManan/WaterTrace.git
cd WaterTrace/webapp/cloudflare-api
# Install dependencies
npm install
# Deploy to Cloudflare Workers
npm run deploy
# For local development
npm run dev# Navigate to frontend
cd ../frontend
# Install dependencies
npm install
# Start development server
npm startUpdate frontend/src/config.js:
// Production API (Cloudflare Workers)
const API_URL = 'https://watertrace-api.watertrace.workers.dev';Production: https://watertrace-api.watertrace.workers.dev
Development: http://localhost:8787
GET /api/analysis/summaryReturns project overview and key statistics
GET /api/historical/timeseriesReturns GRACE data (2002-2017)
GET /api/recent/timeseriesReturns GLDAS data (2018-2024)
GET /api/combined/timelineReturns merged and scaled data for visualization
GET /api/districts/groundwaterReturns GeoJSON with district-level statistics
GET /api/gldas/trend-analysisReturns trend analysis and predictions
- Response Time: 5-10s โ <50ms (200x faster)
- Cold Starts: Eliminated
- Global Availability: Edge deployment in 200+ cities
- Uptime: 99.99% SLA
-
GRACE (2002-2017)
- Direct groundwater measurements via gravity anomalies
- Monthly temporal resolution
- ~300km spatial resolution
-
GLDAS (2018-2024)
- Deep soil moisture as groundwater proxy
- 0.25ยฐ spatial resolution
- 3-hourly temporal resolution aggregated to monthly
- Time Series Decomposition: Trend, seasonal, and residual components
- Statistical Testing: Mann-Kendall trend test, p-value < 0.001
- Machine Learning: Ensemble methods for prediction
- Spatial Analysis: District-level aggregation and interpolation
- GRACE-FO Integration: Incorporate latest GRACE Follow-On mission data
- Real-time Alerts: District-wise water stress notifications
- Climate Integration: Correlation with precipitation and temperature data
- Policy Dashboard: Decision support system for water managers
- Mobile App: Native applications for field monitoring
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is part of the academic research portfolio. All rights reserved.
Tayyab Manan
- GitHub: @TayyabManan
- Portfolio: tayyabmanan.com
- LinkedIn: Tayyab Manan
- GRACE Mission: NASA/DLR for providing groundwater data
- GLDAS System: NASA/NOAA for land surface models
- Google Earth Engine: For cloud-based geospatial analysis
- Pakistan Survey Department: For administrative boundaries
For questions, suggestions, or collaborations:
- Email: haris.a.mannan@example.com
- Issues: GitHub Issues
๐ Monitoring Pakistan's Water Future, One Drop at a Time ๐
Together, we can work towards sustainable water management for Pakistan's future generations.






