Skip to main content

geoaquacrop_simulate

Gridded AquaCrop-OSPy simulation engine for the GeoAquaCrop toolchain.

PyPI Python Docs Tests Licence

Install

pip install geoaquacrop_simulate

Or install the whole toolchain in one go:

pip install geoaquacrop

Optional extras:

Extra Brings in For
correction geopandas, matplotlib Yield correction and comparison figures
docs sphinx, furo Building the documentation locally
dev pytest, pytest-cov Running the test suite
pip install "geoaquacrop_simulate[correction]"

Requires Python 3.11+ and the harmonised input datasets produced by geoaquacrop_preprocess.

Overview

geoaquacrop_simulate runs AquaCrop-OSPy over large regions in gridded format. It takes the harmonised input datasets produced by geoaquacrop_preprocess, runs an independent AquaCrop-OSPy simulation for every grid cell in parallel, and writes per-cell seasonal and daily results. Those outputs can then be explored with geoaquacrop_visualize.

It is the middle stage of the GeoAquaCrop toolchain:

geoaquacrop_preprocess  ->  geoaquacrop_simulate  ->  geoaquacrop_visualize
(download & harmonise)      (simulate & correct)      (explore results)
Stage Description
Input validation Checks that climate, soil, crop calendar and crop area files exist, share a grid, and cover the requested period; derives the simulated cells from the crop area mask
Per-cell simulation Builds an AquaCrop Soil, Crop and weather series per cell, adjusts crop phenology to the local growing season, runs to termination
Parallel execution Distributes cells over worker processes with a progress bar; per-cell failures are logged without stopping the run
Derived outputs Adds seasonal water-balance metrics via a pluggable enricher registry
Yield correction Optionally bias-corrects or calibrates yields against an observational reference, per year, at the reference's native support

Quick start

import geoaquacrop_simulate as simulate

summary_file, daily_file = simulate.run(
    data_path='/path/to/geoaquacrop_preprocess/processed',
    start_date='2008/01/01',
    end_date='2010/12/31',
    crop='Maize',
    irrigation='rainfed',          # 'rainfed' | 'irrigated'
    output_dir='outputs',
)

data_path fills the four input paths at once. Set weather_path, soil_path, pheno_path and spam_path individually if they live in different places.

The same call through the unified toolchain façade:

import geoaquacrop as gac

summary_file, daily_file = gac.simulate.run(data_path='...', crop='Maize')

To see every available setting:

import geoaquacrop_simulate as simulate

print(simulate.example_config())        # the full settings dictionary
print(simulate.input_requirements())    # the input files each stage expects

This works from a script, a notebook or an IDE console (Spyder, Jupyter).

Supported crop types

Barley, Cassava, Cotton, Dry Bean, Maize, Paddy Rice (seasons 1 & 2), Potato, Sorghum, Soybean, Sugar Beet, Sugar Cane, Sunflower, Wheat (summer & winter).

Output files

Written to <output_dir>/:

File Contents
summary_results_<timestamp>.pkl One seasonal summary row per cell per season: yields, irrigation, harvest date, plus derived metrics
daily_results_<timestamp>.pkl Daily water-balance and crop-growth series per cell; skipped with save_daily=False
logs/aquacrop_simulation_<timestamp>.log Run log, including per-cell failures
yield_scaled.nc / yield_calibrated.nc Corrected yield grids, if a correction was configured

Load them back with simulate.load_results().

Yield correction

Optional. Brings modelled yields into line with an observational reference, per year, aggregating the model up to the reference's native support (counties, provinces, districts) rather than rasterising the observations.

First build the reference from any boundary file and any table of yields per region per year:

simulate.build_reference(
    regions='provinces.geojson', region_id='NAME_LATN',
    table='wheat_yields.csv', table_id='region',
    year_col='year', value_col='yield_t_ha',
    out='reference.geojson',
)

Then pass a correction block to run():

correction = {
    'method': 'scale',                    # None | 'scale' | 'calibrate'
    'reference_path': 'reference.geojson',
    'scale_mode': 'local',                # 'global' | 'local'
    'lever': 'canopy',                    # calibrate: 'canopy' (CCx) | 'biomass' (WP)
    'reuse_results': 'latest',            # correct an existing run, no re-simulation
}

See the yield correction guide for what each mode does and how to interpret the results.

Documentation

Full documentation: https://geoaquacrop-simulate.readthedocs.io/en/latest/

Development

To work on the package itself:

git clone https://github.com/aquacropos/geoaquacrop_simulate
cd geoaquacrop_simulate
conda create -n geoaquacrop python=3.11
conda activate geoaquacrop
python -m pip install -e ".[dev,correction]"

Run the tests:

python -m pytest -q

From a checkout you can also set the configuration dictionary at the top of main() in src/geoaquacrop_simulate/run_aquacrop.py and run the module directly:

python -m geoaquacrop_simulate.run_aquacrop

Do not execute module files directly — a module run as a script has no package context and its relative imports fail.

Licence

Apache 2.0 — see LICENSE.

Metadata

Release files for geoaquacrop-simulate 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geoaquacrop-simulate 0.2.0
File Size Uploaded Provenance Actions
geoaquacrop_simulate-0.2.0.tar.gz 61.4 kB With provenance Details for geoaquacrop_simulate-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geoaquacrop-simulate 0.2.0
File Interpreter ABI Platform Actions
geoaquacrop_simulate-0.2.0-py3-none-any.whl Python 3 none any Details for geoaquacrop_simulate-0.2.0-py3-none-any.whl

Total release size: 109.8 kB

Release files / geoaquacrop_simulate-0.2.0.tar.gz

Download URL geoaquacrop_simulate-0.2.0.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3687bb81a937fef648e63de570497da1459ef86d31de99fc4ccd147f9204f3d3
BLAKE2b-256 checksum
How to use checksums
d2d2a50e4acbc957f26cab5e0f78ccb5efa4612ce895ca1e1e2c8869ae8ec683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / geoaquacrop_simulate-0.2.0-py3-none-any.whl

Download URL geoaquacrop_simulate-0.2.0-py3-none-any.whl
Size 48.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d700562a853026156a1118a94f893bb15735e355266f7140ac59cda936287f00
BLAKE2b-256 checksum
How to use checksums
2d978c9baf449542b84d84eaea26ecc5c0707bb905905a63c6be3fdd317d9e47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for geoaquacrop-simulate 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for geoaquacrop_simulate-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page