aquascope 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aquascope-0.4.0/.github/FUNDING.yml +14 -0
- aquascope-0.4.0/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
- aquascope-0.4.0/.github/ISSUE_TEMPLATE/new_data_source.md +39 -0
- aquascope-0.4.0/.github/ISSUE_TEMPLATE/new_methodology.md +35 -0
- aquascope-0.4.0/.github/copilot-instructions.md +67 -0
- aquascope-0.4.0/.github/workflows/ci.yml +44 -0
- aquascope-0.4.0/.github/workflows/publish.yml +24 -0
- aquascope-0.4.0/.gitignore +40 -0
- aquascope-0.4.0/.pre-commit-config.yaml +22 -0
- aquascope-0.4.0/CHANGELOG.md +70 -0
- aquascope-0.4.0/CONTRIBUTING.md +112 -0
- aquascope-0.4.0/LICENSE +21 -0
- aquascope-0.4.0/MANIFEST.in +13 -0
- aquascope-0.4.0/PKG-INFO +396 -0
- aquascope-0.4.0/README.md +325 -0
- aquascope-0.4.0/ROADMAP.md +42 -0
- aquascope-0.4.0/aquascope/__init__.py +161 -0
- aquascope-0.4.0/aquascope/__main__.py +5 -0
- aquascope-0.4.0/aquascope/agri/__init__.py +46 -0
- aquascope-0.4.0/aquascope/agri/benchmark.py +226 -0
- aquascope-0.4.0/aquascope/agri/crop_water.py +335 -0
- aquascope-0.4.0/aquascope/agri/eto.py +490 -0
- aquascope-0.4.0/aquascope/agri/planner.py +243 -0
- aquascope-0.4.0/aquascope/agri/productivity.py +404 -0
- aquascope-0.4.0/aquascope/agri/water_balance.py +265 -0
- aquascope-0.4.0/aquascope/ai_engine/__init__.py +34 -0
- aquascope-0.4.0/aquascope/ai_engine/agent.py +235 -0
- aquascope-0.4.0/aquascope/ai_engine/knowledge_base.py +538 -0
- aquascope-0.4.0/aquascope/ai_engine/model_recommender.py +112 -0
- aquascope-0.4.0/aquascope/ai_engine/planner.py +130 -0
- aquascope-0.4.0/aquascope/ai_engine/recommender.py +331 -0
- aquascope-0.4.0/aquascope/alerts/__init__.py +48 -0
- aquascope-0.4.0/aquascope/alerts/checker.py +334 -0
- aquascope-0.4.0/aquascope/alerts/notifier.py +181 -0
- aquascope-0.4.0/aquascope/alerts/thresholds.py +290 -0
- aquascope-0.4.0/aquascope/analysis/__init__.py +69 -0
- aquascope-0.4.0/aquascope/analysis/changepoint.py +696 -0
- aquascope-0.4.0/aquascope/analysis/copulas.py +563 -0
- aquascope-0.4.0/aquascope/analysis/eda.py +214 -0
- aquascope-0.4.0/aquascope/analysis/quality.py +250 -0
- aquascope-0.4.0/aquascope/api.py +588 -0
- aquascope-0.4.0/aquascope/challenges/__init__.py +7 -0
- aquascope-0.4.0/aquascope/challenges/drought.py +194 -0
- aquascope-0.4.0/aquascope/challenges/flood.py +181 -0
- aquascope-0.4.0/aquascope/challenges/quality.py +210 -0
- aquascope-0.4.0/aquascope/cli.py +1156 -0
- aquascope-0.4.0/aquascope/climate/__init__.py +68 -0
- aquascope-0.4.0/aquascope/climate/cmip6.py +282 -0
- aquascope-0.4.0/aquascope/climate/downscaling.py +269 -0
- aquascope-0.4.0/aquascope/climate/indices.py +442 -0
- aquascope-0.4.0/aquascope/climate/scenarios.py +322 -0
- aquascope-0.4.0/aquascope/collectors/__init__.py +45 -0
- aquascope-0.4.0/aquascope/collectors/aquastat.py +136 -0
- aquascope-0.4.0/aquascope/collectors/base.py +45 -0
- aquascope-0.4.0/aquascope/collectors/copernicus.py +152 -0
- aquascope-0.4.0/aquascope/collectors/eu_wfd.py +351 -0
- aquascope-0.4.0/aquascope/collectors/gemstat.py +182 -0
- aquascope-0.4.0/aquascope/collectors/japan_mlit.py +290 -0
- aquascope-0.4.0/aquascope/collectors/korea_wamis.py +305 -0
- aquascope-0.4.0/aquascope/collectors/openmeteo.py +161 -0
- aquascope-0.4.0/aquascope/collectors/sdg6.py +116 -0
- aquascope-0.4.0/aquascope/collectors/taiwan_civil_iot.py +146 -0
- aquascope-0.4.0/aquascope/collectors/taiwan_datagov.py +142 -0
- aquascope-0.4.0/aquascope/collectors/taiwan_moenv.py +154 -0
- aquascope-0.4.0/aquascope/collectors/taiwan_wra.py +134 -0
- aquascope-0.4.0/aquascope/collectors/taiwan_wra_fhy.py +141 -0
- aquascope-0.4.0/aquascope/collectors/taiwan_wra_iot.py +198 -0
- aquascope-0.4.0/aquascope/collectors/usgs.py +157 -0
- aquascope-0.4.0/aquascope/collectors/wapor.py +207 -0
- aquascope-0.4.0/aquascope/collectors/wqp.py +160 -0
- aquascope-0.4.0/aquascope/dashboard/__init__.py +26 -0
- aquascope-0.4.0/aquascope/dashboard/app.py +999 -0
- aquascope-0.4.0/aquascope/groundwater/__init__.py +73 -0
- aquascope-0.4.0/aquascope/groundwater/aquifer.py +388 -0
- aquascope-0.4.0/aquascope/groundwater/grace.py +313 -0
- aquascope-0.4.0/aquascope/groundwater/recharge.py +269 -0
- aquascope-0.4.0/aquascope/groundwater/wells.py +537 -0
- aquascope-0.4.0/aquascope/hydrology/__init__.py +155 -0
- aquascope-0.4.0/aquascope/hydrology/baseflow.py +150 -0
- aquascope-0.4.0/aquascope/hydrology/flood_frequency.py +1597 -0
- aquascope-0.4.0/aquascope/hydrology/flow_duration.py +123 -0
- aquascope-0.4.0/aquascope/hydrology/rating_curve.py +642 -0
- aquascope-0.4.0/aquascope/hydrology/recession.py +227 -0
- aquascope-0.4.0/aquascope/hydrology/signatures.py +494 -0
- aquascope-0.4.0/aquascope/io/__init__.py +38 -0
- aquascope-0.4.0/aquascope/io/hec.py +239 -0
- aquascope-0.4.0/aquascope/io/swmm.py +113 -0
- aquascope-0.4.0/aquascope/io/waterml.py +455 -0
- aquascope-0.4.0/aquascope/models/__init__.py +81 -0
- aquascope-0.4.0/aquascope/models/base.py +130 -0
- aquascope-0.4.0/aquascope/models/bayesian.py +563 -0
- aquascope-0.4.0/aquascope/models/ensemble.py +515 -0
- aquascope-0.4.0/aquascope/models/lstm.py +194 -0
- aquascope-0.4.0/aquascope/models/ml.py +350 -0
- aquascope-0.4.0/aquascope/models/statistical.py +311 -0
- aquascope-0.4.0/aquascope/models/transfer.py +537 -0
- aquascope-0.4.0/aquascope/pipelines/__init__.py +15 -0
- aquascope-0.4.0/aquascope/pipelines/model_builder.py +1570 -0
- aquascope-0.4.0/aquascope/reporting/__init__.py +20 -0
- aquascope-0.4.0/aquascope/reporting/builder.py +634 -0
- aquascope-0.4.0/aquascope/reporting/templates.py +330 -0
- aquascope-0.4.0/aquascope/schemas/__init__.py +0 -0
- aquascope-0.4.0/aquascope/schemas/agriculture.py +89 -0
- aquascope-0.4.0/aquascope/schemas/climate.py +61 -0
- aquascope-0.4.0/aquascope/schemas/groundwater.py +49 -0
- aquascope-0.4.0/aquascope/schemas/water_data.py +122 -0
- aquascope-0.4.0/aquascope/spatial/__init__.py +23 -0
- aquascope-0.4.0/aquascope/spatial/catchment_stats.py +189 -0
- aquascope-0.4.0/aquascope/spatial/dem.py +167 -0
- aquascope-0.4.0/aquascope/spatial/flow.py +173 -0
- aquascope-0.4.0/aquascope/spatial/watershed.py +283 -0
- aquascope-0.4.0/aquascope/utils/__init__.py +0 -0
- aquascope-0.4.0/aquascope/utils/http_client.py +185 -0
- aquascope-0.4.0/aquascope/utils/imports.py +39 -0
- aquascope-0.4.0/aquascope/utils/storage.py +216 -0
- aquascope-0.4.0/aquascope/viz/__init__.py +89 -0
- aquascope-0.4.0/aquascope/viz/diagnostics.py +345 -0
- aquascope-0.4.0/aquascope/viz/hydro.py +306 -0
- aquascope-0.4.0/aquascope/viz/quality.py +335 -0
- aquascope-0.4.0/aquascope/viz/spatial.py +172 -0
- aquascope-0.4.0/aquascope/viz/styles.py +100 -0
- aquascope-0.4.0/aquascope/viz/timeseries.py +348 -0
- aquascope-0.4.0/aquascope.egg-info/PKG-INFO +396 -0
- aquascope-0.4.0/aquascope.egg-info/SOURCES.txt +180 -0
- aquascope-0.4.0/aquascope.egg-info/dependency_links.txt +1 -0
- aquascope-0.4.0/aquascope.egg-info/entry_points.txt +2 -0
- aquascope-0.4.0/aquascope.egg-info/requires.txt +54 -0
- aquascope-0.4.0/aquascope.egg-info/top_level.txt +1 -0
- aquascope-0.4.0/data/.gitkeep +0 -0
- aquascope-0.4.0/data/camels_benchmark/01013500.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/01664000.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/02231000.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/03451500.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/06803500.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/07056000.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/08181500.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/09510200.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/11532500.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/14301000.csv +3651 -0
- aquascope-0.4.0/data/camels_benchmark/README.md +55 -0
- aquascope-0.4.0/data/camels_benchmark/catchments.json +152 -0
- aquascope-0.4.0/data/camels_benchmark/generate_synthetic.py +138 -0
- aquascope-0.4.0/data/fdc.png +0 -0
- aquascope-0.4.0/data/hydrograph.png +0 -0
- aquascope-0.4.0/data/return_periods.png +0 -0
- aquascope-0.4.0/docs/assets/banner.svg +70 -0
- aquascope-0.4.0/docs/assets/logo.svg +38 -0
- aquascope-0.4.0/docs/assets/social-preview.png +0 -0
- aquascope-0.4.0/docs/assets/social-preview.svg +94 -0
- aquascope-0.4.0/docs/data_sources.md +50 -0
- aquascope-0.4.0/docs/faq.md +120 -0
- aquascope-0.4.0/docs/features.md +96 -0
- aquascope-0.4.0/docs/guides/adding_data_source.md +125 -0
- aquascope-0.4.0/docs/guides/adding_methodology.md +110 -0
- aquascope-0.4.0/docs/guides/architecture.md +112 -0
- aquascope-0.4.0/docs/guides/fao_agriculture_plan.md +514 -0
- aquascope-0.4.0/docs/guides/running_pipelines.md +128 -0
- aquascope-0.4.0/docs/integration_guides/qgis_integration.md +98 -0
- aquascope-0.4.0/docs/integration_guides/r_integration.md +122 -0
- aquascope-0.4.0/docs/integration_guides/xarray_integration.md +99 -0
- aquascope-0.4.0/docs/methodology_matrix.md +98 -0
- aquascope-0.4.0/docs/theory.md +668 -0
- aquascope-0.4.0/docs/troubleshooting.md +118 -0
- aquascope-0.4.0/docs/use_cases.md +209 -0
- aquascope-0.4.0/examples/01_collect_single_source.py +56 -0
- aquascope-0.4.0/examples/02_quality_analysis.py +94 -0
- aquascope-0.4.0/examples/03_methodology_recommendations.py +51 -0
- aquascope-0.4.0/examples/04_hydrology_analysis.py +102 -0
- aquascope-0.4.0/examples/05_flood_forecasting.py +78 -0
- aquascope-0.4.0/examples/06_natural_language_agent.py +85 -0
- aquascope-0.4.0/examples/07_visualization_gallery.py +150 -0
- aquascope-0.4.0/examples/08_fao_irrigation_planning.py +64 -0
- aquascope-0.4.0/examples/09_aquastat_benchmark.py +107 -0
- aquascope-0.4.0/examples/10_wapor_productivity.py +117 -0
- aquascope-0.4.0/examples/quickstart.py +78 -0
- aquascope-0.4.0/examples/validation/README.md +59 -0
- aquascope-0.4.0/examples/validation/validate_camels.py +202 -0
- aquascope-0.4.0/examples/validation/validation_results.csv +11 -0
- aquascope-0.4.0/paper.bib +226 -0
- aquascope-0.4.0/paper.md +227 -0
- aquascope-0.4.0/pyproject.toml +155 -0
- aquascope-0.4.0/setup.cfg +4 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Supported funding platforms — see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
|
|
2
|
+
#
|
|
3
|
+
# Uncomment + fill in the lines for any platform you want the "Sponsor" button to link to.
|
|
4
|
+
# Multiple platforms can be enabled at the same time.
|
|
5
|
+
|
|
6
|
+
github: [Rekin226] # Apply at https://github.com/sponsors — button stays hidden until approved
|
|
7
|
+
ko_fi: getaquascope # ko-fi.com/getaquascope
|
|
8
|
+
# buy_me_a_coffee: Rekin226 # buymeacoffee.com/<username>
|
|
9
|
+
# open_collective: aquascope # opencollective.com/<slug> — best for multi-maintainer transparency
|
|
10
|
+
# patreon: Rekin226 # patreon.com/<username>
|
|
11
|
+
# tidelift: pypi/aquascope # for OSS maintainers via Tidelift Subscription
|
|
12
|
+
# liberapay: Rekin226 # liberapay.com/<username>
|
|
13
|
+
# polar: Rekin226 # polar.sh/<username> — pay for issues/features
|
|
14
|
+
# custom: ['https://your-lab-page.example'] # any HTTPS URL (university lab, PayPal.me, Stripe, etc.)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a problem with AquaScope
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
A clear description of the bug.
|
|
11
|
+
|
|
12
|
+
## Steps to Reproduce
|
|
13
|
+
1. ...
|
|
14
|
+
2. ...
|
|
15
|
+
|
|
16
|
+
## Expected Behaviour
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Actual Behaviour
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Environment
|
|
23
|
+
- OS:
|
|
24
|
+
- Python version:
|
|
25
|
+
- AquaScope version:
|
|
26
|
+
- Collector/source involved:
|
|
27
|
+
|
|
28
|
+
## Logs / Traceback
|
|
29
|
+
```
|
|
30
|
+
paste here
|
|
31
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: New Data Source Request
|
|
3
|
+
about: Propose a new water data API or dataset to integrate
|
|
4
|
+
title: "[DATA SOURCE] "
|
|
5
|
+
labels: enhancement, data-source
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Data Source Name
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## API / Download URL
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Data Description
|
|
16
|
+
What kind of water data does it provide? (water quality, hydrology, reservoir, groundwater, etc.)
|
|
17
|
+
|
|
18
|
+
## Geographic Coverage
|
|
19
|
+
(e.g., Japan, Europe, Global)
|
|
20
|
+
|
|
21
|
+
## Update Frequency
|
|
22
|
+
(e.g., real-time, daily, monthly, annual)
|
|
23
|
+
|
|
24
|
+
## API Documentation Link
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Authentication Required?
|
|
28
|
+
- [ ] No (fully open)
|
|
29
|
+
- [ ] Yes — free API key
|
|
30
|
+
- [ ] Yes — institutional access
|
|
31
|
+
|
|
32
|
+
## Sample Response
|
|
33
|
+
```json
|
|
34
|
+
paste a sample here
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Would you like to implement this collector?
|
|
38
|
+
- [ ] Yes, I can submit a PR
|
|
39
|
+
- [ ] No, I am requesting it
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: New Research Methodology
|
|
3
|
+
about: Propose a new methodology to add to the AI recommender knowledge base
|
|
4
|
+
title: "[METHODOLOGY] "
|
|
5
|
+
labels: enhancement, methodology
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Methodology Name
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Category
|
|
13
|
+
(statistical / machine_learning / process_engineering / remote_sensing / hydrological_modelling / policy_analysis)
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
A concise description of the methodology.
|
|
17
|
+
|
|
18
|
+
## Applicable Water Quality Parameters
|
|
19
|
+
(e.g., DO, BOD5, COD, NH3-N, pH, Turbidity)
|
|
20
|
+
|
|
21
|
+
## Data Requirements
|
|
22
|
+
What kind of data does this method need?
|
|
23
|
+
|
|
24
|
+
## Typical Scale
|
|
25
|
+
(lab / pilot / field / regional / global)
|
|
26
|
+
|
|
27
|
+
## Complexity
|
|
28
|
+
(low / medium / high)
|
|
29
|
+
|
|
30
|
+
## Key References
|
|
31
|
+
1.
|
|
32
|
+
2.
|
|
33
|
+
|
|
34
|
+
## Tags
|
|
35
|
+
(e.g., time-series, forecasting, deep-learning, wastewater)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Copilot Instructions for AquaScope
|
|
2
|
+
|
|
3
|
+
AquaScope is a water data aggregation toolkit with AI-powered research methodology recommendations. It collects water-quality and hydrology data from 8 global sources, normalises them into unified Pydantic schemas, and uses an AI engine to recommend and auto-execute research methodologies.
|
|
4
|
+
|
|
5
|
+
## Build, Test, and Lint
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install with all optional dependencies (ML, viz, LLM, dev tools)
|
|
9
|
+
pip install -e ".[dev,all]"
|
|
10
|
+
|
|
11
|
+
# Run all tests
|
|
12
|
+
pytest
|
|
13
|
+
|
|
14
|
+
# Run a single test file
|
|
15
|
+
pytest tests/test_collectors/test_taiwan_moenv.py
|
|
16
|
+
|
|
17
|
+
# Run a single test by name
|
|
18
|
+
pytest -k "test_normalise_produces_correct_records"
|
|
19
|
+
|
|
20
|
+
# Lint
|
|
21
|
+
ruff check aquascope/ tests/
|
|
22
|
+
|
|
23
|
+
# Type check
|
|
24
|
+
mypy aquascope/ --ignore-missing-imports
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
CI runs lint and type-check on Python 3.12; tests on 3.10, 3.11, and 3.12.
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
The data flow is a pipeline:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Collectors (fetch + normalise) → Pydantic Schemas → Analysis (EDA, Quality) → AI Recommender → Pipelines (execute)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- **`collectors/`** — 8 source modules, each subclassing `BaseCollector`. Implement `fetch_raw()` and `normalise()` to return unified schema objects.
|
|
38
|
+
- **`schemas/water_data.py`** — Pydantic models (`WaterQualitySample`, `WaterLevelReading`, `ReservoirStatus`, `SDG6Indicator`) plus a `DataSource` enum.
|
|
39
|
+
- **`analysis/`** — `eda.py` for dataset profiling, `quality.py` for assessment and preprocessing.
|
|
40
|
+
- **`ai_engine/`** — `knowledge_base.py` defines 26 `ResearchMethodology` entries; `recommender.py` scores them against a `DatasetProfile` (rule-based + optional LLM).
|
|
41
|
+
- **`pipelines/model_builder.py`** — 7 executable pipeline functions registered in `_PIPELINE_REGISTRY`, each returning a `PipelineResult`.
|
|
42
|
+
- **`utils/`** — `http_client.py` (CachedHTTPClient with retries and rate limiting), `storage.py` (save to JSON/CSV).
|
|
43
|
+
- **`cli.py`** — 7 argparse commands: `collect`, `recommend`, `eda`, `quality`, `run`, `list-methods`, `list-sources`. Uses lazy imports — modules are imported inside command functions.
|
|
44
|
+
|
|
45
|
+
## Key Conventions
|
|
46
|
+
|
|
47
|
+
- **Python 3.10+** — uses `X | None` union syntax and `list[str]` generics.
|
|
48
|
+
- **`from __future__ import annotations`** at the top of every module.
|
|
49
|
+
- **Pydantic for data schemas only** (`schemas/`); internal structures use `@dataclass` (`DatasetProfile`, `Recommendation`, `PipelineResult`, `QualityReport`, `EDAReport`).
|
|
50
|
+
- **Google-style docstrings** with `Parameters`, `Returns`, `Raises` sections.
|
|
51
|
+
- **Full type hints** on all public functions.
|
|
52
|
+
- **One logger per module**: `logger = logging.getLogger(__name__)`.
|
|
53
|
+
- **Ruff** enforces style — line length is 120; rules: E, F, I, N, W, UP.
|
|
54
|
+
- **Tests mirror the package structure** (`tests/test_<module>/`). No `conftest.py`; tests are self-contained using `setup_method` and inline helper functions.
|
|
55
|
+
|
|
56
|
+
## Adding a New Data Collector
|
|
57
|
+
|
|
58
|
+
1. Create `aquascope/collectors/<source>.py` — subclass `BaseCollector`, implement `fetch_raw()` and `normalise()`.
|
|
59
|
+
2. Add an entry to the `DataSource` enum in `schemas/water_data.py`.
|
|
60
|
+
3. Export the class from `aquascope/collectors/__init__.py`.
|
|
61
|
+
4. Register it in `cli.py`'s `cmd_collect` function.
|
|
62
|
+
5. Add tests in `tests/test_collectors/`.
|
|
63
|
+
|
|
64
|
+
## Adding a New Methodology / Pipeline
|
|
65
|
+
|
|
66
|
+
- **Methodology only**: Add a `ResearchMethodology` instance to `METHODOLOGIES` in `ai_engine/knowledge_base.py`.
|
|
67
|
+
- **Executable pipeline**: Add a `run_<method_id>(df, config=None) -> PipelineResult` function in `pipelines/model_builder.py` and register it in `_PIPELINE_REGISTRY`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
cache: pip
|
|
20
|
+
- run: pip install -e ".[dev,all]"
|
|
21
|
+
- run: ruff check aquascope/ tests/
|
|
22
|
+
- name: Type check (informational — does not fail build)
|
|
23
|
+
run: mypy aquascope/ --ignore-missing-imports
|
|
24
|
+
continue-on-error: true
|
|
25
|
+
|
|
26
|
+
test:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
strategy:
|
|
29
|
+
matrix:
|
|
30
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: ${{ matrix.python-version }}
|
|
36
|
+
cache: pip
|
|
37
|
+
- run: pip install -e ".[dev,all]"
|
|
38
|
+
- run: pytest --cov=aquascope --cov-report=term-missing --cov-report=xml
|
|
39
|
+
- name: Upload coverage artifact
|
|
40
|
+
if: matrix.python-version == '3.12'
|
|
41
|
+
uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: coverage-report
|
|
44
|
+
path: coverage.xml
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- name: Install build tools
|
|
20
|
+
run: pip install build
|
|
21
|
+
- name: Build package
|
|
22
|
+
run: python -m build
|
|
23
|
+
- name: Publish to PyPI
|
|
24
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.vscode/
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
|
|
21
|
+
# Data cache (local only)
|
|
22
|
+
data/cache/
|
|
23
|
+
data/raw/
|
|
24
|
+
data/processed/
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.coverage
|
|
33
|
+
htmlcov/
|
|
34
|
+
|
|
35
|
+
# mypy
|
|
36
|
+
.mypy_cache/
|
|
37
|
+
|
|
38
|
+
# Environment
|
|
39
|
+
.env
|
|
40
|
+
.env.local
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.5.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
args: ['--maxkb=500']
|
|
10
|
+
- id: check-merge-conflict
|
|
11
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
12
|
+
rev: v0.3.0
|
|
13
|
+
hooks:
|
|
14
|
+
- id: ruff
|
|
15
|
+
args: [--fix]
|
|
16
|
+
- id: ruff-format
|
|
17
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
18
|
+
rev: v1.8.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: mypy
|
|
21
|
+
additional_dependencies: [pydantic>=2.0]
|
|
22
|
+
args: [--ignore-missing-imports]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to AquaScope are documented here.
|
|
4
|
+
|
|
5
|
+
## [0.4.0] — 2026-04-01
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Groundwater module** (`aquascope/groundwater/`) — GRACE satellite data integration, well monitoring, recharge estimation, and aquifer hydraulics analysis
|
|
9
|
+
- **Climate projections module** (`aquascope/climate/`) — CMIP6 scenario analysis, statistical downscaling, Palmer Drought Severity Index (PDSI), and climate impact assessment
|
|
10
|
+
- **JOSS paper** — Added `paper.md` and `paper.bib` for Journal of Open Source Software submission
|
|
11
|
+
- **EU Water Framework Directive collector** (in progress) — European water body status and compliance data
|
|
12
|
+
- **Japan MLIT collector** (in progress) — Japanese river and water quality monitoring data
|
|
13
|
+
- **Korea WAMIS collector** (in progress) — Korean water resources management information
|
|
14
|
+
- **15 data source collectors** total across global water monitoring networks
|
|
15
|
+
- **New CLI commands**: `groundwater`, `climate` for the new modules
|
|
16
|
+
- **New convenience API functions** in `aquascope.api` for streamlined programmatic access
|
|
17
|
+
- **Agricultural water module** (`aquascope/agri/`) — crop water demand, ET₀ calculation, water balance, productivity benchmarking, and irrigation planning
|
|
18
|
+
- **Alerts module** (`aquascope/alerts/`) — threshold-based monitoring, anomaly checking, and notification system
|
|
19
|
+
- **Advanced analysis** — changepoint detection, copula modelling
|
|
20
|
+
- **Hydrological modelling** (`aquascope/hydrology/`) — rainfall-runoff, routing, flood frequency, baseflow separation, CAMELS benchmarking
|
|
21
|
+
- **AI agent and planner** — multi-step research planning and autonomous execution
|
|
22
|
+
- **685+ tests** across all modules
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Bumped version to 0.4.0
|
|
26
|
+
- Expanded optional dependency groups: `forecast`, `copernicus`, `scientific`, `dashboard`, `spatial`
|
|
27
|
+
- Added Python 3.13 classifier
|
|
28
|
+
- GitHub Actions publish workflow for PyPI releases via trusted publishing
|
|
29
|
+
|
|
30
|
+
## [0.2.0] — 2026-03-12
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- **Analysis module** — Automated EDA (`aquascope eda`) with per-parameter statistics, outlier detection (IQR), correlation matrix, and completeness scoring
|
|
34
|
+
- **Data quality pipeline** — Assessment + preprocessing (`aquascope quality --fix`) with duplicate removal, imputation, outlier filtering, normalization, and daily resampling
|
|
35
|
+
- **7 model pipelines** — Auto-execute research methodologies via `aquascope run`:
|
|
36
|
+
- Mann-Kendall trend analysis
|
|
37
|
+
- Taiwan River Pollution Index (RPI)
|
|
38
|
+
- PCA + K-Means clustering
|
|
39
|
+
- Random Forest classification
|
|
40
|
+
- XGBoost regression
|
|
41
|
+
- ARIMA time-series forecasting
|
|
42
|
+
- Pearson correlation analysis
|
|
43
|
+
- **3 new data collectors**:
|
|
44
|
+
- GEMStat (UNEP global freshwater quality via Zenodo)
|
|
45
|
+
- Taiwan Civil IoT (real-time SensorThings API)
|
|
46
|
+
- US Water Quality Portal (USGS + EPA + 400 agencies)
|
|
47
|
+
- **13 new research methodologies** in the knowledge base (26 total), including: ARIMA forecasting, Transformer-based prediction, SWMM/QUAL2K process models, kriging spatial interpolation, isotope hydrology, paired watershed design, and more
|
|
48
|
+
- **5 new CLI commands**: `eda`, `quality`, `run`, `list-methods`, `list-sources`
|
|
49
|
+
- **Documentation guides**: Architecture, Adding a Data Source, Adding a Methodology, Running Pipelines
|
|
50
|
+
- **Jupyter quickstart tutorial** (`notebooks/01_quickstart_tutorial.ipynb`)
|
|
51
|
+
- **Comprehensive test suite** — 69 tests covering analysis, pipelines, collectors, AI engine
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
- Bumped version to 0.2.0 (Beta status)
|
|
55
|
+
- `pandas` and `numpy` are now core dependencies (not optional)
|
|
56
|
+
- Updated `collect` CLI to support all 8 data sources
|
|
57
|
+
- Expanded `pyproject.toml` with `viz`, `ml` optional dependency groups
|
|
58
|
+
|
|
59
|
+
## [0.1.0] — 2026-03-10
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
- Initial release
|
|
63
|
+
- 5 data collectors: Taiwan MOENV, Taiwan WRA (level + reservoir), USGS, UN SDG 6
|
|
64
|
+
- Unified Pydantic schemas for water data
|
|
65
|
+
- AI methodology recommender with 13 built-in methodologies
|
|
66
|
+
- Rule-based scoring + optional LLM enhancement
|
|
67
|
+
- CLI with `collect` and `recommend` commands
|
|
68
|
+
- HTTP client with caching and rate limiting
|
|
69
|
+
- 12 tests, ruff lint, GitHub Actions CI/CD
|
|
70
|
+
- Contributing guide, MIT license
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Contributing to AquaScope
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to AquaScope! This project aims to be a community-driven resource for water researchers worldwide. Whether you are a hydrologist, environmental engineer, data scientist, or student — your contributions are welcome.
|
|
4
|
+
|
|
5
|
+
## Ways to Contribute
|
|
6
|
+
|
|
7
|
+
### 1. Add a New Data Source Collector
|
|
8
|
+
|
|
9
|
+
We want to cover water APIs from every country. To add a new collector:
|
|
10
|
+
|
|
11
|
+
1. Create a new file in `aquascope/collectors/` (e.g., `japan_mlit.py`).
|
|
12
|
+
2. Subclass `BaseCollector` and implement `fetch_raw()` and `normalise()`.
|
|
13
|
+
3. Map raw API fields to our unified schemas in `aquascope/schemas/water_data.py`.
|
|
14
|
+
4. Add tests in `tests/test_collectors/`.
|
|
15
|
+
5. Document the data source in your module docstring (API URL, required keys, datasets).
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from aquascope.collectors.base import BaseCollector
|
|
19
|
+
from aquascope.schemas.water_data import WaterQualitySample, DataSource
|
|
20
|
+
|
|
21
|
+
class JapanMLITCollector(BaseCollector):
|
|
22
|
+
name = "japan_mlit"
|
|
23
|
+
|
|
24
|
+
def fetch_raw(self, **kwargs):
|
|
25
|
+
return self.client.get_json("https://api.example.jp/water/v1/quality")
|
|
26
|
+
|
|
27
|
+
def normalise(self, raw):
|
|
28
|
+
# Convert raw records into WaterQualitySample instances
|
|
29
|
+
...
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Add a Research Methodology
|
|
33
|
+
|
|
34
|
+
To expand the AI recommender's knowledge base:
|
|
35
|
+
|
|
36
|
+
1. Open `aquascope/ai_engine/knowledge_base.py`.
|
|
37
|
+
2. Add a new `ResearchMethodology` entry to the `METHODOLOGIES` list.
|
|
38
|
+
3. Include: description, applicable parameters, data requirements, scale, complexity, references, and tags.
|
|
39
|
+
4. Add a test in `tests/test_ai_engine/` to verify your methodology is findable.
|
|
40
|
+
|
|
41
|
+
Or simply open an issue using the **New Research Methodology** template.
|
|
42
|
+
|
|
43
|
+
### 3. Improve the AI Recommender
|
|
44
|
+
|
|
45
|
+
The scoring algorithm in `aquascope/ai_engine/recommender.py` can be improved:
|
|
46
|
+
|
|
47
|
+
- Better heuristics for data sufficiency scoring
|
|
48
|
+
- Additional scoring dimensions (e.g., data frequency, parameter correlations)
|
|
49
|
+
- LLM prompt improvements for the enhanced mode
|
|
50
|
+
|
|
51
|
+
### 4. Add Notebooks / Tutorials
|
|
52
|
+
|
|
53
|
+
Example Jupyter notebooks in `notebooks/` help new users get started. Contributions in English, French, Chinese, or any language are appreciated.
|
|
54
|
+
|
|
55
|
+
### 5. Fix Bugs / Improve Docs
|
|
56
|
+
|
|
57
|
+
Bug fixes and documentation improvements are always welcome.
|
|
58
|
+
|
|
59
|
+
## Development Setup
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Clone the repo
|
|
63
|
+
git clone https://github.com/Rekin226/aquascope.git
|
|
64
|
+
cd aquascope
|
|
65
|
+
|
|
66
|
+
# Create a virtual environment
|
|
67
|
+
python -m venv .venv
|
|
68
|
+
source .venv/bin/activate # Linux/macOS
|
|
69
|
+
# .venv\Scripts\activate # Windows
|
|
70
|
+
|
|
71
|
+
# Install in editable mode with dev dependencies
|
|
72
|
+
pip install -e ".[dev,all]"
|
|
73
|
+
|
|
74
|
+
# Run tests
|
|
75
|
+
pytest
|
|
76
|
+
|
|
77
|
+
# Run linter
|
|
78
|
+
ruff check aquascope/ tests/
|
|
79
|
+
|
|
80
|
+
# Type checking
|
|
81
|
+
mypy aquascope/ --ignore-missing-imports
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Pull Request Guidelines
|
|
85
|
+
|
|
86
|
+
1. **Fork** the repository and create a feature branch.
|
|
87
|
+
2. Write tests for new functionality.
|
|
88
|
+
3. Ensure `pytest`, `ruff check`, and `mypy` pass.
|
|
89
|
+
4. Keep commits atomic and write clear commit messages.
|
|
90
|
+
5. Update documentation if you change public APIs.
|
|
91
|
+
6. Reference related issues in your PR description.
|
|
92
|
+
|
|
93
|
+
## Code Style
|
|
94
|
+
|
|
95
|
+
- Follow PEP 8; enforced by `ruff`.
|
|
96
|
+
- Use type hints for all public functions.
|
|
97
|
+
- Write docstrings (Google or NumPy style).
|
|
98
|
+
- Keep modules focused — one collector per file, one concept per module.
|
|
99
|
+
|
|
100
|
+
## Reporting Issues
|
|
101
|
+
|
|
102
|
+
- **Bugs**: Use the Bug Report template.
|
|
103
|
+
- **New data sources**: Use the New Data Source template.
|
|
104
|
+
- **New methodologies**: Use the New Research Methodology template.
|
|
105
|
+
|
|
106
|
+
## Code of Conduct
|
|
107
|
+
|
|
108
|
+
Be respectful, inclusive, and constructive. We follow the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
aquascope-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AquaScope Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CONTRIBUTING.md
|
|
5
|
+
include paper.md
|
|
6
|
+
include paper.bib
|
|
7
|
+
recursive-include aquascope *.py
|
|
8
|
+
recursive-include data *.json *.csv *.md
|
|
9
|
+
recursive-include docs *.md *.rst
|
|
10
|
+
recursive-include examples *.py *.md
|
|
11
|
+
prune tests
|
|
12
|
+
prune notebooks
|
|
13
|
+
prune venv
|