HWRF  trunk@4391
Classes | Functions | Variables
hwrf.launcher Namespace Reference

Creates the initial HWRF directory structure, loads information into each job. More...

Detailed Description

Creates the initial HWRF directory structure, loads information into each job.

This module is used to create the initial HWRF conf file in the first HWRF job via the hwrf.launcher.launch(). The hwrf.launcher.load() then reloads that configuration. The launch() function does more than just create the conf file though. It parses the tcvitals, creates several initial files and directories and runs a sanity check on the whole setup.

The HWRFLauncher class is used in place of an hwrf.config.HWRFConfig throughout the HWRF system. It can be used as a drop-in replacement for an hwrf.config.HWRFConfig, but has additional features needed to support sanity checks, initial creation of the HWRF system and tcvitals generation.

Classes

class  HWRFLauncher
 A replacement for the hwrf.config.HWRFConfig used throughout the HWRF system. More...
 

Functions

def multistorm_parse_args
 
def multistorm_priority
 
def parse_launch_args
 Parsed arguments to scripts that launch the HWRF system. More...
 
def load (filename)
 Loads the HWRFLauncher created by the launch() function. More...
 
def launch
 Initializes the directory structure for a new HWRF workflow. More...
 

Variables

list __all__ = ['load','launch','HWRFLauncher','parse_launch_args','multistorm_parse_args']
 All symbols exported by "from hwrf.launcher import *".
 

Function Documentation

def hwrf.launcher.launch (   file_list,
  cycle,
  stid,
  moreopt,
  case_root,
  init_dirs = True,
  prelaunch = None,
  fakestorm = False,
  fakestorm_conf = None,
  storm_num = None 
)

Initializes the directory structure for a new HWRF workflow.

This function runs sanity checks on the HWRF installation and the arguments to this function. If a cycle is supplied, it then calls a prelaunch function, and then generates the configuration file and initial directory structure.

You can run this function in a special mode that just reads the conf file, without specifying a cycle, or making directories. To do that, send cycle=None and init_dirs=False. That mode is used by the script that prepares the rocoto XML file for a multi-cycle workflow.

Returns
the full path to the conf file that is created as a result. That conf file should be passed in to the load() function at the beginning of every job.
Parameters
file_lista list of conf files to read
cyclethe cycle to run; anything accepted by to_datetime
stidthe three character storm identifier for the storm to run. For example, stid=11L is the eleventh storm of the season in the Atlantic basin. Although this argument is optional, the single storm HWRF workflow will fail if stid is not provided.
moreopta dict of dicts with additional options to set. This maps section name to option to value.
case_rootHISTORY for retrospective mode, FORECAST for real-time
init_dirsTrue if the initial directories should be created,
prelauncha function to call on the configuration before writing it to disk. Takes as arguments: conf,logger,cycle Note that the logger or cycle may be None. The conf is the configuration object that will be written.

Definition at line 404 of file launcher.py.

Referenced by hwrf.launcher.load(), scripts.exhwrf_launch.main(), and hwrf.launcher.multistorm_parse_args().

def hwrf.launcher.load (   filename)

Loads the HWRFLauncher created by the launch() function.

Creates an HWRFConfig object for an HWRF workflow that was previously initialized by hwrf.launcher.launch. The only argument is the name of the config file produced by the launch command.

Parameters
filenameThe storm*.conf file created by launch()

Definition at line 297 of file launcher.py.

Referenced by hwrf_expt.init_module(), and hwrf.launcher.HWRFLauncher.sanity_check().

def hwrf.launcher.multistorm_parse_args (   msids,
  args,
  logger,
  usage,
  PARMhwrf = None,
  wrapper = False 
)
This is the multistorm argument parser. It is really just a wrapper around
parse_launch_args().

The last Element of the returned list is the launch args for the Fake storm.

From the original arguments, returns a new list of launch args for all
the storms in a multistorm run. The SID and optional config.startfile
from the original sys.argv[1:] list are replaced with a storm id and a
config.startfile (if present) from the MULTISTORM_SIDS.
The following multistorm conf options are also added to each storm.
config.fakestormid=, config.multistorm_sids=,config.multistorm_priority_sid=,
config.multistorm_sids=,  General structure of the returned list.
[[storm1, arg1, ..argN], ..[stormN, arg1, ..argN], [storm00, arg1, ..argN]]      

INPUT:
args -- a copy of the initial command line args, excluding sys.argv[0]
RETURNS:
case_root,parm,infiles,stids,fake_stid,multistorm_priority_sid,moreopts[]

Definition at line 34 of file launcher.py.

Referenced by scripts.exhwrf_launch.main().

def hwrf.launcher.parse_launch_args (   args,
  logger,
  usage,
  PARMhwrf = None 
)

Parsed arguments to scripts that launch the HWRF system.

This is the argument parser for the exhwrf_launch.py and hwrf_driver.py scripts. It parses the storm ID and later arguments (in args). Earlier arguments are parsed by the scripts themselves. If something goes wrong, this function calls sys.exit(1) or sys.exit(2).

The arguments depend on if PARMhwrf=None or not.

1 If PARMhwrf is None:
2  StormID CASE_ROOT /path/to/parm [options]
3 Otherwise:
4  StormID CASE_ROOT [options]
  • StormID — three character storm identifier (ie.: 12L for Katrina)
  • CASE_ROOT – HISTORY or FORECAST
  • /path/to/parm - path to the parm directory, which contains the default conf files.

Options:

  • section.variable=value — set this value in this section, no matter what
  • /path/to/file.conf — read this conf file after the default conf files.

Later conf files override earlier ones. The conf files read in are:

  • parm/hwrf_input.conf
  • parm/hwrf.conf
  • parm/hwrf_holdvars.conf
  • parm/hwrf_basic.conf
  • parm/system.conf
Parameters
argsthe script arguments, after script-specific ones are removed
loggera logging.Logger for log messages
usagea function called to provide a usage message
PARMhwrfthe directory with *.conf files

Definition at line 170 of file launcher.py.

Referenced by scripts.exhwrf_launch.main(), and hwrf.launcher.multistorm_parse_args().