Skip to main content

Open-source water data aggregation toolkit with AI-powered research methodology recommendations

Project description

AquaScope logo

AquaScope

Open-source Python toolkit for water data, hydrology, and agricultural water management โ€” with an AI engine that recommends and auto-executes research methodologies.

CI PyPI version Python License: MIT Code style: ruff Tests Live demo

GitHub stars GitHub forks

๐ŸŒŠ Live Demo ยท Install ยท Examples ยท CLI ยท Features ยท Docs ยท Roadmap ยท Discussions

Support on Ko-fi if AquaScope helps your research.


AquaScope unifies 25 global water-data sources behind one Python schema, then layers a full scientific computing stack on top โ€” from Bulletin 17C flood frequency to FAO-56 crop water requirements โ€” wrapped in an AI engine that scores 26 research methodologies against your dataset and auto-executes 26 analysis pipelines. Validated against the CAMELS benchmark with 1,000+ tests.


โœจ What you can do

  • ๐ŸŒŠ Pull water data from USGS, FAO AQUASTAT, FAO WaPOR, GEMStat, EU WFD, Copernicus ERA5, France Hub'Eau, Taiwan MOENV/WRA/Civil IoT/DataGov, Japan MLIT, Korea WAMIS, India WRIS, GRDC, CAMELS-CL, OpenMeteo, UN SDG 6, US Water Quality Portal โ€” one unified Python API.
  • ๐Ÿ“ˆ Run hydrological analyses โ€” Bulletin 17C flood frequency (GEV / LP3 / Gumbel / non-stationary GEV / EMA), baseflow separation, rating curves, 21 hydrological signatures.
  • ๐ŸŒพ Plan agricultural water โ€” FAO-56 Penman-Monteith ETโ‚€, crop water requirements for 20 crops, irrigation scheduling, soil water balance with auto-irrigation.
  • ๐Ÿค– Ask the AI engine โ€” describe your goal in plain English and get a recommended methodology, scored against your dataset profile and auto-executed. LLM enhancement via OpenAI, Groq (free), HuggingFace (free), or local Ollama.
  • ๐Ÿ“Š Visualise + report โ€” 16 plot types, Q-Q / P-P diagnostics, Markdown / HTML reports with embedded figures, threshold alerts (WHO / EPA / EU WFD).
  • ๐Ÿ—บ๏ธ Spatial hydrology โ€” DEM processing, D8 flow direction, watershed delineation, Strahler ordering.

For the full capability list see docs/features.md.

๐Ÿ“Š Why AquaScope

AquaScope HEC-SSP R lmom Standalone collectors
Bulletin 17C FFA + EMA โœ… โœ… partial โ€”
Non-stationary GEV โœ… โ€” partial โ€”
Baseflow separation (Lyne-Hollick, Eckhardt) โœ… โ€” โ€” โ€”
FAO-56 Penman-Monteith ETโ‚€ + crop water โœ… โ€” โ€” โ€”
25 unified data collectors โœ… โ€” โ€” per-source
AI methodology recommender (OpenAI / Groq / HF / Ollama) โœ… โ€” โ€” โ€”
Interactive Streamlit dashboard โœ… โ€” โ€” โ€”
Free, MIT, Python-native โœ… partial โœ… varies

โšก Install

pip install aquascope              # core โ€” collectors + hydrology
pip install "aquascope[all]"       # everything โ€” ML, viz, spatial, dashboard

Feature-group extras:

pip install "aquascope[ml]"           # sklearn, xgboost, statsmodels
pip install "aquascope[viz]"          # matplotlib, seaborn, folium
pip install "aquascope[scientific]"   # xarray, netcdf4, h5py
pip install "aquascope[interop]"      # xarray + geopandas (collect as_xarray / as_geodataframe)
pip install "aquascope[spatial]"      # rasterio, geopandas, shapely
pip install "aquascope[dashboard]"    # streamlit
pip install "aquascope[forecast]"     # prophet, torch (for LSTM)

For development:

git clone https://github.com/Rekin226/aquascope.git
cd aquascope
pip install -e ".[all,dev]"

๐Ÿš€ Examples

1. Flood frequency analysis (Bulletin 17C)

from aquascope.api import flood_analysis

result = flood_analysis(daily_discharge, method="gev", return_periods=[10, 50, 100])
print(result.return_periods)
# {10: 1840.2, 50: 2530.7, 100: 2870.4}
print(result.confidence_intervals)
# {10: (1690.4, 2010.6), 50: (2280.1, 2820.9), 100: (2540.6, 3260.5)}

Switch method to "lp3", "gumbel", "gev_lmoments", or "gpd". Non-stationary GEV (fit_nonstationary_gev) and Bulletin 17C EMA for censored records (expected_moments_algorithm) are available in aquascope.hydrology.flood_frequency.

2. Baseflow separation + hydrological signatures

from aquascope.api import baseflow_analysis, compute_all_signatures

bf  = baseflow_analysis(daily_discharge, method="eckhardt")   # or "lyne_hollick"
sig = compute_all_signatures(daily_discharge)

print(bf.bfi)                  # baseflow index, e.g. 0.42
print(sig.q5, sig.q95)         # high-flow / low-flow exceedances
print(sig.flashiness_index)    # Richards-Baker flashiness index

21 signatures across magnitude, variability, timing, recession, and flashiness โ€” see docs/features.md.

3. Collect data from any of the 25 sources

from aquascope.collectors import USGSCollector, AquastatCollector, WaPORCollector

usgs = USGSCollector()   # pass api_key=... for reliable access
flow = usgs.collect(days=7, bbox="-77.6,38.7,-76.9,39.1")   # Potomac basin, last week

aquastat = AquastatCollector()
egy_water = aquastat.collect(country_code="EGY", variable_ids=[4263, 4253, 4312])

wapor = WaPORCollector()
et = wapor.collect(
    bbox=(30.5, 29.8, 31.1, 30.2),
    variable="RET",
    start_date="2026-04-01",
    end_date="2026-07-31",
)

Every collector returns records in the same Pydantic schema, so downstream analyses don't care where the data came from. See docs/data_sources.md for the full list.

4. FAO-56 crop water requirements + soil water balance

from datetime import date
from aquascope.agri import (
    penman_monteith_daily,
    crop_water_requirement,
    SoilWaterBalance,
)
from aquascope.agri.water_balance import SoilProperties

# Reference ET (FAO-56 Penman-Monteith) โ€” Cairo, July
eto = penman_monteith_daily(
    t_min=18.0, t_max=32.0, rh_min=40, rh_max=80,
    u2=2.0, rs=22.0, latitude=30.0, elevation=70, doy=180,
)

# Crop water requirement for maize from planting through harvest โ€” eto_series is
# a daily ETโ‚€ pd.Series (build one with penman_monteith_series on a weather DataFrame)
cwr = crop_water_requirement(eto_series, crop="maize", planting_date=date(2026, 4, 1))

# Soil water balance with auto-irrigation triggers โ€” returns a daily DataFrame
soil    = SoilProperties(field_capacity=0.30, wilting_point=0.15, root_depth=1.0)
balance = SoilWaterBalance(soil).auto_irrigate(
    cwr["etc"], precip_series, efficiency=0.7,
)
print(balance["irrigation_mm"].sum())             # total irrigation applied (mm)
print(int(balance["irrigation_trigger"].sum()))   # number of deficit days

5. AI methodology recommender

from aquascope.ai_engine import DatasetProfile, recommend

# Describe your dataset and goal โ€” get ranked, scored methodologies
profile = DatasetProfile(
    parameters=["DO", "BOD5", "COD"],
    n_records=4_500,
    time_span_years=6.0,
    research_goal="detect long-term pollution trends with seasonality",
)
recs = recommend(profile)

for r in recs[:3]:
    print(f"{r.score:5.1f}  {r.methodology.id:<18}  {r.rationale[:46]}โ€ฆ")
#  55.9  trend_analysis      Your dataset includes bod5, cod, do which areโ€ฆ
#  54.6  lstm_forecasting    Your dataset includes bod5, cod, do which areโ€ฆ
#  54.6  arima_forecast      Your dataset includes bod5, cod, do which areโ€ฆ

Then auto-execute the top result with run_pipeline(recs[0].methodology.id, df).

6. Change-point detection + copula dependence

from aquascope.api import detect_changepoints, fit_copula

cps  = detect_changepoints(annual_runoff, method="pettitt")
cop  = fit_copula(rainfall, runoff, family="auto")    # AIC-selects Gaussian/Clayton/Gumbel/Frank
cp   = cps.changepoints[0]
print(cp.timestamp, cp.p_value)
print(cop.family, cop.parameter, cop.aic)

7. Bayesian regression with uncertainty quantification

from aquascope.api import bayesian_regression

# Annual rainfall โ†’ runoff with full posterior + convergence diagnostics
posterior = bayesian_regression(X=annual_precip, y=annual_runoff)

print(posterior.posterior_mean)
# {'beta_0': 12.4, 'beta_1': 0.82, 'sigma2': 41.6}

print(posterior.credible_intervals["beta_1"])
# (0.78, 0.86)        โ† 95% credible interval on slope

print(posterior.r_hat)
# {'beta_0': 1.00, 'beta_1': 1.00, 'sigma2': 1.00}    โ† Gelmanโ€“Rubin, converged

print(posterior.dic, posterior.effective_sample_size["beta_1"])
# 124.7  9842.0       โ† model fit + effective sample size

Switch to MCMC with degree>1 for polynomial models, or pass prior_precision for informative priors. Conjugate linear, polynomial, and Metropolis-Hastings backends are all available.


๐Ÿ’ป CLI

AquaScope ships a 19-command CLI for the most common workflows:

# Collect data
aquascope collect --source usgs --days 365
aquascope collect --source wapor --bbox 30.5,29.8,31.1,30.2 --variable RET --start-date 2026-04-01

# Hydrological analysis
aquascope hydro --analysis flood-freq --file discharge.csv
aquascope hydro --analysis baseflow --file discharge.csv --method eckhardt

# Agriculture planning
aquascope agri plan --crop maize --planting-date 2026-04-01 --lat 30.0 --lon 31.25

# AI recommendation + natural-language problem solving
aquascope recommend --parameters DO,BOD5,COD --goal "pollution trend detection"
aquascope solve --problem "Assess flood risk for a 100-year return period"

# Interactive Streamlit dashboard โ€” multipage workspace with 21 live sources,
# smart auto-insights, and fully interactive Plotly charts
aquascope dashboard

Run aquascope --help for the full command list.


๐ŸŒ Data sources at a glance

25 data collectors spanning four regions (highlights below, full list in the docs):

  • ๐ŸŒŽ Americas โ€” USGS (streamflow + WQ), NOAA NWPS (US streamflow), Water Quality Portal (400+ agencies), CAMELS-CL (Chile streamflow)
  • ๐ŸŒ Europe โ€” EU Water Framework Directive, Copernicus ERA5, France Hub'Eau, Germany PEGELONLINE
  • ๐ŸŒ Asia-Pacific โ€” Taiwan MOENV / WRA / Civil IoT / DataGov, Japan MLIT, Korea WAMIS, India WRIS
  • ๐ŸŒ Global โ€” GEMStat (170 countries), UN SDG 6, OpenMeteo, FAO AQUASTAT, FAO WaPOR, GRDC (river discharge)

Full details, endpoints, and API-key requirements: docs/data_sources.md. Want to add your country's water service? See adding a data source.


๐Ÿงช Scientifically validated

  • 1,000+ tests โ€” covering every collector, hydrology method, and pipeline (spatial and ARIMA tests require the optional [all] / [ml] extras)
  • CAMELS benchmark โ€” a 10-catchment validation subset of the CAMELS dataset ships with the repo at data/camels_benchmark/ and runs as part of CI
  • Every method cited โ€” equations, decision trees, and DOI references for all 26 methodologies live in the theory guide
  • JOSS paper in submission โ€” see paper.md and paper.bib

๐Ÿ“š Documentation

Resource What it covers
Features Full capability list โ€” hydrology, agriculture, ML, spatial, I/O
Data sources All 25 sources, endpoints, API-key requirements
Theory guide Equations, DOI citations, decision trees for every method
Methodology matrix When to use which method
Architecture How AquaScope is structured internally
FAQ ยท Troubleshooting Common questions and fixes
Use cases Real-world applications and case studies
Integration guides xarray, QGIS, R interoperability
Contributing How to add a data source, methodology, or test

๐Ÿค Contributing

We welcome contributions from the global water and agriculture research community. Highest-impact contributions right now:

  • New data source collectors โ€” your country / region
  • New research methodologies โ€” expand the AI recommender
  • New crop coefficients โ€” extend the FAO Kc table
  • Jupyter tutorials and validation studies โ€” compare against HEC-SSP, R packages, etc.

๐Ÿ“Œ Where to start

๐Ÿ“ Data sources wanted โ€” help us map every country's water data ๐ŸŒ โ€” our pinned meta-issue. Want your country in AquaScope? Start here.

New contributor? These good first issues are scoped with clear acceptance criteria โ€” just comment to claim one:

Area Open issues
๐ŸŒ New data collectors Brazil ยท Canada ยท UK ยท South Africa ยท Australia
๐ŸŒพ Agriculture Kc for millet/cassava/chickpea ยท Kc for sorghum/groundnut/sugar beet
๐Ÿ“ˆ Methodologies SPEI drought index ยท Budyko framework
๐Ÿ“Š Visualization interactive Plotly hydrograph ยท double-mass curve
๐Ÿ’ป CLI --output to JSON/CSV ยท shell completion
๐Ÿ“š Docs & tutorials Colab/Binder badges ยท groundwater notebook ยท agri irrigation notebook ยท translate the docs (zh/fr/ja)
๐Ÿงช Code quality & tests type annotations

Browse the full issue list or vote on what to build next in Discussions โ†’ Ideas.

See CONTRIBUTING.md, the adding a data source guide, and the adding a methodology guide.

๐Ÿชœ The contributor ladder

We want contributors to grow, not vanish after one PR. There's a clear path: start with a good first issue, then graduate to a good second issue (a bigger self-contained piece that builds on what you learned), and after a few PRs in one area we'll invite you to help triage and review. See CONTRIBUTORS.md for details.

๐Ÿ™Œ Contributors

Thanks to these wonderful people who make AquaScope possible (emoji key):

Abdoul Rachid Ouedraogo
Abdoul Rachid Ouedraogo

๐Ÿ’ป ๐Ÿ“– ๐Ÿšง
Vaishnavi Desai
Vaishnavi Desai

๐Ÿ”Œ
Karthick
Karthick

๐Ÿ’ป
sagiB74
sagiB74

โš ๏ธ
Karthik Laishetti
Karthik Laishetti

๐Ÿ’ป ๐Ÿ›
Adam Jenkins
Adam Jenkins

๐Ÿ”Œ ๐Ÿ’ป โš ๏ธ
Steven Widjaja
Steven Widjaja

โš ๏ธ
Sai Raj Kasam
Sai Raj Kasam

๐Ÿ’ป
safiashaik04
safiashaik04

๐Ÿ’ป
Navaneeth Sankar
Navaneeth Sankar

๐Ÿ“– โš ๏ธ
Taran
Taran

๐Ÿ’ป โš ๏ธ
Ahmed Baruwa
Ahmed Baruwa

๐Ÿ’ป โš ๏ธ
Anthony
Anthony

๐Ÿ’ป โš ๏ธ

Your first merged PR puts you on this board, every kind of contribution counts. See CONTRIBUTORS.md.

๐Ÿ“œ Citation

If you use AquaScope in your research, please cite:

@software{aquascope2026,
  title   = {AquaScope: Open-Source Water Data Aggregation, Hydrological Analysis, and Agricultural Water Management Toolkit},
  author  = {AquaScope Contributors},
  year    = {2026},
  url     = {https://github.com/Rekin226/aquascope},
  version = {0.8.1},
  license = {MIT}
}

๐Ÿ“„ License

MIT โ€” see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aquascope-0.9.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aquascope-0.9.0-py3-none-any.whl (398.9 kB view details)

Uploaded Python 3

File details

Details for the file aquascope-0.9.0.tar.gz.

File metadata

  • Download URL: aquascope-0.9.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aquascope-0.9.0.tar.gz
Algorithm Hash digest
SHA256 cc54fb5b0d25e161e68e8485718e9b749a2644ed231cfed2105fd280f22da5b9
MD5 9b5f4bf4bfb34529d63a05f899fa29e0
BLAKE2b-256 a768c3c6bdff9be9d05c641de4ec35fd544146c0a4865298f30bb0b9cca1fd11

See more details on using hashes here.

Provenance

The following attestation bundles were made for aquascope-0.9.0.tar.gz:

Publisher: publish.yml on Rekin226/aquascope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aquascope-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: aquascope-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 398.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aquascope-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40c91f68b96c82c3cae0853413f6736ba2e6e2838cf669c5543a7ea85b7d31d6
MD5 c02dff02685ab5d5247d9570f727efd6
BLAKE2b-256 2515aa98d0b8dfdcd8b192a457815dedffdd8933b0ac95f9b245fdddc5bd9362

See more details on using hashes here.

Provenance

The following attestation bundles were made for aquascope-0.9.0-py3-none-any.whl:

Publisher: publish.yml on Rekin226/aquascope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page