dpest.eco#
- dpest.eco.eco(ecotype=None, eco_file_path=None, output_path=None, new_template_file_extension=None, header_start=None, tpl_first_line=None, minima=None, maxima=None, mrk='~', **parameters_grouped)[source]#
Creates a
PEST template file (.TPL)for CERES-Wheat ecotype parameters based on aDSSAT ecotype file (.ECO). This module is specific to the CERES-Wheat model and uses default values tailored for this model.Required Arguments:#
ecotype (str): Ecotype ID to modify. This should match the
ECO#(ecotype ID) column in theDSSAT ecotype file (.ECO)eco_file_path (str): Full path to the
DSSAT ecotype (.ECO)file. Typically, this is the path to theWHCER048.ECOfile, usually located atC:\DSSAT48\Genotype\WHCER048.ECO.
Optional Arguments:#
output_path (str, default: current working directory): Directory to save the generated
PEST template file (.TPL).new_template_file_extension (str, default: “.TPL”): Extension for the generated
PEST template file (.TPL). This is the PEST default value and should not be changed without good reason.header_start (str, default: “@ECO#”): Identifier for the header row in the
DSSAT ecotype file (.ECO).tpl_first_line (str, default: “ptf”): First line to include in the
PEST template file (.TPL). This is the PEST default value and should not be changed without good reason.minima (str, default: “999991”): Row identifier for the minima ecotype parameter values.
maxima (str, default: “999992”): Row identifier for the maxima ecotype parameter values.
mrk (str, default: “~”) Primary marker delimiter character for the template file. Must be a single character and cannot be A-Z, a-z, 0-9, !, [, ], (, ), :, space, tab, or &.
parameters_grouped (dict, optional): Parameters to calibrate, grouped and comma-separated. If not provided, all ecotype parameters are calibrated. For example:
PHEN='P1, P2FR1', VERN='VEFF'. ‘PHEN’ and ‘VERN’ are ecotype parameter group names, and the values are the specific ecotype parameters to calibrate, using the same names as in theDSSAT ecotype file (.ECO). Parameter group names should be less than 12 characters.
Returns:#
- tuple: A tuple containing:
- dict: A dictionary containing:
'parameters': Current ecotype parameter values for the specified ecotype.'minima_parameters': Minima values for all ecotype parameters.'maxima_parameters': Maxima values for all ecotype parameters.'parameters_grouped': The grouped ecotype parameters used for template generation.
str: The full path to the generated .TPL file.
Examples:#
Basic Usage (Required Arguments Only):
from dpest import eco # Call the module with only the required arguments ecotype_parameters, ecotype_tpl_path = eco( ecotype = 'CAWH01', eco_file_path = 'C:/DSSAT48/Genotype/WHCER048.ECO' ) # The returned tuple and path are saved in the variables, can be used with any name that the user prefer, to call them later
This example creates a template file using only the required arguments. Note that the returned tuple
(ecotype_parameters, ecotype_tpl_path)is captured. Theecotype_parametersdictionary will be used later to make the control file’s parameter groups and parameters sections using thepstmodule. Theecotype_tpl_pathpath will be used in theinput_output_file_pairsargument of thepstmodule to match the originalDSSAT ecotype file (.ECO)to the template file.Specifying Parameter Groups (Tuple Not Saved):
from dpest import eco # Call the module specifying parameter groups, but not saving the returned tuple eco( ecotype = 'CAWH01', eco_file_path = 'C:/DSSAT48/Genotype/WHCER048.ECO', PHEN = 'P1, P2FR1', VERN = 'VEFF' )
This example demonstrates how to specify the
parameters_groupedargument to calibrate only specific ecotype parameters. In this case, the returned tuple is not saved, but thePEST template file (.TPL)is still created at the specified location. If you want to use the ecotype parameters and path for thepstmodule, the returned tuple should be saved with the names that the user prefer.