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 a DSSAT 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 the DSSAT ecotype file (.ECO)

  • eco_file_path (str): Full path to the DSSAT ecotype (.ECO) file. Typically, this is the path to the WHCER048.ECO file, usually located at C:\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 the DSSAT 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:#

  1. 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. The ecotype_parameters dictionary will be used later to make the control file’s parameter groups and parameters sections using the pst module. The ecotype_tpl_path path will be used in the input_output_file_pairs argument of the pst module to match the original DSSAT ecotype file (.ECO) to the template file.

  2. 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_grouped argument to calibrate only specific ecotype parameters. In this case, the returned tuple is not saved, but the PEST template file (.TPL) is still created at the specified location. If you want to use the ecotype parameters and path for the pst module, the returned tuple should be saved with the names that the user prefer.