HWRF
trunk@4391
|
parses UNIX conf files and makes the result readily available More...
parses UNIX conf files and makes the result readily available
The hwrf.config module reads configuration information for the HWRF system from one or more *.conf files, via the Python ConfigParser module. This module also automatically fills in certain information, such as fields calculated from the tcvitals or date. The result is accessible via the HWRFConfig class, which provides many ways of automatically accessing configuration options.
Classes | |
class | ConfFormatter |
Internal class that implements HWRFConfig.strinterp() More... | |
class | ConfTimeFormatter |
internal function that implements time formatting More... | |
class | Environment |
returns environment variables, allowing substitutions More... | |
class | HWRFConfig |
a class that contains configuration information More... | |
Functions | |
def | confwalker (conf, start, selector, acceptor, recursevar) |
walks through a ConfigParser-like object performing some action More... | |
def | from_file (filename) |
Reads the specified conf file into an HWRFConfig object. More... | |
def | from_string (confstr) |
Reads the given string as if it was a conf file into an HWRFConfig object. More... | |
Variables | |
list | __all__ = ['from_file','from-string','confwalker','HWRFConfig','fordriver','ENVIRONMENT'] |
decides what symbols are imported by "from hwrf.config import *" | |
tuple | ENVIRONMENT = Environment() |
an Environment object. More... | |
dictionary | FCST_KEYS |
the list of forecast time keys recognized by ConfTimeFormatter More... | |
dictionary | ANL_KEYS |
the list of analysis time keys recognized by ConfTimeFormatter More... | |
dictionary | ANL_M6_KEYS |
dictionary | ANL_P6_KEYS |
tuple | TIME_DIFF_KEYS = set(['fahr','famin','fahrmin']) |
the list of "forecast time minus analysis time" keys recognized by ConfTimeFormatter | |
tuple | NOTFOUND = object() |
a special constant that represents a key not being found | |
def hwrf.config.confwalker | ( | conf, | |
start, | |||
selector, | |||
acceptor, | |||
recursevar | |||
) |
walks through a ConfigParser-like object performing some action
Recurses through a ConfigParser-like object "conf" starting at section "start", performing a specified action. The special variable whose name is in recursevar specifies a list of additional sections to recurse into. No section will be processed more than once, and sections are processed in breadth-first order. For each variable seen in each section (including recursevar), this will call selector(sectionname, varname) to see if the variable should be processed. If selector returns True, then acceptor(section, varname, value) will be called.
conf | the ConfigParser-like object |
start | the starting section |
selector | a function selector(section,option) that decides if an option needs processing (True) or not (False) |
acceptor | a function acceptor(section,option,value) run on all options for which the selector returns True |
recursevar | an option in each section that lists more sections the confwalker should touch. If the selector returns True for the recursevar, then the recursevar will be sent to the acceptor. However, it will be scanned for sections to recurse into even if the selector rejects it. |
def hwrf.config.from_file | ( | filename | ) |
Reads the specified conf file into an HWRFConfig object.
Creates a new HWRFConfig object and instructs it to read the specified file.
filename | the path to the file that is to be read |
def hwrf.config.from_string | ( | confstr | ) |
Reads the given string as if it was a conf file into an HWRFConfig object.
Creates a new HWRFConfig object and reads the string data into it as if it was a config file
confstr | the config data |
hwrf.config.ANL_KEYS |
the list of analysis time keys recognized by ConfTimeFormatter
dictionary hwrf.config.ANL_M6_KEYS |
dictionary hwrf.config.ANL_P6_KEYS |
hwrf.config.ENVIRONMENT = Environment() |
an Environment object.
You should never need to instantiate another one.
hwrf.config.FCST_KEYS |
the list of forecast time keys recognized by ConfTimeFormatter