There are a set of "environment variables" that are available when running scripts related to the CBP modeling suite. These environment variables are enabled by using the command . hspf_config inside your script, or by running your script via the cbp helper script which also calls . hspf_config (see details of both scripts at https://github.com/HARPgroup/cbp_wsm/issues/69). The variables that are defined in hspf.config are then exported to any subsequent script that is called, so common locations are available to any programs that are executed from your command, which helps all scripts know where critical data, executables and libraries are.
Current list of Variables in hspf.config
The variables are as follows:
CBP_ROOT: The location of the base directory for the model tree. Ex: "/opt/model/p6/gb604b"
CBP_SRC: The location of the CBP model source directory. Default is: "$CBP_ROOT/code/src"
CBP_BIN: The location of the run directory used by CBP model scripts. Default is "$CBP_ROOT/run"
CBP_EXPORT_DIR: The location of the directory for data files that are exported from post-processing scripts completed model runs. This is for publishing data to be used externally. This is used extensively in VAHydro, but might have applicability for normal CBP modeling when final data is published. Ex: "/media/model/p532/out"
CBP_RO_TEMPLATE: A database table creation script for importing runoff data in an SQL database. Used extensively in the PHP version of the OM routing model, but may be deprecated as we move to $hsp^2$. Ex: "/opt/model/om/sh/cbp_p6_lseg_runoff_template.sql"
NLDAS_ROOT: The main directory where NLDAS data downloads and scripts are stored. Ex: "/backup/meteorology"
Using in a Script
This function has been tested in bash and csh scripts and runs in both with the same syntax . hspf_config
Annotated Excerpt from NLDAS
This example is from the NLDAS processing tools, which takes a blank wdm, populates it with meteorology data, then moves that wdm into the directory indicated by the environment variables loaded with the command . hspf_config. Sample steps are as follows:
Overview
There are a set of "environment variables" that are available when running scripts related to the CBP modeling suite. These environment variables are enabled by using the command
. hspf_config
inside your script, or by running your script via thecbp
helper script which also calls. hspf_config
(see details of both scripts at https://github.com/HARPgroup/cbp_wsm/issues/69). The variables that are defined inhspf.config
are then exported to any subsequent script that is called, so common locations are available to any programs that are executed from your command, which helps all scripts know where critical data, executables and libraries are.Current list of Variables in
hspf.config
The variables are as follows:
CBP_ROOT
: The location of the base directory for the model tree. Ex: "/opt/model/p6/gb604b"CBP_SRC
: The location of the CBP model source directory. Default is: "$CBP_ROOT/code/src"CBP_BIN
: The location of therun
directory used by CBP model scripts. Default is "$CBP_ROOT/run"CBP_EXPORT_DIR
: The location of the directory for data files that are exported from post-processing scripts completed model runs. This is for publishing data to be used externally. This is used extensively in VAHydro, but might have applicability for normal CBP modeling when final data is published. Ex: "/media/model/p532/out"CBP_RO_TEMPLATE
: A database table creation script for importing runoff data in an SQL database. Used extensively in the PHP version of the OM routing model, but may be deprecated as we move to $hsp^2$. Ex: "/opt/model/om/sh/cbp_p6_lseg_runoff_template.sql"NLDAS_ROOT
: The main directory where NLDAS data downloads and scripts are stored. Ex: "/backup/meteorology"Using in a Script
This function has been tested in bash and csh scripts and runs in both with the same syntax
. hspf_config
Annotated Excerpt from NLDAS
This example is from the NLDAS processing tools, which takes a blank wdm, populates it with meteorology data, then moves that wdm into the directory indicated by the environment variables loaded with the command
. hspf_config
. Sample steps are as follows:. hspf_config
:cp $NLDAS_ROOT/out/lseg_csv/RNMax/$land_segment.RNMax $CBP_ROOT/input/unformatted/$data_source/$version/RNMax/
./wdm_pm_one:mv "met_$land_segment.wdm" $CBP_ROOT/input/scenario/climate/met/$met_scen/
Full Script: p6/gb604b/run/useful/copy_scenario
Full bash Script that Calls R script p532/run/export/wdm_flow_csv