HWRF  trunk@4391
Public Member Functions | Public Attributes | List of all members
hwrf.fcsttask.AnalysisCycle Class Reference

runs wrf for an analysis cycle More...

Detailed Description

runs wrf for an analysis cycle

This class is similar to a WRFGhost run, except that it runs a longer simulation (typically 1-6 hours), and provides wrfghost and wrfinput files at the end of it. It also requires wrfghost and wrfinput files as input. Hence, one can run another AnalysisCycle after this one, using the output of the previous. Note that this implementation relies on the fact that wrfghost, wrfanl and restart files are all exactly the same file format (just different times and domains).

Definition at line 1675 of file fcsttask.py.

Inheritance diagram for hwrf.fcsttask.AnalysisCycle:
hwrf.fcsttask.WRFGhost hwrf.fcsttask.WRFAnl hwrf.fcsttask.WRFTaskBase hwrf.fcsttask.FcstTask hwrf.hwrftask.HWRFTask produtil.datastore.Task produtil.datastore.Datum

Public Member Functions

def __init__ (self, dstore, conf, section, wrf, simlen=None, keeprun=False, kwargs)
 runs wrf for an analysis cycle More...
 
def make_products (self)
 called from constructor, creates Products More...
 
def anlouttime (self)
 analysis cycle end time More...
 
def anlintime (self)
 analysis cycle start time More...
 
def simlen (self)
 simulation length More...
 
def make_wrf (self, wrf)
 creates the WRFSimulation object More...
 
def wrfinput_at_time
 the wrfinput_d01 output Product for the specified time and domain More...
 
def get_wrfinput (self)
 the wrfinput_d01 output product More...
 
def deliver_products (self)
 delivers products from temporary areas More...
 
def as_product
 
def products
 iterates over all selected products More...
 
- Public Member Functions inherited from hwrf.fcsttask.WRFGhost
def make_wrf (self, wrf)
 makes the WRFSimulation object for this class. More...
 
def get_ghost (self, domain)
 same as get_wrfanl() More...
 
- Public Member Functions inherited from hwrf.fcsttask.WRFAnl
def make_wrf (self, wrf)
 creates the WRFSimulation object (self.wrf()) More...
 
def anltime (self)
 the time for which analysis files are generated. More...
 
def make_products (self)
 creates FileProduct objects for all wrfanl files. More...
 
def get_wrfanl (self, domain)
 returns the wrfanl product for the specified domain More...
 
def wrfanl_at_time (self, atime, domain)
 get a wrfanl file for a specified domain and analysis time More...
 
def deliver_products (self)
 delivers products during a call to run() More...
 
def products
 iterates over products Iterates over all Product objects that were identified by make_products. More...
 
- Public Member Functions inherited from hwrf.fcsttask.WRFTaskBase
def __init__ (self, dstore, conf, section, wrf, keeprun=True, kwargs)
 constructor More...
 
def make_wrf (self, wrf)
 creates a WRFSimulation object for this class More...
 
def add_geogrid (self, g)
 adds a geogrid input source More...
 
def add_metgrid (self, m)
 adds a metgrid input source More...
 
def add_prep_hybrid (self, p)
 adds a prep_hybrid input source More...
 
def use_prep_hybrid (self)
 returns True if prep_hybrid was requested, and False otherwise. More...
 
def add_wrfinput (self, r)
 adds a wrfinput_d01 input source More...
 
def add_wrfbdy (self, r)
 adds a wrfbdy_d01 input source More...
 
def add_fort65 (self, r)
 adds a coupler fort.65 input source More...
 
def add_real (self, r)
 add a fort.65, wrfinput_d01 and wrfbdy_d01 input source More...
 
def add_wrfanl (self, r, domain)
 add a wrfanl input source for a specific domain More...
 
def make_products (self)
 called from constructor, creates Products More...
 
def link_fix (self)
 links or copies fixed data files More...
 
def check_all_inputs (self)
 Checks to see if all needed input is available. More...
 
def link_all_inputs
 Links all inputs provided by the various add_* member functions. More...
 
def need_all_metgrid (self)
 Returns True if all metgrid files are needed as input to this Task.
 
def run_exe
 runs the executable More...
 
def final_prerun (self)
 last step before running executable More...
 
def initial_prerun (self)
 called immediately after cding to a scrub directory More...
 
def run (self)
 run the wrf or real_nmm More...
 
def postrun (self)
 called just after run_exe() succeeds. More...
 
def deliver_products (self)
 delivers products to their destinations More...
 
def make_namelist
 generates the wrf namelist.input file More...
 
def wrf (self)
 Returns the WRFSimulation object used by this task. More...
 
def sim (self)
 Returns the WRFSimulation object used by this task. More...
 
- Public Member Functions inherited from hwrf.fcsttask.FcstTask
def __init__ (self, dstore, conf, section, outdir=None, taskname=None, kwargs)
 Creates a FcstTask object. More...
 
def has_input (self, typename)
 is there any input data of this type to this task? More...
 
def add_input (self, typename, inobj)
 add input of a specified type More...
 
def check_input (self, typenames, kwargs)
 check if input data is available More...
 
def link_input (self, typenames, just_check=False, kwargs)
 link or check for inputs More...
 
- Public Member Functions inherited from hwrf.hwrftask.HWRFTask
def __init__ (self, dstore, conf, section, taskname=None, workdir=None, outdir=None, storminfo=UNSPECIFIED, taskvars=UNSPECIFIED, kwargs)
 Creates an HWRFTask. More...
 
def isfakestorm (self)
 
def ismultistorm (self)
 
def get_workdir (self)
 Returns the directory the class should work in, as set by the "workdir" metadata value. More...
 
def set_workdir (self, val)
 Sets the directory the class should work in. More...
 
def get_outdir (self)
 Gets the directory that should receive output data. More...
 
def set_outdir (self, val)
 Sets the directory that should receive output data. More...
 
def realtime (self)
 Is this job a real-time forecast job? More...
 
def redirect (self)
 Should subprograms' outputs be redirected to separate files?
 
def scrub (self)
 Should temporary files be deleted as soon as they are not needed?
 
def tvset (self, opt, val)
 Sets a taskvar option's value. More...
 
def tvdel (self, opt)
 Deletes an object-local value set by tvset. More...
 
def tvget (self, opt)
 Gets a taskvar's value. More...
 
def tvhave
 Is a taskvar set? More...
 
def taskvars (self)
 The dict of object-local values used for string substitution. More...
 
def confint
 Alias for self.conf.getint for section self.section. More...
 
def confstr
 Alias for self.conf.getstr for section self.section. More...
 
def conffloat
 Alias for self.conf.getfloat for section self.section. More...
 
def confbool
 Alias for self.conf.getbool for section self.section. More...
 
def confget
 Alias for self.conf.get for section self.section. More...
 
def confitems
 Alias for self.conf.items for section self.section. More...
 
def confstrinterp (self, string, section=None, kwargs)
 Alias for self.icstr for backward compatibility. More...
 
def conftimestrinterp (self, string, ftime, atime=None, section=None, kwargs)
 Alias for self.timestr for backward comaptibility. More...
 
def confraw
 Get a raw configuration value before string expansion. More...
 
def icstr (self, string, section=None, kwargs)
 Expands a string in the given conf section. More...
 
def timestr (self, string, ftime, atime=None, section=None, kwargs)
 Expands a string in the given conf section, including time vars. More...
 
def getdir
 Alias for hwrf.config.HWRFConfig.get() for the "dir" section. More...
 
def getexe
 Alias for hwrf.config.HWRFConfig.get() for the "exe" section. More...
 
def getconf (self)
 Returns this HWRFTask's hwrf.config.HWRFConfig object. More...
 
def getsection (self)
 Returns this HWRFTask's section name in the HWRFConfig. More...
 
def log
 Obtain a logging domain. More...
 
def inputiter (self)
 Iterates over all inputs required by this task. More...
 
- Public Member Functions inherited from produtil.datastore.Task
def __init__ (self, dstore, taskname, logger=None, kwargs)
 Task constructor. More...
 
def jlogfile (self)
 returns the jlogfile logger. More...
 
def postmsg (self, message, args, kwargs)
 same as produtil.log.jlogger.info() More...
 
def setstate (self, val)
 Sets the state of this job. More...
 
def getstate (self)
 Returns the job state. More...
 
def strstate (self)
 A string representation of the job state. More...
 
def gettaskname (self)
 Returns the task name part of the database ID, which is the same as the prodname. More...
 
def products (self, args, kwargs)
 Iterate over the products this task produces. More...
 
def log (self)
 Returns the logger object for this task. More...
 
def clean (self)
 Cleans up any unneeded data used by this task. More...
 
def unrun (self)
 Undoes the effect of run(). More...
 
def run (self)
 Performs the work this Task should do and generates all products. More...
 
def is_completed (self)
 Is this task complete? More...
 
def completed (self)
 Read-only property: is this task completed? Same as is_completed() More...
 
def runpart (self)
 Run some of this task's work, deliver some products. More...
 
- Public Member Functions inherited from produtil.datastore.Datum
def __init__ (self, dstore, prodname, category, meta=None, cache=30, location=None, kwargs)
 Datum constructor. More...
 
def __enter__ (self)
 Acquires this object's thread lock. More...
 
def __exit__ (self, etype, evalue, traceback)
 Releases this object's thread lock. More...
 
def validate (self)
 Validates this object's Datastore, prodname and category. More...
 
def getid (self)
 Returns the database ID of this datum. More...
 
def getdatastore (self)
 Returns the datastore of this datum. More...
 
def transaction (self)
 Creates, but does not lock, a Transaction for this datum's datastore. More...
 
def getprodtype (self)
 Returns the product type of this Datum. More...
 
def getprodname (self)
 Returns the product name part of the database ID. More...
 
def getcategory (self)
 Returns the product category part of the database ID. More...
 
def getlocation (self)
 Returns the "location" field of this Datum's database entry. More...
 
def setlocation (self, v)
 Sets the "location" field of this Datum's database entry. More...
 
def __hash__ (self)
 Integer hash function. More...
 
def __str__ (self)
 Human-readable description of this Datum. More...
 
def __repr__ (self)
 Python code-like description of this Datum. More...
 
def __cmp__ (self, other)
 Compares two Datums' prodnames and categories. More...
 
def set_loc_avail (self, loc, avail)
 Sets the location and availability of this Datum in a single transaction. More...
 
def update (self)
 Discards all cached metadata and refreshes it from the Datastore. More...
 
def __getitem__ (self, k)
 Returns the value of the specified metadata key or raises KeyError. More...
 
def meta
 Return the value of a metadata key. More...
 
def get
 Alias for self.meta() Returns the value of the specified metadata key or returns default if it is unset. More...
 
def __setitem__ (self, k, v)
 Sets the value of the specified metadata key. More...
 
def __delitem__ (self, k)
 Deletes the specified metadata key, which must not be "available" or "location". More...
 
def __contains__ (self, k)
 Determines if a metadata key is set. More...
 
def iteritems (self)
 Iterates over all metadata (key,value) pairs for this Datum, including "available" and "location". More...
 

Public Attributes

 prod_wrfinput
 the wrfinput output file at the end of the simulation
 
- Public Attributes inherited from hwrf.fcsttask.WRFTaskBase
 dt_epsilon
 epsilon value for time equality comparisons
 
 keeprun
 if False, temporary files are deleted, otherwise they're kept
 
 location
 
- Public Attributes inherited from hwrf.fcsttask.FcstTask
 inputs
 a mapping of typename to a list of input objects
 
- Public Attributes inherited from hwrf.hwrftask.HWRFTask
 storminfo
 The hwrf.storminfo.StormInfo describing the vitals information for the storm processed by this HWRFTask. More...
 

Additional Inherited Members

- Properties inherited from hwrf.hwrftask.HWRFTask
 workdir
 The directory in which this task should be run. More...
 
 outdir
 The directory in which this task should deliver its final output. More...
 
 conf
 This HWRFTask's hwrf.config.HWRFConfig object. More...
 
 section
 The confsection in self.section for this HWRFTask (read-only) More...
 
- Properties inherited from produtil.datastore.Task
 state
 Read-write property: the job state. More...
 
 taskname
 Read-only property: the name of this task. More...
 
- Properties inherited from produtil.datastore.Datum
 prodname = property(getprodname,None,None,)
 Read-only property, an alias for getprodname(): the product name part of the database ID. More...
 
 category = property(getcategory,None,None,)
 Read-only property, an alias for getcategory(), the category name part of the database ID. More...
 
 prodtype
 Read-only property, an alias for getprodtype(), the product type. More...
 
 did
 Read-only property, an alias for getid(). More...
 
 dstore
 Read-only property, an alias for getdatastore(), the Datastore in which this Datum resides. More...
 
 location
 Read-write property, an alias for getlocation() and setlocation(). More...
 

Constructor & Destructor Documentation

def hwrf.fcsttask.AnalysisCycle.__init__ (   self,
  dstore,
  conf,
  section,
  wrf,
  simlen = None,
  keeprun = False,
  kwargs 
)

runs wrf for an analysis cycle

This class is similar to a WRFGhost run, except that it runs a longer simulation (typically 1-6 hours), and provides wrfghost and wrfinput files at the end of it. It also requires wrfghost and wrfinput files as input. Hence, one can run another AnalysisCycle after this one, using the output of the previous. Note that this implementation relies on the fact that wrfghost, wrfanl and restart files are all exactly the same file format (just different times and domains). constructor for AnalysisCycle

Constructor for the AnalysisCycle class.

Parameters
dstorethe produtil.datastore.Datastore to use
confthe hwrf.config.HWRFConfig that provides configuration ifnormation
sectionthe config section in conf
wrfthe hwrf.wrf.WRFSimulation object that is being run
keeprunif True, the simulation temporary files are not deleted
simlensimulation length in seconds
kwargspassed unmodified to FcstTask.__init__()

Definition at line 1687 of file fcsttask.py.

Member Function Documentation

def hwrf.fcsttask.AnalysisCycle.anlintime (   self)

analysis cycle start time

The time at beginning of the analysis cycle, at which the input wrfanl and wrfinput files must be provided.

Definition at line 1744 of file fcsttask.py.

def hwrf.fcsttask.AnalysisCycle.anlouttime (   self)

analysis cycle end time

The time at end of the analysis cycle, at which the output wrfanl and wrfinput files are available.

Definition at line 1736 of file fcsttask.py.

Referenced by hwrf.fcsttask.AnalysisCycle.deliver_products().

def hwrf.fcsttask.AnalysisCycle.as_product (   self,
  wrfout,
  relocate = False 
)
Converts a WRFOutput to a Product.

Returns a Product for a WRFOutput.  The Product is cached in
self.__prodcache and as_product() will return that cached
value if one is available.  Otherwise, a new one is created.
Call clear_cached_products() to clear the cache..

Definition at line 1867 of file fcsttask.py.

Referenced by hwrf.wrf.ExternalWRFTask.products(), and hwrf.fcsttask.AnalysisCycle.products().

def hwrf.fcsttask.AnalysisCycle.deliver_products (   self)

delivers products from temporary areas

Copies output products from temporary areas to long-term storage locations.

Definition at line 1835 of file fcsttask.py.

Referenced by hwrf.mpipomtc.POMInit.run(), hwrf.ww3.WW3Init.run(), hwrf.finalmergetask.FinalMergeTask.run(), hwrf.wps.Geogrid.run(), hwrf.gsi.GSIBase.run(), hwrf.wps.Ungrib.run(), hwrf.wps.Metgrid.run(), and hwrf.relocate.Merge.run().

def hwrf.fcsttask.AnalysisCycle.get_wrfinput (   self)

the wrfinput_d01 output product

Returns
the output wrfinput Product

Definition at line 1830 of file fcsttask.py.

Referenced by hwrf.relocate.RelocationTask.wrfinput_at_time(), and hwrf.relocate.Stage3.wrfinput_at_time().

def hwrf.fcsttask.AnalysisCycle.make_products (   self)

called from constructor, creates Products

This is called from the WRFTaskBase constructor. It creates products that will be used by deliver_products() and products()

Definition at line 1707 of file fcsttask.py.

def hwrf.fcsttask.AnalysisCycle.make_wrf (   self,
  wrf 
)

creates the WRFSimulation object

Called from the constructor. Generates and returns a new WRFSimulation object that meets these requirements:

  1. Read in wrfanl and wrfinput files
  2. Output a restart and wrfinput file after self.simlen time
  3. Disable history and auxhist 1-3.
    Parameters
    wrfthe wrf argument to init

Definition at line 1762 of file fcsttask.py.

def hwrf.fcsttask.AnalysisCycle.products (   self,
  domain = None,
  domains = None,
  stream = None,
  time = None,
  relocate = False 
)

iterates over all selected products

Iterates over all products for the specified domain, or all products if the domain is unspecified or None.

Parameters
domainthe requested domain (an integer, string name or WRFDomain)
domainsa list of domains of interest
timethe analysis time
streamthe output stream

Definition at line 1889 of file fcsttask.py.

Referenced by hwrf.wrf.ExternalWRFTask.__init__(), hwrf.tracker.TrackerTask.call_completed_callbacks(), hwrf.wps.WPSTask.deliver_products(), hwrf.relocate.RelocationTask.deliver_products(), hwrf.wps.WPSTask.undeliver_products(), hwrf.prep.PrepHybrid.unrun(), hwrf.post.PostManyWRF.unrun(), hwrf.wrf.ExternalWRFTask.unrun(), and hwrf.wrf.ExternalWRFTask.wrf_check().

def hwrf.fcsttask.AnalysisCycle.simlen (   self)

simulation length

The requested length of the simulation. Note that this may not be the same as the actual simulation length (self.anlouttime-self.anlintime) due to the model timestep.

Definition at line 1752 of file fcsttask.py.

Referenced by hwrf.fcsttask.AnalysisCycle.make_wrf().

def hwrf.fcsttask.AnalysisCycle.wrfinput_at_time (   self,
  atime = None,
  domain = None 
)

the wrfinput_d01 output Product for the specified time and domain

Returns
the wrfinput output Product for the specified time and domain or None if that time and domain are not valid.
Parameters
atimethe time
domainthe domain (integer, string name or WRFDomain)

Definition at line 1817 of file fcsttask.py.


The documentation for this class was generated from the following file: