HWRF
trunk@4391
|
abstract base class of WRFSimulation More...
abstract base class of WRFSimulation
This is the abstract base class of WRFSimulation. You should not instantiate it directly. Its purpose is to combine information about multiple WRFDomainBase objects (or WRFDomain objects) to make a single namelist. It also has the ability to make aggregate changes to those objects, or obtain aggregate information about them. This class exists only to avoid cyclic dependencies.
Definition at line 340 of file wrfbase.py.
Public Member Functions | |
def | copy (self) |
duplicates this object More... | |
def | __init__ |
WRFDomains constructor. More... | |
def | fill_auto_starts |
sets i_parent_start and j_parent_start if needed More... | |
def | fill_auto_starts_multistorm |
def | simstart (self) |
Returns the simulation start time as a datetime.datetime. More... | |
def | simend (self) |
Returns the simulation end time as a datetime.datetime. More... | |
def | timestep (self) |
Returns the simulation timestep as a datetime.time_delta. More... | |
def | nocolons (self) |
Should colons be omitted from filenames? More... | |
def | get_nocolons (self) |
Force a recheck of whether colons be omitted from filenames. More... | |
def | get_io_form (self) |
Gets the default io_form. More... | |
def | set_io_form (self, i) |
Sets the default io_form. More... | |
def | io_form_for (self, stream) |
Returns the io_form for the specified stream. More... | |
def | get_moad (self) |
returns the MOAD as a WRFDomain. More... | |
def | get_last (self) |
returns the last domain added to this WRF. More... | |
def | add_output |
request output from one or more streams More... | |
def | make_restart_time_scalar (self) |
Ensure that only one restart frequency is set. More... | |
def | set_outname (self, stream, outname) |
Set the wrf output filename for a stream. More... | |
def | set_io_form (self, stream, io_form) |
Sets the io_form for the specified stream. More... | |
def | get_io_suffix |
Return the suggested output suffix for filenames. More... | |
def | get (self, what) |
return the specified domain More... | |
def | maxdom (self) |
returns the highest domain number, which is also the number of domains. More... | |
def | can_add (self) |
Can we still add domains to this simulation? More... | |
def | add |
Add a WRFDomain to this simulation. More... | |
def | __getitem__ (self, what) |
Same as self.get(what) More... | |
def | __len__ (self) |
Same as self.maxdom(). More... | |
def | __contains__ (self, what) |
does this simulation contain this domain? More... | |
def | __iter__ (self) |
Iterates over all WRFDomain objects in this WRFDomains. More... | |
Public Attributes | |
nl | |
the hwrf.namelist.Conf2Namelist with domain-independent namelist information like eta_levels and debug=2. More... | |
Properties | |
io_form | |
the default io_form if none is specified More... | |
def hwrf.wrfbase.WRFDomains.__init__ | ( | self, | |
conf, | |||
section, | |||
moad, | |||
simstart, | |||
simend, | |||
timestep = None , |
|||
dup = None |
|||
) |
WRFDomains constructor.
Creates a new WRFDomains object.
conf | the HWRFConfig to provide configuration information |
section | the section to use in that config object |
moad | the Mother of All Domains, as a WRFDomain |
simstart,simend | - simulation start and end times |
timestep | the simulation timestep |
dup | do not use. This is used by the self.copy() do do a deep copy of a WRFDomains. |
Definition at line 392 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.__contains__ | ( | self, | |
what | |||
) |
does this simulation contain this domain?
Returns True if self.get(what) succeeds, and False if it raises KeyError. Any other exceptions are passed to the caller.
what | the grid_id or name of the WRFDomain to search for, or another WRFDomain whose name we should search for. |
Definition at line 827 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.__getitem__ | ( | self, | |
what | |||
) |
Same as self.get(what)
Calls self.get(what)
what | the grid_id, domain name or WRFDomain to search for. |
Definition at line 817 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.__iter__ | ( | self | ) |
Iterates over all WRFDomain objects in this WRFDomains.
Definition at line 840 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.__len__ | ( | self | ) |
Same as self.maxdom().
Definition at line 824 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.add | ( | self, | |
child, | |||
parent = None |
|||
) |
Add a WRFDomain to this simulation.
Adds the child WRFDomain to this WRF, with the specified parent. If the parent is not specified, the last added domain is used as the parent. If specified, the parent may be anything accepted by self.get. The return value is the new WRFDomain.
child | the domain to add |
parent | the WRFDomain of the parent |
Definition at line 767 of file wrfbase.py.
Referenced by produtil.fileop.FileWaiter.add().
def hwrf.wrfbase.WRFDomains.add_output | ( | self, | |
stream = 'history' , |
|||
domain = None , |
|||
io_form = None , |
|||
start = None , |
|||
end = None , |
|||
step = None , |
|||
frames_per_outfile = None , |
|||
outname = None |
|||
) |
request output from one or more streams
Requests that one or all WRF domains output the specified stream. The stream should be "history" or "auxhistN" for an integer N>0. Optional "domain" specifies the domain that should output this stream, otherwise all domains will output it.
stream | the stream: "history" or "auxhistN" for an integer N>0 |
domain | the domain (optional) |
io_form | WRF IO form. Simply calls self.set_io_form(stream,io_form) |
start | output start time (anything accepted by to_datetime) Default: simulation start time. |
end | output end time (anything accepted by to_datetime. Default: simulation end time. |
step | output interval, sent into to_out_interval(). Default: trait stream+"_interval" or 6hrs |
frames_per_outfile | how many output times per output file |
outname | output name or array of output names (one per domain). Can only specify for all domains, not for only one. Default: leave unspecified, and let WRF use its defaults. |
NOTE: You cannot add any more domains after calling this routine.
Definition at line 633 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.get_last().
def hwrf.wrfbase.WRFDomains.can_add | ( | self | ) |
Can we still add domains to this simulation?
Returns true if this WRF can accept new domains. Certain operations, such as requesting output files, end the ability to add domains.
Definition at line 760 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.copy | ( | self | ) |
duplicates this object
Returns a deep copy of this object, providing new data structures so modifying the copy will not modify the original. The underlying WRFDomain objects and their data structures are also duplicated.
Definition at line 349 of file wrfbase.py.
Referenced by produtil.mpiprog.MPIRanksSPMD.__add__(), produtil.mpiprog.MPIRank.__add__(), produtil.mpiprog.MPIRank.__getitem__(), and produtil.prog.ImmutableRunner.runner().
def hwrf.wrfbase.WRFDomains.fill_auto_starts | ( | self, | |
ivalue, | |||
jvalue = None , |
|||
fillthis = '**AUTO**' , |
|||
centerthis = '**CENTERED**' |
|||
) |
sets i_parent_start and j_parent_start if needed
For domains whose i_parent_start or j_parent_start are set automatically (start=centered or start=auto), this fills those domains starts with the provided values. Domains that should be centered in their parent (start=centerthis) are centered relative to their parent if they have one.
ivalue | the i value to set if an external fortran program has to be run to determine the i_parent_start and j_parent_start. |
jvalue | the j value to set. Defaults to the ivalue |
fillthis | do not change - the string to locate for start=auto |
centerthis | do not change - the string to locate for start=centered |
Definition at line 449 of file wrfbase.py.
Referenced by hwrf.wrf.WRFSimulation.swcorner_dynamic().
def hwrf.wrfbase.WRFDomains.fill_auto_starts_multistorm | ( | self, | |
ivalues, | |||
jvalues = None |
|||
) |
For domains whose i_parent_start or j_parent_start are set automatically, this fills those domains starts with the provided values, for the fakestorm of a multistorm run. ivalue = a list of i start values for N storms jvalue = a list of j start values for N storms
Definition at line 513 of file wrfbase.py.
Referenced by hwrf.wrf.WRFSimulation.swcorner_dynamic_multistorm().
def hwrf.wrfbase.WRFDomains.get | ( | self, | |
what | |||
) |
return the specified domain
Returns a domain with the given name or grid_id. This method may raise IndexError or KeyError if the domain does not exist. If passed a WRFDomainBase, then this simulation's copy of the domain with the same name is returned.
what | If this is a string or WRFDomain, then the domain with that name is returned. If "what" is an integer, the domain with that ID is returned. If it is a WRFDomainBase, then the name stored in that object is used instead. |
Definition at line 737 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.__contains__(), hwrf.wrfbase.WRFDomains.__getitem__(), hwrf.wrfbase.WRFDomains.add(), hwrf.wrf.WRFSimulation.analysis_name(), produtil.datastore.UpstreamFile.check(), hwrf.regrib.GRIB1Product.getgrib1grbindex(), hwrf.regrib.GRIB1Product.getgrib1grid(), hwrf.regrib.GRIB1Product.getgrib1index(), hwrf.regrib.GRIB2Product.getgrib2grid(), and hwrf.regrib.GRIB2Product.getgrib2index().
def hwrf.wrfbase.WRFDomains.get_io_form | ( | self | ) |
Gets the default io_form.
Definition at line 603 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.get_io_suffix | ( | self, | |
stream = 'history' |
|||
) |
Return the suggested output suffix for filenames.
Gets the suggested output suffix for the specified stream. Returns "int" for 1 and "nc" for 2 or 11.
stream | the stream. Default: "history" |
Definition at line 723 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.get_last | ( | self | ) |
returns the last domain added to this WRF.
Definition at line 628 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add().
def hwrf.wrfbase.WRFDomains.get_moad | ( | self | ) |
returns the MOAD as a WRFDomain.
Definition at line 625 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add(), and hwrf.wrf.WRFSimulation.analysis_in().
def hwrf.wrfbase.WRFDomains.get_nocolons | ( | self | ) |
Force a recheck of whether colons be omitted from filenames.
Should colons be omitted from filenames? This is determined from the configuration files, if it is specified there, or from the I/O forms selected (some don't support colons). This method guesses the nocolons setting from the WRF/WPS/Real namelist. The result of this calculation is never cached: all namelist options are re-scanned and the flag is recomputed each time. To get the cached value, use the nocolons property instead.
Definition at line 574 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add(), hwrf.wrfbase.WRFDomains.add_output(), hwrf.wrf.WRFSimulation.analysis_name(), and hwrf.wrfbase.WRFDomains.nocolons().
def hwrf.wrfbase.WRFDomains.io_form_for | ( | self, | |
stream | |||
) |
Returns the io_form for the specified stream.
stream | the stream, a lower-case string |
Definition at line 616 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add_output(), hwrf.wrfbase.WRFDomains.get_io_suffix(), and hwrf.wrf.WRFSimulation.set_io_form().
def hwrf.wrfbase.WRFDomains.make_restart_time_scalar | ( | self | ) |
Ensure that only one restart frequency is set.
Unlike most output frequencies, the restart frequency has to be the same for all domains, and is specified as a scalar value, not an array. This function removes per-domain restart frequencies, moving the restart frequency up to the domain-independent namelist values. The frequency used is the one for the last domain listed by self.__iter__.
Definition at line 683 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add_output().
def hwrf.wrfbase.WRFDomains.maxdom | ( | self | ) |
returns the highest domain number, which is also the number of domains.
Definition at line 756 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.__len__(), hwrf.wrfbase.WRFDomains.add(), and hwrf.wrfbase.WRFDomains.fill_auto_starts_multistorm().
def hwrf.wrfbase.WRFDomains.nocolons | ( | self | ) |
Should colons be omitted from filenames?
Should colons be omitted from filenames? This is determined from the configuration files, if it is specified there, or from the I/O forms selected (some don't support colons). The return value may be cached. To ensure the value is recomputed instead, you can call get_nocolons.
Definition at line 562 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.set_io_form | ( | self, | |
i | |||
) |
Sets the default io_form.
Definition at line 606 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add_output(), and hwrf.wrfbase.WRFDomains.set_io_form().
def hwrf.wrfbase.WRFDomains.set_io_form | ( | self, | |
stream, | |||
io_form | |||
) |
Sets the io_form for the specified stream.
Set the io_form for the specified stream. The "history" and "output" streams are synonyms.
stream | the stream |
io_form | the io_form |
Definition at line 713 of file wrfbase.py.
def hwrf.wrfbase.WRFDomains.set_outname | ( | self, | |
stream, | |||
outname | |||
) |
Set the wrf output filename for a stream.
Sets the WRF output filename format for the specified stream to the given name. The name should contain <domain> and <date> if appropriate.
stream | the stream to change |
outname | the new output filename format |
Definition at line 702 of file wrfbase.py.
Referenced by hwrf.wrfbase.WRFDomains.add_output().
def hwrf.wrfbase.WRFDomains.simend | ( | self | ) |
Returns the simulation end time as a datetime.datetime.
Definition at line 554 of file wrfbase.py.
Referenced by hwrf.wrf.WRFSimulation.bdytimes().
def hwrf.wrfbase.WRFDomains.simstart | ( | self | ) |
Returns the simulation start time as a datetime.datetime.
Definition at line 551 of file wrfbase.py.
Referenced by hwrf.wrf.WRFSimulation.analysis_name(), and hwrf.wrf.WRFSimulation.bdytimes().
def hwrf.wrfbase.WRFDomains.timestep | ( | self | ) |
Returns the simulation timestep as a datetime.time_delta.
Definition at line 557 of file wrfbase.py.
hwrf.wrfbase.WRFDomains.nl |
the hwrf.namelist.Conf2Namelist with domain-independent namelist information like eta_levels and debug=2.
The per-domain information is in each WRFDomain contained within this WRFSimulation
Definition at line 405 of file wrfbase.py.
|
static |
the default io_form if none is specified
Definition at line 613 of file wrfbase.py.
Referenced by hwrf.wrf.WRFSimulation.__init__().