dpest.overview#
- dpest.overview.overview(treatment=None, overview_file_path=None, output_path=None, experiment=None, suffix=None, variables=None, variables_classification=None, overview_ins_first_line=None, mrk='~', smk='!')[source]#
Creates a
PEST instruction file (.INS). This instruction file contains directions for PEST to read the simulated values from theOVERVIEW.OUTfile and compare them with the corresponding observed values (originally entered in the DSSAT “A file”). ThePEST instruction file (.INS)guides PEST in extracting specific model-generated observations from theOVERVIEW.OUTfile, which includes a list of end-of-season crop performance metrics, and critical phenological observations used for model evaluation. Additionally, this module creates a tuple containing:A DataFrame with the MEASURED observations from the
OVERVIEW.OUTfile (originally entered in the DSSAT “A file”).The path to the generated
PEST instruction file (.INS).
Required Arguments:#
treatment (str): The name of the treatment for which the cultivar is being calibrated. This should match exactly the treatment name as shown in the DSSAT application interface when an experiment is selected. For example,
"164.0 KG N/HA IRRIG"is a treatment of theSWSW7501WH.WHXexperiment.overview_file_path (str): Path to the
OVERVIEW.OUTfile to read. Usually the file is inC:\DSSAT48\Wheat\OVERVIEW.OUT.
Optional Arguments:#
output_path (str, default: current working directory): Directory where the generated
PEST instruction file (.INS)will be saved.experiment (str, optional): Experiment code as shown in the PlantGro.OUT header (e.g.
"AZMC9311"). When the same treatment name appears in more than one experiment within the same OVERVIEW.OUT file, this argument is used to select the correct experiment block. If not provided and the treatment is unique in the file, the function will use the unique experiment automatically. If the treatment appears in multiple experiments andexperimentis not specified, it will the variables for that treatment that appear in the last part of the file.suffix (str, default: “”): Suffix to append to the output filename and variable names in the .INS file. This short code (e.g.,
TRT1,TRT2,TRT3) identifies different treatments used for calibrating the same cultivar (or ecotype) in the same calibration process. It must be 1–4 characters long, containing only uppercase letters and/or numbers. For example, ifsuffix="TRT1", the output file will be namedOVERVIEW_TRT1.insand variable markers will include the suffix (e.g.,!Anthesis_DAP_TRT1!). This ensures that PEST can distinguish between variables from different treatments, as PEST does not allow variables with the same name.variables (list or str): Variable(s) from the
OVERVIEW.OUTfile that PEST will extract in case the user does not want to use all the variables present in the DSSAT “A file” for the calibration. The PEST instruction file will use these to read the model output. You may specify a single variable as a string (e.g.,'Anthesis (DAP)') or multiple variables as a list (e.g.,['Anthesis (DAP)', 'Maturity (DAP)', 'Product wt (kg dm/ha;no loss)','Maximum leaf area index', 'Canopy (tops) wt (kg dm/ha)', 'Above-ground N (kg/ha)']).variables_classification (dict): Mapping of variable names to their respective categories. If provided, it is used directly to classify variables. If not provided, the function will attempt to load crop- and model-specific classification from a configuration file located at
dpest/<crop>/<model>/arguments.yml.overview_ins_first_line (str, default: “pif”): First line of the
PEST instruction file (.INS). This is the PEST default value and is obtained from the package configuration file (dpest/arguments.yml) when not provided by the user.mrk (str, default: “~”): Primary marker delimiter character for the instruction file. Must be a single character and cannot be A–Z, a–z, 0–9,
!,[,],(,),:, space, tab, or&.smk (str, default: “!”): Secondary marker delimiter character for the instruction file. Must be a single character and cannot be A–Z, a–z, 0–9,
[,],(,),:, space, tab, or&.
Returns:#
- tuple: A tuple containing:
pandas.DataFrame: A filtered DataFrame used to generate the
PEST instruction file (.INS).str: The full path to the generated
PEST instruction file (.INS).
Examples:#
Basic Usage (Required arguments only, crop/model-based defaults):
from dpest import overview overview_observations, overview_ins_path = overview( treatment='164.0 KG N/HA DRY', overview_file_path='C:/DSSAT48/Wheat/OVERVIEW.OUT', crop='wheat', model='ceres', )
Specifying Variable Classifications Manually:
from dpest import overview overview( treatment='164.0 KG N/HA DRY', overview_file_path='C:/DSSAT48/Wheat/OVERVIEW.OUT', variables=[ 'Anthesis (DAP)', 'Maturity (DAP)', 'Product wt (kg dm/ha;no loss)', 'Maximum leaf area index', 'Canopy (tops) wt (kg dm/ha)', 'Above-ground N (kg/ha)', ], variables_classification={ 'Anthesis (DAP)': 'phenology', 'Maturity (DAP)': 'phenology', 'Product wt (kg dm/ha;no loss)': 'yield', 'Maximum leaf area index': 'lai', 'Canopy (tops) wt (kg dm/ha)': 'biomass', 'Above-ground N (kg/ha)': 'nitrogen', }, )