Command Line Interface Functionality

RAT 3.0 offers command line interface functionality to run RAT along with features like to test its installation, to initialize (which downloads dependent hydrological models and global database) and creates directory structure making it super easy for new users to use RAT. Below are the command line interface (CLI) commands that can be used by a user.

Initialization

init command initializes RAT 3.0 which is required only once after the installation of RAT. RAT depends on models like MetSim, VIC and Routing to produce inflow and thus this command removes the hassle for a user to install them separately as it takes care of all the downloading and installation. It also provides the flexibility to download global database at a desired location.

It has the following parameters:

  • -d or --dir :
    Optional parameter

    Description : Absolute/Relative path of RAT project directory.

    Default : If left blank, user will be prompt to enter the project directory path.

  • -g or --global_data :
    Optional parameter

    Description : Flag if given, the global database is downloaded, otherwise it will not be downloaded.

    Default : It is not included by default so the global database will not be downloaded.

  • -gp or --global_data_dir :
    Optional parameter

    Description : Absolute/Relative path of the already existing global database if -g or --global_data is not provided, assuming you have downloaded it before. If -g or --global_data is provided then the global database will be downloaded at the provided path.

    Default : Default path if -g or --global_data is provided is project_dir/global_data.

  • -s or --secrets :
    Optional parameter

    Description : Absolute/Relative path of the secrets file.

    Default : If left blank, it will not be automatically populated in the RAT configuration file. You can later use rat configure command described below.

  • -dr or --drive :
    Optional parameter

    Description : Drive to download the routing model, parameter files and global database from. Acceptable choices are google and dropbox.

    Default : If left blank, data will be downloaded from google drive.

Usage example of the command:

    rat init -d <PATH_OF_RAT_PROJECT_DIRECTORY> -g -gp <PATH_TO_DOWNLOAD/OF_DOWNLOADED_GLOBAL_DATA> -s <PATH_TO_SECRETS_FILE> -dr google

Warning

Default global-database is 129 GB in size and therefore it is recommended to have at least 140GB disc space in rat_project directory. If you don't have enough space in rat_project directory, you can use -gp or --global_data_dir or initialize without downloading global-database using rat init -d ./rat_project/.

Note

A ‘rat_config.yaml’ file is prepared using ‘rat_config_template’ in project_dir>‘Params’ which is created after initializing RAT.

Configuring

configure command updates RAT's configuration file by automatically updating important paths related to global database, secrets and project directory. User can also specify the cores to use to execute RAT.

This command has the following parameters:

  • -d or --dir :
    Required parameter

    Description : Absolute/Relative path of RAT project directory.

    Default : No default value as it is required parameter.

  • -p or --param :
    Required parameter

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

    Default : No default value as it is required parameter.

  • -gp or --global_data_dir :
    Optional parameter

    Description : Absolute/Relative path of the already existing global database, assuming you have downloaded it before. If not downloaded leave it blank.

    Default : If not provided, the paths related to global database are not updated.

  • -s or --secrets :
    Optional parameter

    Description : Absolute/Relative path of the secrets file.

    Default : If left blank, it will not be automatically updated in the RAT configuration file.

  • -nc or --n_cores :
    Optional parameter

    Description : Number of cores to be used to execute RAT and therefore MetSim, VIC and routing.

    Default : By default, RAT uses maximum cores to be executed.

Usage example of the command:

    rat configure -d <PATH_OF_RAT_PROJECT_DIRECTORY> -p <PATH_OF_CONFIGURATION_FILE_TO_UPDATE> -gp <PATH_OF_DOWNLOADED_GLOBAL_DATA> -s <PATH_TO_SECRETS_FILE> -nc 8

Testing

test command tests functioning of RAT 3.0 to make sure it has been correctly installed and initialized. Please make sure RAT has been initialized before testing. Currently user has the option to choose between two test basins. Also, please note that a user does not need global database in order to test RAT functioning.

This coomand has the following parameters:

  • -d or --dir :
    Required parameter

    Description : Absolute/Relative path of RAT project directory.

    Default : No default value as it is required parameter.

  • -b or --basin :
    Required parameter

    Description : River basin for which RAT will be executed for testing. Acceptable values are NUECES and GUNNISON.

    Default : No default value as it is required parameter.

  • -s or --secrets :
    Required parameter

    Description : Absolute/Relative path of the secrets file.

    Default : No default value as it is required parameter.

  • -dr or --drive :
    Optional parameter

    Description : Drive to download the test data for the selected river basin from. Acceptable choices are google and dropbox.

    Default : If left blank, data will be downloaded from google drive.

Usage example of the command:

    rat test -d <PATH_OF_RAT_PROJECT_DIRECTORY> -b NUECES -s <PATH_TO_SECRETS_FILE>

Note

A ‘test_config.yaml’ file is prepared using ‘rat_config_template’ in project_dir>‘Params’ which is created after initializing RAT.

Execution/Operationalization

run command executes RAT 3.0. You can use this command to run RAT according to the configuration file as it is or by updating the last configuration file in an inteligent manner.

It has the following parameters:

  • -p or --param :
    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 required parameter.

  • -o or --operational :
    Optional parameter

    Description : Specifies the desired latency to operationalize RAT. 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 : If not provided, 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:

    rat run -p <PATH_OF_CONFIGURATION_FILE> 
Usage example of the command to operationalize RAT:
    rat run -p <PATH_OF_CONFIGURATION_FILE> -o 3

Warning

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

Tip

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

    rat run -p <PATH_OF_CONFIGURATION_FILE> -o 3