Python Functionality

RAT 3.0 can be executed and implemented in python but it needs to be initialized, tested and configured using command line interface. Since it can be executed in python, one can use jupyter notebook environments and python scripts to automatically update configuration file and calibrate models like VIC. Please note that it will be easier to calibrate VIC using RAT 3.0 rather than just using VIC.


run_rat function is used to execxute RAT {rat_version.major}}.0 in python. It can also be used to operationalize RAT. This function has the following paramters:

  • config_fn :
    Required parameter

    Description : Absolute/Relative path of RAT configuration file that you want to use to run RAT.

    Default : No default value as it is a required parameter.

  • operational_latency :
    Optional parameter

    Description : Specifies the desired latency to operationalize RAT (needs to be numeric whole number). While the typical latency of meteorological data ranges from 1-2 days, it is advised to set a latency of 3 days when operationalizing RAT. This ensures that RAT3.0 obtains all the necessary input data from various satellite data servers and executes smoothly, without encountering any errors. By setting a latency of 3 days, RAT 3.0 will initiate execution from the end of the previous RAT 3.0 run and cover the duration up to three days prior to the current day. Also, please note that the configuration file's start and end date will be updated and overwritten in the same file.

    Default : Default value is None. The configuration file will not be updated before executing RAT and RAT will run for the duration specified in the configuration file.

Usage example of the command to execute RAT:

    from rat.run_rat import run_rat
    run_rat(config_fn = <PATH_OF_CONFIGURATION_FILE>, operational_latency=None)
Usage example of the command to operationalize RAT:
    from rat.run_rat import run_rat
    run_rat(config_fn = <PATH_OF_CONFIGURATION_FILE>, operational_latency=3)


RAT operational parameter should only be used if RAT 3.0 has already been executed once before, for that particular river basin.


To operationalize RAT, set a daily cron job for the following python script:

    from rat.run_rat import run_rat
    run_rat(config_fn = <PATH_OF_CONFIGURATION_FILE>, operational_latency=3)