Run input managers

class tradssat.mgrs.DSSATRun(file, model=None)[source]

General manager for DSSAT run input files.

add_factor_level(factor, vals)[source]

Adds a factor level to the experiment.

Parameters:
  • factor (str) – Factor code or name.
  • vals (dict) – Dictionnary of variable values for that factor level’s variables. Missing variables will be assigned the corresponding missing code (usually -99).
add_treatment(name, ops=None, factors=None)[source]

Adds a treatment level to the experiment.

Parameters:
  • name (str) – Name of the new treatment.
  • ops (dict) – Dictionnary of values for the R, O, and C treatment level options (optional).
  • factors (dict) – Dictionnary of values for the treatment’s factor levels (optional). Missing factors will be assigned level 0.
get_factor_level_val(var, level)[source]

Obtain the variable value for a specific factor level.

Parameters:
  • var (str) – The variable of interest.
  • level (int) – The factor level corresponding to the specified variable.
Returns:

The variable value at the factor level.

Return type:

np.ndarray

get_general_val(var)[source]

Obtain a variable value from the GENERAL section of the EXP file.

Parameters:var (str) – Variable name
Returns:Variable value.
Return type:np.ndarray
get_trt_factor_level(trt, factor)[source]

Obtain the factor level for a specific treatment.

Parameters:
  • trt (str | int) – Treatment name or number.
  • factor (str) – Factor name or code.
Returns:

The factor level corresponding to the given treatment.

Return type:

int

get_trt_name(n)[source]

Returns the treatment name corresponding to a treatment number.

Parameters:n (int) – The treatment number.
Returns:The treatment name.
Return type:str
get_trt_num(trt)[source]

Returns the treatment number corresponding to a specified treatment name.

Parameters:trt (str) – The treatment name.
Returns:The corresponding treatment number.
Return type:int
get_trt_val(var, trt)[source]

Returns the value of a treatment’s variable.

Parameters:
  • var (str) – The variable of interest.
  • trt (int | str) – The treatment name or number.
Returns:

The variable value for the treatment.

Return type:

np.ndarray

remove_treatment(trt)[source]

Removes a treatment from the experiment.

Parameters:trt (str | int) – Treatment name or number.
set_general_val(var, val)[source]

Sets a variable value in the GENERAL section of the EXP file.

Parameters:
  • var (str) – Variable name.
  • val (str | float | int | np.ndarray) – New value for the variable.
set_trt_factor_level(trt, factor, level)[source]

Sets the factor level for a treatment.

Parameters:
  • trt (str | int) – The treatment name or number.
  • factor (str) – The factor name or code.
  • level (int) – The new factor level.
treatments(name=False)[source]

Returns the treatments in the run.

Parameters:name (bool) – Whether to return treatment names or numbers.
Returns:The list of treatments.
Return type:np.ndarray
class tradssat.mgrs.GeneticMgr(crop, cult)[source]
class tradssat.mgrs.SoilMgr(code)[source]
class tradssat.mgrs.WeatherFileMgr(code)[source]