DSSATTools.run

This module hosts the DSSAT class. This class represents the simulation environment, so per each DSSAT instance there’s a directory where all the necesary files to run the model are allocated. To run the model there are 2 basic steps:

1. Create a new DSSAT instance. When DSSAT is instantiated, a simulation environment is set. That enviroment is set at the path passed during the call:

>>> dssat = DSSAT("/tmp/dssat_test")

2. Run the model by calling the run_treatment() method. This method receives as parameters the FileX sections’ objects:

>>> results = dssat.run_treatment(
>>>     field=field, cultivar=crop, planting=planting,
>>>     initial_conditions=initial_conditions, fertilizer=fertilizer,
>>>     simulation_controls=simulation_controls
>>> )

This call returns a dictionary that contains the values of the standard output of the model: FLO, MAT, TOPWT, HARWT, RAIN, etc. After running, the DSSAT instance will have all the output files as strings in the output_files attribute, and the output timeseries tables in the output_tables attribute:

>>> overview = dssat.output_files['OVERVIEW'] # Gets the overview file as a str
>>> plantgro = dssat.output_tables['PlantGro'] # Gets the plant growth table
  1. You can close the simulation environment by calling the close() method.
    >>> dssat.close()
    

Functions

handleRemoveReadonly(func, path, excinfo)

Classes

DSSAT([run_path])

Class that represents the simulation environment for a single treatment.