The Scripting Plugin allows the user to write a customized script to operate in the program order during a simulation.  During a compute, the Scripting Plugin runs a script defined by the Scripting Alternative.  Each Scripting Alternative can be linked to other models using the HEC-WAT Model Linking Editor interface, and in an FRA compute can provide output variables to summarize model results.  The script can be added anywhere in the program order, allowing it to pre-process inputs or post-process results for other models.

The script is written in a language called Jython, a dialect of Python 2 that works on the Java Virtual Machine and can access all of the programming interfaces used by HEC-WAT to obtain information about the compute and model inputs.  Additional Java and Jython libraries can also be added to the /scripts/ directory of the watershed that can be imported and used by the script.

Some example uses of the Scripting Plugin are to: 

  • Reformat or adjust a timeseries to meet specific needs for a model inputs
  • Perform datum shifts of stage data between models or for output metrics
  • Merge timeseries results between two models in the compute sequence, such as a winter and spring season HEC-HMS model.
  • Calculate per-event metrics to be summarized as Output Variables by HEC-WAT
  • Randomly sample and create timeseries data used as by an operational constraint for a HEC-ResSim model, such as irrigation or hydropower demand.
  • Calculate a seasonal volume forecast from modeled snow water equivalent (SWE) in the HEC-HMS results or modeled inflow, for use by HEC-ResSim in determination of draft requirements.


The Scripting Plugin documentation is divided into two sections:


Adjustments to the event's time window can be made with the TimeWindowModifier (TWM) plugin, which has its own scripting interface.  In some older HEC-WAT studies, the TWM scripting interface was used to fulfill some of the roles of the Scripting Plugin.

Example Scripting Plugin Scripts on GitHub

HEC provides a GitHub repository of example Scripting Plugin and Time Window Modifier scripts on GitHub for reference when developing new scripts.  These examples are from real studies and demonstrate ways the HEC-WAT scripting interfaces can be used in an HEC-WAT compute.

  • Columbia River Climate Change Pre-Processor (GitHub)
  • Columbia Datum Shift Script (GitHub - implemented as TWM script)
  • NWW Willow Creek Snow Accumulation Script (GitHub)