iwfm.diagnostics.write_pest_control

iwfm.diagnostics.write_pest_control(template_pst, output_pst, recommendations, initial_values=None, verbose=False)[source]

Write a new .pst file applying parameter selection recommendations.

Reads the template .pst, modifies the parameter data and tied parameter data sections based on recommendations from suggest_parameter_changes, and writes a new .pst file.

Parameters:
  • template_pst (str) – Path to existing .pst file to use as template.

  • output_pst (str) – Path for the new .pst file.

  • recommendations (dict) – From suggest_parameter_changes(). Contains ‘param_groups’ with representative/tied assignments, and ‘bound_changes’.

  • initial_values (dict, optional) – {param_name: initial_value}. If None, uses values from template .pst.

  • verbose (bool) – Print progress.

Returns:

Summary: {‘n_adjustable’: int, ‘n_tied’: int, ‘n_fixed’: int,

’n_total’: int}.

Return type:

dict