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
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.1.2

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.1.2
File Size Uploaded
geoaquacrop_simulate-0.1.2.tar.gz 56.2 kB Details

Built distribution (wheel)

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

Total release size: 101.6 kB

Release files / geoaquacrop_simulate-0.1.2.tar.gz

Download URL geoaquacrop_simulate-0.1.2.tar.gz
Size 56.2 kB
Tags Source
SHA-256 checksum
How to use checksums
afd72ee5416c7dacda90dcecbbac4ee87ddaba2908a03e32b8446c45a9f21a94
BLAKE2b-256 checksum
How to use checksums
b6317d441f3a20e18377b3480e59edb8554aad09fca11f7c3aa034af390366ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

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

Download URL geoaquacrop_simulate-0.1.2-py3-none-any.whl
Size 45.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1503673ce7a3e553b7f07199f1e531f5862af43ed19f6b46749a8ae595c10188
BLAKE2b-256 checksum
How to use checksums
5de2a20d681683c1664e954b3a5bf677220881df9370fd53415f665894f93f67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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