Skip to main content

geoaquacrop_preprocess

Automated data download and preprocessing pipeline for running AquaCrop-OSPy over large regions in gridded format.

PyPI Python Docs Tests Licence

Install

pip install geoaquacrop_preprocess

Or install the whole toolchain in one go:

pip install geoaquacrop

Requires Python 3.11+. For past climate data (AgERA5) you also need a free Copernicus CDS account and your personal API token (see Prerequisites).

Overview

This package is the data preparation stage of GeoAquaCrop, the umbrella repository that combines preprocessing, simulation and visualisation. GeoAquaCrop is distributed as a Python package (pip install geoaquacrop), where this stage is available as geoaquacrop.preprocess.

geoaquacrop_preprocess prepares all spatial input datasets required to run the AquaCrop-OSPy crop water productivity model over large regions (e.g. river basins, countries) in a gridded setup. Given a polygon defining the area of interest and a time period, the pipeline automatically downloads, reprojects, and harmonises the following datasets onto a common output grid:

Dataset Variables Source Native resolution
Climate (past) Min/max temperature, precipitation, reference ET AgERA5 via Copernicus CDS 0.1°, daily
Climate (future) Min/max temperature, precipitation, reference ET NASA NEX-GDDP-CMIP6 0.25°, daily
Soil Clay, sand, silt, soil organic matter (6 depth layers) ISRIC SoilGrids 250 m
Crop calendar Planting day of year, growing season length GGCMI phase 3 v1.01 0.5°
Crop areas Physical area by crop and irrigation type SPAM 2010/2020 ~10 km

The climate data source is selected automatically:

  • Past climate (1979 to last complete year) → AgERA5 reanalysis via the Copernicus CDS API
  • Future climate (any year ≥ current year, or before 1979) → NASA NEX-GDDP-CMIP6 projections

All outputs are written as compressed NetCDF files on a shared spatial grid at the user-specified resolution.

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)

Prerequisites

Quick start

Option A — edit and run the main script

This option needs a source checkout (see Development).

Open src/geoaquacrop_preprocess/preprocess_main.py, set the input arguments at the top of the file, and run:

conda activate geoaquacrop
python -m geoaquacrop_preprocess.preprocess_main

Key input arguments:

workingdirectory = '/path/to/your/output/directory'
domain_path      = '/path/to/your/domain.geojson'   # polygon in EPSG:4326
start_year       = 2020
end_year         = 2022
cell_resolution  = 0.05   # output grid size in degrees (~3 arcmin)
api_token        = 'your-copernicus-api-token'       # required for AgERA5 only

For future climate projections (NASA NEX-GDDP-CMIP6), also configure:

nasanex_model    = 'GFDL-CM4'
nasanex_scenario = 'ssp245'   # ssp126 | ssp245 | ssp370 | ssp585
nasanex_ensemble = 'r1i1p1f1'

Option B — Python API

from geoaquacrop_preprocess import run

run(
    domain_shape_path='domain.geojson',
    start_year=2020,
    end_year=2022,
    api_token='your-api-token',       # required for AgERA5 only
    cell_resolution=0.05,
    workingdirectory='/path/to/output',
)

Individual steps can also be run directly, without needing to build a preprocess list:

from geoaquacrop_preprocess import soil, crop_area, crop_calendar, weather

soil(domain_shape_path='domain.geojson', start_year=2020, end_year=2022,
     workingdirectory='/path/to/output')

Output files

Processed datasets are written to <workingdirectory>/processed/:

File Contents
soil_<depth>.nc Clay, sand, silt, and soil organic matter for one depth layer
spam<year>_physical_area.nc Crop physical area [ha] per type and irrigation mode
cropcalendar.nc Planting DOY and growing season length per crop and irrigation mode
MinTemp<years>.nc Daily minimum air temperature [°C]
MaxTemp<years>.nc Daily maximum air temperature [°C]
Precipitation<years>.nc Daily precipitation [mm/day]
ReferenceET<years>.nc Daily FAO-56 Penman-Monteith reference ET0 [mm/day]

Raw downloaded files are kept in <workingdirectory>/rawdata/ as resumable checkpoints and can be deleted once processing is complete.

Configuration reference

Parameter Default Description
cell_resolution 0.05 Output grid cell size in decimal degrees
preprocess all steps Steps to run: 'soil', 'crop_areas', 'crop_calendar', 'climate'
nasanex_model 'GFDL-CM4' CMIP6 model name (see catalog)
nasanex_scenario 'ssp245' SSP scenario for years >= 2015
nasanex_ensemble 'r1i1p1f1' Ensemble member identifier

Obtaining a Copernicus CDS API token

An API token is required only when processing past climate data (AgERA5, 1979 to last complete year):

  1. Create a free account at https://cds.climate.copernicus.eu/
  2. Go to Your profile -> API Token and copy your token
  3. Accept the dataset terms of use at the AgERA5 download page

Documentation

Full documentation is available at https://geoaquacrop-preprocess.readthedocs.io/en/latest/.

Development

To work on the package itself:

git clone https://github.com/aquacropos/geoaquacrop_preprocess
cd geoaquacrop_preprocess
conda env create -f environment.yml
conda activate geoaquacrop
python -m pip install -e ".[dev]"

Run the tests:

python -m pytest -q

Tests that need live network access are marked download; skip them with python -m pytest -q -m "not download".

License

This project is licensed under the terms described in the LICENSE file.

Data attributions

geoaquacrop_preprocess does not contain any of the datasets listed below. It downloads them from the original providers when you run it, and then reprojects, resamples and harmonises them onto a common grid. If you use the outputs of this tool, please credit the original data providers and follow each provider's terms of use.

Past climate: AgERA5

Daily past climate data (minimum and maximum temperature, precipitation and reference evapotranspiration) come from AgERA5, produced for the Copernicus Climate Change Service (C3S) and downloaded from the Copernicus Climate Data Store. The data are licensed under CC BY 4.0. Changes made by this tool: regridding and harmonisation.

Contains modified Copernicus Climate Change Service information 2026. Neither the European Commission nor ECMWF is responsible for any use that may be made of this information.

Boogaard, H., Schubert, J., De Wit, A., Lazebnik, J., Hutjes, R., Van der Grijn, G. (2020): Agrometeorological indicators from 1979 to present derived from reanalysis. Copernicus Climate Change Service (C3S) Climate Data Store (CDS). DOI: 10.24381/cds.6c68c9bb (accessed on DD-MMM-YYYY).

Future climate: NASA NEX-GDDP-CMIP6

Future climate projections come from the NASA Earth Exchange Global Daily Downscaled Projections (NEX-GDDP-CMIP6). The dataset was prepared by the Climate Analytics Group and the NASA Ames Research Center using the NASA Earth Exchange, and is distributed by the NASA Center for Climate Simulation (NCCS). We thank the World Climate Research Programme and its Working Group on Coupled Modelling, which coordinated CMIP6. We also thank the climate modelling groups who produced and shared their model output, the Earth System Grid Federation (ESGF) for archiving and providing access, and the agencies that fund CMIP6 and ESGF. The underlying CMIP6 model output is subject to the CMIP6 terms of use.

Soil: ISRIC SoilGrids

Soil texture and organic matter data come from SoilGrids 2.0, produced by ISRIC – World Soil Information and licensed under CC BY 4.0. Changes made by this tool: clipping, resampling and harmonisation.

Poggio, L., de Sousa, L. M., Batjes, N. H., Heuvelink, G. B. M., Kempen, B., Ribeiro, E., Rossiter, D. (2021): SoilGrids 2.0: producing soil information for the globe with quantified spatial uncertainty. SOIL 7, 217–240. https://doi.org/10.5194/soil-7-217-2021

Crop calendar: GGCMI Phase 3

Planting dates and growing season lengths come from the GGCMI Phase 3 crop calendar (v1.01), licensed under CC BY 4.0. Changes made by this tool: regridding and conversion to AquaCrop inputs.

Crop areas: SPAM (MapSPAM)

Physical crop areas come from the Spatial Production Allocation Model (SPAM), developed by the International Food Policy Research Institute (IFPRI) and partners. Please check the licence of the SPAM version you use on its Harvard Dataverse page. The MapSPAM terms of use refer to a CC BY-NC 3.0 licence, which does not allow commercial use.

  • SPAM 2020: International Food Policy Research Institute (IFPRI), 2026, "Global Spatially-Disaggregated Crop Production Statistics Data for 2020 Version 2.0 Release 2", https://doi.org/10.7910/DVN/SWPENT, Harvard Dataverse, V5
  • SPAM 2010: International Food Policy Research Institute, 2019, "Global Spatially-Disaggregated Crop Production Statistics Data for 2010 Version 2.0", https://doi.org/10.7910/DVN/PRFF8V, Harvard Dataverse, V4
  • Yu, Q., You, L., Wood-Sichra, U., Ru, Y., Joglekar, A. K. B., Fritz, S., Xiong, W., Lu, M., Wu, W., Yang, P. (2020): A cultivated planet in 2010 – Part 2: The global gridded agricultural-production maps. Earth System Science Data 12, 3545–3572. https://doi.org/10.5194/essd-12-3545-2020

Metadata

Release files for geoaquacrop-preprocess 0.1.3

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-preprocess 0.1.3
File Size Uploaded Provenance Actions
geoaquacrop_preprocess-0.1.3.tar.gz 66.6 kB With provenance Details for geoaquacrop_preprocess-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geoaquacrop-preprocess 0.1.3
File Interpreter ABI Platform Actions
geoaquacrop_preprocess-0.1.3-py3-none-any.whl Python 3 none any Details for geoaquacrop_preprocess-0.1.3-py3-none-any.whl

Total release size: 117.6 kB

Release files / geoaquacrop_preprocess-0.1.3.tar.gz

Download URL geoaquacrop_preprocess-0.1.3.tar.gz
Size 66.6 kB
Tags Source
SHA-256 checksum
How to use checksums
10496d5dde3fa877fef6e11e34f03e5c983ecfd7bb6ccbcec5039597798d3a0c
BLAKE2b-256 checksum
How to use checksums
1517a789d47315b4c43347d27c73c8b88aac477aa28888d1f813e9be5e718ee0
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 Oct 23, 2026.

Transparency log

Release files / geoaquacrop_preprocess-0.1.3-py3-none-any.whl

Download URL geoaquacrop_preprocess-0.1.3-py3-none-any.whl
Size 51.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38ae8a83491dd9c30cbc1f7d0fc2dedc0688400c0c9d99646aacd0f939c4f20c
BLAKE2b-256 checksum
How to use checksums
c8ecef6937f18e8bc3997611649848587357ce2c7b3bd9524cde9e3ff6fee58a
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 Oct 23, 2026.

Transparency log

Security for geoaquacrop-preprocess 0.1.3

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_preprocess-0.1.3.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 Oct 23, 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