dpest

dpest: Streamlining Creation of PEST input files for DSSAT Crop Model Calibration - Published in JOSS (2025)

https://github.com/ds4ag/dpest

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Engineering Computer Science - 41% confidence
Last synced: 6 months ago · JSON representation ·

Repository

Python package automating PEST file creation for DSSAT crop model calibration. Generates template files for Cultivar and Ecotype parameters, instruction files for OVERVIEW.OUT and PlantGro.OUT, and the main PEST control file. Includes utility to extend PlantGro.OUT files for complete time series compatibility.

Basic Info
  • Host: GitHub
  • Owner: DS4Ag
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 10.9 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 10
Created about 1 year ago · Last pushed 8 months ago
Metadata Files
Readme Contributing License Citation

README.md

dpest

dpest

Python version License Documentation Status codecov DOI

A Python package for automating PEST (Parameter ESTimation) file creation for DSSAT crop model calibration using time series data.

What is dpest?

dpest is a Python package designed to automate the creation of PEST (Parameter Estimation and Uncertainty Analysis) control files for calibrating DSSAT (Decision Support System for Agrotechnology Transfer) crop models. Currently, dpest is capable of calibrating DSSAT wheat models only. It generates template files for cultivar and ecotype parameters, instruction files for OVERVIEW.OUT and PlantGro.OUT, and the main PEST control file. A utility module is also included to extend PlantGro.OUT files for complete time series compatibility.

Documentation

For detailed usage instructions and module references, see the full documentation on: dpest.readthedocs.io/en/latest.

Key Features

  • Automated generation of PEST control files (.PST).
  • Compatibility with DSSAT wheat models.
  • Creation of PEST template files (.TPL) for cultivar and ecotype parameters.
  • Generation of PEST instruction files (.INS) for key DSSAT output files.
  • Utility module to extend PlantGro.OUT files for complete time series.

Installation

dpest can be installed via pip from PyPI.

pip install dpest

How to Cite

If you use dpest in your research, please cite our article in the Journal of Open Source Software:

APA:

Vargas-Rojas, L., & Wang, D. R. (2025). dpest: Streamlining Creation of PEST input files for DSSAT Crop Model Calibration. Journal of Open Source Software, 10(111), 8188. https://doi.org/10.21105/joss.08188

BibTeX:

@article{Vargas-RojasdpestStreamliningCreation2025, author = {Vargas-Rojas, Luis and Wang, Diane R.}, title = {dpest: Streamlining Creation of PEST input files for DSSAT Crop Model Calibration}, journal = {Journal of Open Source Software}, year = {2025}, volume = {10}, number = {111}, pages = {8188}, doi = {10.21105/joss.08188}, url = {https://joss.theoj.org/papers/10.21105/joss.08188}, month = jul }

For additional citation formats, see the CITATION.cff file in this repository or use the "Cite this repository" button in the GitHub About section.

Prerequisites

  1. DSSAT Software: DSSAT (version 4.8) must be installed on your system.
  2. DSSAT Experiment Data: You'll need a DSSAT experiment to work with. The example below uses the SWSW7501WH N RESPONSE wheat experiment.
  3. PEST Software: You’ll need to have PEST (version 18) installed.

How to Use dpest?

Jupyter notebook example

To quickly explore how dpest works in practice, you can open and run the example Jupyter notebook included in the repository:

examples/wheat/ceres/usage_example.ipynb

This notebook walks through:

  • Loading DSSAT outputs (OVERVIEW.OUT, PlantGro.OUT)
  • Generating template (.TPL) and instruction (.INS) files
  • Creating the main PEST control file (.PST)
  • Validating the setup using PEST check commands

To run the notebook:

bash pip install dpest[notebook] jupyter notebook examples/wheat/ceres/usage_example.ipynb

Note: The [notebook] extra installs ipykernel and notebook dependencies required to open the notebook.

Read the Docs

For a detailed, step-by-step example, please refer to the official documentation:
Complete Example on Read the Docs

Basic Usage

The following steps provide a brief overview of how to use dpest.

  1. Locate DSSAT Genotype Files: The cultivar (.CUL) and ecotype (.ECO) files are typically included with the DSSAT installation. These are usually found in the C:\DSSAT48\Genotype\ directory.
  2. Run a DSSAT Simulation: Execute a DSSAT simulation for your chosen wheat experiment using the CERES model. This will generate the necessary output files (OVERVIEW.OUT and PlantGro.OUT), typically found in the C:\DSSAT48\Wheat\ directory.

    2.1. Launch DSSAT.
    2.2. Click "Selector".
    2.3. Expand "Crops" and select "Wheat".
    2.4. In the "Data" panel select the "SWSW7501.WHX" experiment.
    2.5. Click "Run" button in the toolbar.
    2.6. In the "Simulation" popup window, choose "CERES" as the crop model.
    2.7. Click "Run Model" and wait for the simulation to finish.
    
  3. Import the dpest Package:

*   To import the entire `dpest` package:

```
import dpest
```

*   To import specific modules:

```
from dpest.wheat.ceres import cul, eco
from dpest.wheat import overview, plantgro
from dpest import pst
from dpest.wheat.utils import uplantgro

# Now you can use the functions directly:
cul(...)
eco(...)
overview(...)
plantgro(...)
pst(...)
uplantgro(...)
```
  1. Use the Modules
*   **`cul()`**: This module creates `PEST template files (.TPL)` for CERES-Wheat cultivar parameters. Use it to generate template files for cultivar calibration.
*   **`eco()`**: This module creates `PEST template files (.TPL)` for CERES-Wheat ecotype parameters. Use it to generate template files for ecotype calibration.
*   **`overview()`**: This module creates `PEST instruction files (.INS)` for reading observed (*measured*) values of key end-of-season crop performance metrics and key phenological observations from the `OVERVIEW.OUT` file. The instruction file tells PEST how to extract model-generated observations from the `OVERVIEW.OUT` file, compare them with the observations from the DSSAT `A file`, and adjust model parameters accordingly.
*   **`plantgro()`**: This module creates `PEST instruction files (.INS)` for reading observed (*measured*) values of plant growth dynamics from the `PlantGro.OUT` file. The instruction file tells PEST how to extract time-series data from the `PlantGro.OUT file`, compare that data with the time-series data provided in the DSSAT `T file`, and adjust model parameters accordingly.
*   **`pst()`**: enerates the main `PEST control file (.PST)` to guide the entire calibration process. It integrates the  `PEST template files (.TPL)` and `PEST instruction files (.INS)`, defines calibration parameters, observation groups, weights, PEST control variables and model run command.
*   **`uplantgro()`**: modifies the DSSAT output file (`PlantGro.OUT`) to prevent PEST errors when simulated crop maturity occurs before the final measured observation. This ensures PEST can compare all available time-series data, even when the model predicts maturity earlier than observed in the field.
  1. Create Template Files and Instruction Files: Use the dpest modules to generate PEST template files (.TPL) for cultivar and ecotype parameters, and PEST instruction files (.INS) for the OVERVIEW.OUT and PlantGro.OUT files.

``` import dpest

1. Create CULTIVAR parameters TPL file

cultivarparameters, cultivartplpath = dpest.wheat.ceres.cul( P = 'P1D, P5', # How the user should enter the parameters G = 'G1, G2, G3', PHINT = 'PHINT', cultivar = 'MANITOU', culfile_path = 'C:/DSSAT48/Genotype/WHCER048.CUL' )

2. Create OVERVIEW observations INS file

overviewobservations, overviewinspath = dpest.wheat.overview( treatment = '164.0 KG N/HA IRRIG', #Treatment Name overviewfile_path = 'C:/DSSAT48/Wheat/OVERVIEW.OUT' #Path to the OVERVIEW.OUT file )

3. Create PlantGro observations INS file

plantgroobservations, plantgroinspath = dpest.wheat.plantgro( treatment = '164.0 KG N/HA IRRIG', #Treatment Name variables = ['LAID', 'CWAD', 'T#AD'] #Variables to calibrate plantgrofile_path = 'C:/DSSAT48/Wheat/PlantGro.OUT', #Path to the PlantGro.OUT file )

`` 6. **Create the PEST Control File:** Use thedpest.pst()module to generate the mainPEST control file (.PST)`.

```

4. Create the PST file

dpest.pst( cultivarparameters = cultivarparameters, dataframeobservations = [overviewobservations, plantgroobservations], modelcomandline = r'py "C:\pest18\rundssat.py"', #Command line to run the model inputoutputfilepairs = [ (cultivartplpath, 'C://DSSAT48/Genotype/WHCER048.CUL'), #Template file and the file to be modified (overviewinspath , 'C://DSSAT48/Wheat/OVERVIEW.OUT'), #Instruction file and the file to be modified (plantgroins_path , 'C://DSSAT48/Wheat/PlantGro.OUT') #Instruction file and the file to be modified ] ) ```

  1. Run PEST: Calibrate the model using PEST.

Utilities for Editing PEST Control Files

In addition to automating the creation of PEST control and template files for DSSAT CERES-Wheat model calibration, dpest includes a growing set of utility functions under dpest.utils for directly modifying existing .pst (PEST control) files.

Why use dpest.utils?

Unlike libraries such as pyEMU, which parse .pst files into Python objects and rewrite the entire file when saving any change, dpest.utils performs lightweight, line-by-line edits to preserve the original structure and untouched content.

These utilities:

  • Edit existing .pst files in place, without reconstructing or redefining unrelated fields.
  • Are model-agnostic: they work with any .pst file, not just DSSAT-related ones.
  • Only modify model-independent control parameters (e.g., optimization settings), leaving parameter and data blocks untouched.

This makes them ideal for quickly tuning optimization settings or cleaning up .pst files generated by dpest or other tools.

Example Usage

```python

Load the dpest.utils

from dpest.utils import noptmax, rmv_splitcols

Path to the .pst file

pstfilepath = './ENTRY1/PEST_CONTROL.pst'

Increase the number of optimization iterations (NOPTMAX) in a .pst file

noptmax(pstfilepath, new_value=50)

Remove SPLITTHRESH/SPLITRELDIFF/SPLITACTION columns from a .pst file parameter groups section

rmvsplitcols(“PESTCONTROL.pst”)

```

Full List of Utility Functions:
For the complete reference of available utility functions and their descriptions, see the dpest ReadTheDocs Utils page.

Test Coverage

codecov

A detailed and up-to-date test coverage report for the dpest codebase is available on Codecov:

View detailed coverage report on Codecov

Developer and Tester Setup Instructions for dpest

These instructions will guide you through setting up your environment, installing dependencies, and running tests for the dpest package.

Prerequisites

  • Python 3.10 or higher installed
  • Git installed

Step 1: Clone the Repository

bash git clone https://github.com/DS4Ag/dpest.git cd dpest

Step 2: Create and Activate a Virtual Environment

On Windows: powershell py -3.10 -m venv .venv .\.venv\Scripts\activate

On macOS/Linux: bash python3.10 -m venv .venv source .venv/bin/activate

Step 3: Install PDM (Python Development Master)

PDM is a modern Python package and dependency manager recommended for development and testing.

Install PDM using pipx (recommended): bash python -m pip install --user pipx pipx ensurepath pipx install pdm

Or install PDM using pip: bash pip install --user pdm

Step 4: Install Project Dependencies

bash pdm install

Step 5: Install Development Dependencies (for testing)

bash pdm install --dev

Step 6: Run the Test Suite

bash pdm run pytest tests/ -v

Community Guidelines

We welcome contributions from the community!

License

dpest is released under the GNU General Public License v3.0 only.

Owner

  • Name: Luis Vargas Rojas
  • Login: DS4Ag
  • Kind: user
  • Location: Mexico
  • Company: Purdue University

JOSS Publication

dpest: Streamlining Creation of PEST input files for DSSAT Crop Model Calibration
Published
July 08, 2025
Volume 10, Issue 111, Page 8188
Authors
Luis Vargas-Rojas ORCID
Department of Agronomy, Purdue University, West Lafayette, IN, United States
Diane R. Wang ORCID
Department of Agronomy, Purdue University, West Lafayette, IN, United States
Editor
Jayaram Hariharan ORCID
Tags
crop modeling DSSAT PEST calibration remote sensing time-series data

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- family-names: Vargas-Rojas
  given-names: Luis
  orcid: "https://orcid.org/0000-0001-8610-9901"
- family-names: Wang
  given-names: Diane R.
  orcid: "https://orcid.org/0000-0002-2290-3257"
doi: 10.5281/zenodo.15733807
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - family-names: Vargas-Rojas
    given-names: Luis
    orcid: "https://orcid.org/0000-0001-8610-9901"
  - family-names: Wang
    given-names: Diane R.
    orcid: "https://orcid.org/0000-0002-2290-3257"
  date-published: 2025-07-08
  doi: 10.21105/joss.08188
  issn: 2475-9066
  issue: 111
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 8188
  title: "dpest: Streamlining Creation of PEST input files for DSSAT
    Crop Model Calibration"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.08188"
  volume: 10
title: "dpest: Streamlining Creation of PEST input files for DSSAT Crop
  Model Calibration"

GitHub Events

Total
  • Create event: 21
  • Issues event: 8
  • Release event: 10
  • Watch event: 1
  • Delete event: 10
  • Issue comment event: 5
  • Push event: 289
Last Year
  • Create event: 21
  • Issues event: 8
  • Release event: 10
  • Watch event: 1
  • Delete event: 10
  • Issue comment event: 5
  • Push event: 289

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 8
  • Total pull requests: 0
  • Average time to close issues: 10 days
  • Average time to close pull requests: N/A
  • Total issue authors: 3
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 8
  • Pull requests: 0
  • Average time to close issues: 10 days
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aleaf (6)
  • YousraGAMOUSSI (1)
  • julienmalard (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 28 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 18
  • Total maintainers: 1
pypi.org: dpest

A Python package for automating PEST (Parameter ESTimation) file creation for DSSAT crop model calibration using time series data. It generates template, instruction, and control files for parameter estimation, including tools for extending time series data.

  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 28 Last month
Rankings
Dependent packages count: 9.6%
Average: 31.7%
Dependent repos count: 53.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

pyproject.toml pypi
docs/requirements.txt pypi
setup.py pypi