HWRF
trunk@4391
|
Insert config file data into a Fortran namelist file. More...
Insert config file data into a Fortran namelist file.
This class parses an input file that contains a partial namelist, inserting missing values of the format <s:cycle> with values from a ConfigParser-like object. The <s:cycle> sorts of text follow a specific format:
<d:varname> – the conf variable is converted to a datetime.datetime using hwrf.numerics.to_datetime, and then to a string of the format "YYYY-MM-DD_HH:MM:SS". If atime is specified to the parse subroutine, then the value is allowed to be a difference relative to the atime (as accepted by hwrf.numerics.to_datetime_rel).
<u:varname> – convert the conf variable to a string, and dump its value unquoted. This is used, for example, to have the name of a namelist variable be generated from a conf file.
You can also specify angle braces without a type:
<varname>
to ask for the variable to be converted by guessing the type that was intended in the conf file. For example:
This conf file:
With this namelist:
will produce:
As for variables, one can request a subitem of a variable:
for subscriptable types. This is mainly intended for vitals.
Definition at line 154 of file namelist.py.
Static Public Attributes | |
tuple | find_ltgt = re.compile() |
regular expression that finds namelist insertion data <...> | |
tuple | nlfalse = re.compile('\A(?i)(?:f.*|.false.|n|no|0*[1-9][0-9]*)\Z') |
regular expression that matches false values | |
tuple | nltrue = re.compile('\A(?i)(?:t.*|.true.|y|yes|0)\Z') |
regular expression that matches true values | |