Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,77 +1,145 @@
|
|
| 1 |
# Predictive Irrigation Models
|
| 2 |
|
| 3 |
-
This repository contains
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
```
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
│ ├── aquacrop_preparation_pipeline.py
|
| 16 |
-
│ ├── data_collection_pipeline.py
|
| 17 |
-
│ ├── aquacrop_preparation_pipeline.py
|
| 18 |
-
│ ├── demo_run.py
|
| 19 |
-
│ ├── model_preparation_pipeline.py
|
| 20 |
-
│ ├── preprocessing_pipeline.py
|
| 21 |
-
│ ├── resample_impute_pipeline.py
|
| 22 |
-
│ ├── soilcast_pipeline.py
|
| 23 |
-
│ ├── xgcast_pipeline.py
|
| 24 |
-
│ └── xgcast_run.py
|
| 25 |
-
├── data/
|
| 26 |
-
│ ├── 03_primary/
|
| 27 |
-
│ ├── 04_model_input/
|
| 28 |
-
│ ├── 05_aquacrop_input/
|
| 29 |
-
│ ├── 05_xgcast_input/
|
| 30 |
-
│ ├── 06_aquacrop_output/
|
| 31 |
-
│ └── 06_xgcast_output/
|
| 32 |
-
├── tools/
|
| 33 |
-
│ └── ...
|
| 34 |
-
└── README.md
|
| 35 |
```
|
| 36 |
|
| 37 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
- **Sensor & Weather Data Integration:** Reads and merges raw sensor and weather data for multiple consortia.
|
| 41 |
-
- **Soil, Crop, and Remote Sensing Data:** Integrates geospatial and tabular data sources.
|
| 42 |
-
- **Automated Testing:** Prefect tasks and flows for validating preprocessing results.
|
| 43 |
-
- **Artifact Logging:** Data summary artifacts for monitoring pipeline outputs.
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
##
|
| 48 |
|
| 49 |
-
|
| 50 |
-
- [Prefect](https://www.prefect.io/)
|
| 51 |
-
- uv
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
-
Edit `config/params.yml` to specify consortia names, data folders, and other parameters.
|
| 58 |
|
| 59 |
-
|
|
|
|
| 60 |
|
| 61 |
-
|
| 62 |
|
| 63 |
-
``
|
| 64 |
|
| 65 |
-
##
|
| 66 |
-
From the project root, run:
|
| 67 |
|
| 68 |
-
``
|
|
|
|
| 69 |
|
| 70 |
-
##
|
| 71 |
-
Feel free to open issues or submit pull requests for improvements or bug fixes.
|
| 72 |
|
| 73 |
-
|
| 74 |
-
MIT License
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
| 1 |
# Predictive Irrigation Models
|
| 2 |
|
| 3 |
+
This repository contains end-to-end pipelines for predictive irrigation, combining:
|
| 4 |
|
| 5 |
+
- field sensor measurements (tensiometers and related sensors),
|
| 6 |
+
- irrigation logs,
|
| 7 |
+
- weather observations and generated forecasts,
|
| 8 |
+
- optional crop/soil metadata,
|
| 9 |
+
- optional satellite-derived vegetation indices,
|
| 10 |
+
- and two modeling tracks: XGBoost-based forecasting and AquaCrop-based simulation.
|
| 11 |
+
|
| 12 |
+
The implementation is orchestrated with Prefect flows in the `pipelines/` folder and configured through YAML files in `config/`.
|
| 13 |
+
|
| 14 |
+
## What Is In This Repository
|
| 15 |
+
|
| 16 |
+
- `main.py`: runs the full workflow in sequence.
|
| 17 |
+
- `pipelines/`: data preparation and model flows.
|
| 18 |
+
- `tools/`: weather, geospatial, authentication, and Copernicus helpers.
|
| 19 |
+
- `aquacrop/`: local AquaCrop engine implementation used by the AquaCrop pipeline.
|
| 20 |
+
- `config/`: runtime configuration (plus some private config files expected at runtime, see below).
|
| 21 |
+
- `notebooks/notebook_demo.ipynb`: interactive demo notebook.
|
| 22 |
+
|
| 23 |
+
## Pipeline Overview
|
| 24 |
+
|
| 25 |
+
The default execution path in `main.py` is:
|
| 26 |
+
|
| 27 |
+
1. `model_preparation_pipeline()`
|
| 28 |
+
2. `aquacrop_preparation_pipeline()`
|
| 29 |
+
3. `xgcast_preparation_pipeline()`
|
| 30 |
+
4. `aquacrop_pipeline()`
|
| 31 |
+
5. `xgcast_model_pipeline()`
|
| 32 |
+
|
| 33 |
+
Main data flow (paths are created/used by the pipelines):
|
| 34 |
+
|
| 35 |
+
- `data/03_primary/`: primary prepared inputs (sensor, weather, irrigation, locations, crop, soil, satellite).
|
| 36 |
+
- `data/04_model_input/`: merged model-ready tables (`full_table_<consortium>.parquet`).
|
| 37 |
+
- `data/05_xgcast_input/`: normalized training/validation/test artifacts for XGBoost.
|
| 38 |
+
- `data/05_aquacrop_input/<consortium>/<sensor>/`: weather/irrigation/settings for AquaCrop runs.
|
| 39 |
+
- `data/06_xgcast_output/`: trained XGBoost model files.
|
| 40 |
+
- `data/06_aquacrop_output/<consortium>/<sensor>/`: AquaCrop simulation outputs.
|
| 41 |
+
|
| 42 |
+
## Requirements
|
| 43 |
+
|
| 44 |
+
- Python 3.11+
|
| 45 |
+
- `uv` (recommended for environment/dependency management)
|
| 46 |
+
|
| 47 |
+
Project dependencies are declared in `pyproject.toml`.
|
| 48 |
+
|
| 49 |
+
## Setup
|
| 50 |
+
|
| 51 |
+
From the repository root:
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
uv sync
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
If you prefer running with the virtual environment directly:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
uv run python -m main
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Configuration
|
| 64 |
+
|
| 65 |
+
Base configuration files committed in this repo:
|
| 66 |
+
|
| 67 |
+
- `config/params.yml`
|
| 68 |
+
- `config/aquacrop_params.yml`
|
| 69 |
+
- `config/xgcast_params.yml`
|
| 70 |
+
- `config/fieldsensor_irrigator_mapping_anonym.yaml`
|
| 71 |
+
- `config/request_scripts/*.js`
|
| 72 |
+
|
| 73 |
+
### Important: private/non-versioned configs
|
| 74 |
+
|
| 75 |
+
Some optional pipeline branches (especially satellite download/auth flows) expect private files that are intentionally gitignored, for example:
|
| 76 |
+
|
| 77 |
+
- `config/copernicus_oauth_config.json`
|
| 78 |
+
- `config/keycloak_config.json`
|
| 79 |
+
- `config/pre_anonym_params.yml`
|
| 80 |
+
- potentially consortium-specific field mapping files (for field-level satellite aggregation)
|
| 81 |
+
|
| 82 |
+
If those files are missing, full satellite acquisition workflows will not run.
|
| 83 |
+
|
| 84 |
+
## Running The Pipelines
|
| 85 |
+
|
| 86 |
+
### Full run (same sequence as `main.py`)
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
uv run python -m main
|
| 90 |
```
|
| 91 |
+
|
| 92 |
+
### Run individual flows
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
uv run python -m pipelines.model_preparation_pipeline
|
| 96 |
+
uv run python -m pipelines.aquacrop_preparation_pipeline
|
| 97 |
+
uv run python -m pipelines.aquacrop_pipeline
|
| 98 |
+
uv run python -m pipelines.xgcast_pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
```
|
| 100 |
|
| 101 |
+
## Expected Input Artifacts
|
| 102 |
+
|
| 103 |
+
At minimum, model preparation expects consortium-scoped files such as:
|
| 104 |
+
|
| 105 |
+
- `data/03_primary/field_sensor_data_<consortium>.parquet`
|
| 106 |
+
- `data/03_primary/irrigation_data_<consortium>.parquet`
|
| 107 |
+
- `data/03_primary/locations_ids_<consortium>.parquet`
|
| 108 |
+
- `data/03_primary/historical_weather_data_<consortium>.parquet`
|
| 109 |
+
- `data/03_primary/forecasted_weather_data_<consortium>.parquet`
|
| 110 |
|
| 111 |
+
Optional inputs are controlled through `data_availability` in `config/params.yml`:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
- weather sensor data,
|
| 114 |
+
- crop type data,
|
| 115 |
+
- soil type data,
|
| 116 |
+
- remote sensing data.
|
| 117 |
|
| 118 |
+
## Models
|
| 119 |
|
| 120 |
+
### XGCast (XGBoost)
|
|
|
|
|
|
|
| 121 |
|
| 122 |
+
- training configuration in `config/xgcast_params.yml`.
|
| 123 |
+
- outputs model file `data/06_xgcast_output/xgcast_<consortium>.json`.
|
| 124 |
|
| 125 |
+
### AquaCrop
|
|
|
|
| 126 |
|
| 127 |
+
- uses local `aquacrop/` package implementation.
|
| 128 |
+
- simulation outputs include water flux, water storage, crop growth, and summary tables under `data/06_aquacrop_output/`.
|
| 129 |
|
| 130 |
+
## Notebook Demo
|
| 131 |
|
| 132 |
+
Open `notebooks/notebook_demo.ipynb` for an interactive walkthrough using consortium/sensor examples and model outputs.
|
| 133 |
|
| 134 |
+
## Known Caveats
|
|
|
|
| 135 |
|
| 136 |
+
- `data/` is gitignored; expected datasets are not included in this repository.
|
| 137 |
+
- several remote-sensing paths depend on private configuration and credentials.
|
| 138 |
|
| 139 |
+
## Contributing
|
|
|
|
| 140 |
|
| 141 |
+
Contributions are welcome. Open an issue or submit a pull request with:
|
|
|
|
| 142 |
|
| 143 |
+
- the problem statement,
|
| 144 |
+
- reproducible steps,
|
| 145 |
+
- and any data/config assumptions required to test the change.
|