HWRF  trunk@4391
Manually Run HWRF Python Functions

While debugging the HWRF system, sometimes it is useful to query its object tree (in hwrf_expt) or run individual HWRF Python functions. One can do this via an interactive Python shell after the launcher job has run for a cycle. This requires the use of sh, ksh or bash since your shell must understand the automatically-generated storm1.holdvars.txt file, which is a POSIX sh include file.

The command is as follows; change the $TOTAL_TASKS with a different value if you want to run MPI programs:

cd /path/to/HWRF/scripts
( . /path/to/CDSCRUB/com/2015092912/11L/storm1.holdvars.txt ; \
    export PYTHONPATH=$USHhwrf TOTAL_TASKS=1 ; python )

That will start a Python shell. Next, you must initialize the produtil package:

import produtil.setup
produtil.setup.setup()

The produtil.setup.setup() function has a number of options. If you are annoyed by DBN alert warnings, you may want to set send_dbn=False. Read the documentation for other options you may wish.

Next, you need to initialize hwrf_expt:

import hwrf_expt
hwrf_expt.init_module()

The entire HWRF system is then accessible via the hwrf_expt module. For example, to get the name of the MOAD domain:

print str(hwrf_expt.moad)

That would print "moad"

Conceivably, the entire HWRF system could be run this way in a single Python interactive session in an interactive batch job. However, that would be quite tedious.