HWRF
trunk@4391
|
A domain in a WRF simulation. More...
A domain in a WRF simulation.
This subclass of WRFDomainsBase adds needed details that let it provide information about a domain in a WRF simulation. It can predict output and input filenames based on timesteps and start/end times. It can do complex manipulations of the WRF namelist. Most functionality should be accessed via the WRFSimulation, after a WRFDomain is created.
Note that after you provide a WRFDomain to a WRFSimulation, the WRFSimulation makes its own copy of that WRFDomain. The original is unmodified. That means that if you want details on the namelist and output files added by the WRFSimultion, you must obtain its copy of the WRFDomain like so:
In this example, the sim_moad, sim_storm1inner and sim_storm1outer will be new objects, contained within the WRFSimulation named "wrf". They will contain additional information about the WRFDomain that is not in the original moad, storm1inner and storm1outer.
Public Member Functions | |
def | __init__ |
WRFDomain constructor. More... | |
def | add_hifreq (self) |
def | moad_ratio (self) |
Returns the nesting ratio between this domain and the MOAD. More... | |
def | getdt (self) |
Returns the timestep for this domain. More... | |
def | __repr__ (self) |
A string description of this domain. | |
def | copy (self) |
Returns a deep copy of this object. More... | |
def | set_timing (self, start, end, timestep) |
Sets start and end times and timestep. More... | |
def | get_grid_id (self) |
Returns the WRF grid id. More... | |
def | is_moad (self) |
Is this the outermost domain? More... | |
def | nx (self) |
The number of grid cells the X direction. More... | |
def | ny (self) |
The number of grid cells the Y direction. More... | |
def | nz (self) |
The number of grid cells the Z direction. More... | |
def | init_domain (self, grid_id) |
Internal helper function that initializes variables common to all domains. More... | |
def | init_as_moad (self, simstart, simend, simdt, eta_levels) |
Called by WRFSimulation to initialize this as the outermost domain. More... | |
def | init_as_nest (self, parent, grid_id, start, end) |
Called by WRFSimulation to initialize this domain as a nest. More... | |
def | make_namelist (self) |
Creates the WRF namelist contents and returns it as a string. More... | |
def | has_output (self, stream) |
Returns True if the domain will output to the specified stream. More... | |
def | get_output_range (self, stream) |
Returns the range of times that has output for the given stream. More... | |
def | hifreq_file (self) |
Returns the hifreq filename for this domain. More... | |
def | trackpatcf_file (self) |
def | get_all_outputs |
Iterate over all output files for a specified time. More... | |
def | get_outputs (self, stream) |
Iterates over all outputs for a specified stream. More... | |
def | get_output |
Get output for a specified time and stream. More... | |
def | no_output (self, stream) |
Forget that output was requested for a given stream. More... | |
def | hide_output (self, stream) |
Disable output for a specified stream, if the stream was requested before. More... | |
def | add_output |
Adds output to the specified stream. More... | |
def | interval_for (self, stream) |
Return the output interval for the stream. More... | |
![]() | |
def | __init__ |
Creates a new WRFDomainBase. More... | |
def | __hash__ (self) |
an integer representation for hashing | |
def | __repr__ (self) |
a detailed string representation | |
def | __cmp__ (self, other) |
integer comparison for sorting, like the cmp function. More... | |
def | __str__ (self) |
synonym for repr() | |
def | get_anl_time (self) |
returns the analysis time More... | |
def | get_grid_id (self) |
Raises NotImplementedError. More... | |
def | remove_forbidden (self) |
removes forbidden namelist entries More... | |
def | copy (self) |
Returns a copy of this object. More... | |
def | set_timing (self, start, end, timestep) |
sets the start and end times of this domain, and the domain timestep More... | |
def | init_domain (self, grid_id) |
initializes grid ID and non-nesting-related variables More... | |
def | init_as_moad (self, simstart, simend, simdt, eta_levels) |
initializes this domain as the outermost domain More... | |
def | init_as_nest (self, parent, grid_id, start, end) |
initializes this domain as a nest More... | |
def | make_namelist (self) |
creates the wrf namelist as a string, and returns it. More... | |
Public Attributes | |
nestlevel | |
The WRF domain nesting level. | |
parent | |
The parent WRFDomain. | |
nocolons | |
True if colons should be omitted from filenames. | |
dx | |
the resolution in the rotated longitude direction | |
dy | |
the resolution in the rotated latitude direction | |
nl | |
The hwrf.namelist.Conf2Namelist for this domain. | |
name | |
The name of this domain. More... | |
![]() | |
nestlevel | |
the wrf nesting level | |
parent | |
the parent domain | |
nocolons | |
should colons be eliminated from filenames? | |
nl | |
the hwrf.namelist.Conf2Namelist with namelist information for this domain | |
name | |
the name of this domain | |
Properties | |
dt = property(getdt,None,None,'The timestep for this domain.') | |
read-only property containing the domain timestep | |
def hwrf.wrf.WRFDomain.__init__ | ( | self, | |
conf, | |||
section, | |||
name = None , |
|||
copy = None |
|||
) |
def hwrf.wrf.WRFDomain.add_output | ( | self, | |
stream, | |||
start = None , |
|||
end = None , |
|||
step = None , |
|||
outname = None , |
|||
frames_per_outfile = None , |
|||
io_form = None , |
|||
simstart = None |
|||
) |
Adds output to the specified stream.
Other arguments are optional:
stream | the stream: "history" or "auxhistN" for an integer N>0 |
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 |
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. |
frames_per_outfile | how many output times per output file |
io_form | WRF IO form. Simply calls self.set_io_form(stream,io_form) |
simstart | the simulation start time which must be provided fi start or end times are given |
Definition at line 553 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.hide_output().
def hwrf.wrf.WRFDomain.copy | ( | self | ) |
Returns a deep copy of this object.
Returns a deep copy of this object. The copy has its own data structures, so modifying the copy will not modify the original.
Definition at line 240 of file wrf.py.
Referenced by produtil.mpiprog.MPIRanksSPMD.__add__(), produtil.mpiprog.MPIRank.__add__(), produtil.mpiprog.MPIRank.__getitem__(), produtil.prog.ImmutableRunner.runner(), hwrf.wrf.WRFSimulation.swcorner_dynamic(), and hwrf.wrf.WRFSimulation.swcorner_dynamic_multistorm().
def hwrf.wrf.WRFDomain.get_all_outputs | ( | self, | |
time = None |
|||
) |
def hwrf.wrf.WRFDomain.get_grid_id | ( | self | ) |
Returns the WRF grid id.
Definition at line 261 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.hifreq_file(), hwrf.wrf.WRFDomain.is_moad(), and hwrf.wrf.WRFDomain.trackpatcf_file().
def hwrf.wrf.WRFDomain.get_output | ( | self, | |
stream, | |||
time, | |||
logger = None |
|||
) |
Get output for a specified time and stream.
Returns a WRFOutput object for the output file for the specified stream and time, or None if no such file exists. Will return the first output time not before the given time.
stream | the desired stream |
time | the desired time |
logger | if specified, a logging.Logger to log to |
Definition at line 491 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.get_all_outputs().
def hwrf.wrf.WRFDomain.get_output_range | ( | self, | |
stream | |||
) |
Returns the range of times that has output for the given stream.
stream | the stream for whom output is requested |
Definition at line 389 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.get_output(), and hwrf.wrf.WRFDomain.get_outputs().
def hwrf.wrf.WRFDomain.get_outputs | ( | self, | |
stream | |||
) |
Iterates over all outputs for a specified stream.
Iterates over all output files for the specified stream, as WRFOutput objects.
stream | the string name of the output stream |
Definition at line 468 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.get_all_outputs().
def hwrf.wrf.WRFDomain.getdt | ( | self | ) |
def hwrf.wrf.WRFDomain.has_output | ( | self, | |
stream | |||
) |
Returns True if the domain will output to the specified stream.
Checks the internal data structures maintained by add_output to see if output was requested for the specified stream.
stream | the stream to check |
Definition at line 379 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.get_output_range().
def hwrf.wrf.WRFDomain.hide_output | ( | self, | |
stream | |||
) |
Disable output for a specified stream, if the stream was requested before.
If output is enabled for the specified stream, moves the output start time to after the end of the simulation. That way any WRF code relying on the output frequency will still work, but no output will be generated. Will not work for restart stream since that is not controlled on a per-domain basis. Note that code that queries the output times will break if this is called.
stream | the string name of the stream of disinterest |
def hwrf.wrf.WRFDomain.hifreq_file | ( | self | ) |
Returns the hifreq filename for this domain.
Definition at line 409 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.trackpatcf_file().
def hwrf.wrf.WRFDomain.init_as_moad | ( | self, | |
simstart, | |||
simend, | |||
simdt, | |||
eta_levels | |||
) |
Called by WRFSimulation to initialize this as the outermost domain.
Do not call this function directly. It is called by the WRFSimulation to initialize the domain as the Mother Of All Domains (MOAD).
simstart | the simulation start time |
simend | the simulation end time |
simdt | the outermost domain timestep |
eta_levels | the NMM eta levels |
def hwrf.wrf.WRFDomain.init_as_nest | ( | self, | |
parent, | |||
grid_id, | |||
start, | |||
end | |||
) |
Called by WRFSimulation to initialize this domain as a nest.
Do not call this function directly. It is called by the WRFSimulation to initialize the domain as a nest
parent | the parent WRFDomain |
grid_id | the integer grid_id |
start | the domain start time |
end | the domain end time |
def hwrf.wrf.WRFDomain.init_domain | ( | self, | |
grid_id | |||
) |
Internal helper function that initializes variables common to all domains.
Initializes domain variables that are needed by all domains. This is called as a helper function to the other domain initialization variables.
Definition at line 284 of file wrf.py.
Referenced by hwrf.wrfbase.WRFDomainBase.init_as_nest().
def hwrf.wrf.WRFDomain.interval_for | ( | self, | |
stream | |||
) |
def hwrf.wrf.WRFDomain.is_moad | ( | self | ) |
Is this the outermost domain?
Returns True if this is the WRF Mother of All Domains (MOAD) and False otherwise. The MOAD is the outermost domain.
Definition at line 264 of file wrf.py.
Referenced by hwrf.wrf.WRFDomain.add_output(), and hwrf.wrf.WRFDomain.hide_output().
def hwrf.wrf.WRFDomain.make_namelist | ( | self | ) |
def hwrf.wrf.WRFDomain.moad_ratio | ( | self | ) |
def hwrf.wrf.WRFDomain.no_output | ( | self, | |
stream | |||
) |
Forget that output was requested for a given stream.
Removes the specified stream from the internal data structures. Its output will revert to the WRF default, and will be unavailable via this WRFDomain.
stream | the string name of the stream of disinterest |
def hwrf.wrf.WRFDomain.nx | ( | self | ) |
def hwrf.wrf.WRFDomain.ny | ( | self | ) |
def hwrf.wrf.WRFDomain.nz | ( | self | ) |
def hwrf.wrf.WRFDomain.set_timing | ( | self, | |
start, | |||
end, | |||
timestep | |||
) |
Sets start and end times and timestep.
Sets this WRFDomain's idea of the simulation start and end times and timestep.
start | the start time of the domain |
end | the end time of the domain |
timestep | the domain's timestep |
Definition at line 247 of file wrf.py.
Referenced by hwrf.wrfbase.WRFDomainBase.init_as_nest().
def hwrf.wrf.WRFDomain.trackpatcf_file | ( | self | ) |
hwrf.wrf.WRFDomain.name |
The name of this domain.
Definition at line 192 of file wrf.py.
Referenced by hwrf.wrfbase.WRFDomainBase.__cmp__(), hwrf.wrfbase.WRFDomainBase.__hash__(), hwrf.wrfbase.WRFDomainBase.__repr__(), hwrf.wrf.WRFDomain.__repr__(), hwrf.wrf.WRFDomain.init_as_nest(), and produtil.cluster.NOAAWCOSS.production().