HWRF  trunk@4391
Public Member Functions | List of all members
hwrf.post.PostOneWRF Class Reference

This is an HWRFTask that post-processes output data for a single WRF stream, from several WRF domains at a a given time. More...

Detailed Description

This is an HWRFTask that post-processes output data for a single WRF stream, from several WRF domains at a a given time.

Definition at line 212 of file post.py.

Inheritance diagram for hwrf.post.PostOneWRF:
hwrf.hwrftask.HWRFTask produtil.datastore.Task produtil.datastore.Datum

Public Member Functions

def __init__ (self, wrf, domains, conf, section, time, stream='history', needcrtm=True, grib=1, faketime=None, taskname=None, kwargs)
 PostOneWRF constructor. More...
 
def product_name (self, domain)
 Returns a human readable string representation of the product name for the given domain. More...
 
def wrf (self)
 Returns the WRFSimulation object. More...
 
def wrftask (self)
 Returns the Task that represents the running WRF simulation. More...
 
def products (self, args, kwargs)
 Iterates over products. More...
 
def make_control (self, stream)
 Makes the post control file for the specified stream as the file fort.14 in the local directory. More...
 
def link_fix (self)
 Calls link_post_fix() to link fix files. More...
 
def requested_time (self)
 Returns the forecast time that is being processed. More...
 
def domains (self)
 Iterates over all domains that will be processed. More...
 
def domprod (self)
 Iterates over wrf domains and products. More...
 
def del_post_output (self)
 Deletes any post output files from the current working directory. More...
 
def check_post (self, retval, what)
 Calls check_post() to see if the post succeeded. More...
 
def can_run (self)
 Returns True if the needed inputs are available for the post, and False if they are not. More...
 
def run
 Runs the post for one forecast time and all WRF domains. 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...
 

Additional Inherited Members

- Public Attributes inherited from hwrf.hwrftask.HWRFTask
 storminfo
 The hwrf.storminfo.StormInfo describing the vitals information for the storm processed by this HWRFTask. More...
 
- 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.post.PostOneWRF.__init__ (   self,
  wrf,
  domains,
  conf,
  section,
  time,
  stream = 'history',
  needcrtm = True,
  grib = 1,
  faketime = None,
  taskname = None,
  kwargs 
)

PostOneWRF constructor.

Parameters
wrfthe hwrf.fcsttask.WRFTaskBase or subclass, whose data is being posted
domainslist of domains to post, as hwrf.wrf.WRFDomain objects
confthe hwrf.config.HWRFConfig that provides configuration ifnormation
sectionthe config section in conf
timethe forecast time being posted
streamthe WRF stream to post
needcrtmdo we need CRTM fix files?
gribGRIB version: 1 or 2
faketimeunused
tasknamethe task name in the database
kwargsadditional keyword arguments passed to hwrf.hwrftask.HWRFTask.__init__

Definition at line 216 of file post.py.

Member Function Documentation

def hwrf.post.PostOneWRF.can_run (   self)

Returns True if the needed inputs are available for the post, and False if they are not.

Definition at line 350 of file post.py.

def hwrf.post.PostOneWRF.check_post (   self,
  retval,
  what 
)

Calls check_post() to see if the post succeeded.

Parameters
retvalthe post return value
whatString description of what the post was run on (for log messages)
Returns
True if the post succeeded, False otherwise

Definition at line 344 of file post.py.

Referenced by hwrf.post.PostOneWRF.run().

def hwrf.post.PostOneWRF.del_post_output (   self)

Deletes any post output files from the current working directory.

Definition at line 337 of file post.py.

Referenced by hwrf.post.PostOneWRF.run().

def hwrf.post.PostOneWRF.domains (   self)

Iterates over all domains that will be processed.

Definition at line 325 of file post.py.

Referenced by hwrf.post.PostManyWRF.__init__(), hwrf.wps.WPSTask.deliver_products(), and hwrf.wps.Geogrid.make_products().

def hwrf.post.PostOneWRF.domprod (   self)

Iterates over wrf domains and products.

Iterates over tuples (domain,wrfproduct,myproduct) where domain is the WRF domain, wrfproduct is the WRF output Product from that domain for the chosen time and myproduct is the output EGRIB1Product for that time.

Definition at line 328 of file post.py.

Referenced by hwrf.post.PostOneWRF.can_run(), and hwrf.post.PostOneWRF.run().

def hwrf.post.PostOneWRF.link_fix (   self)

Calls link_post_fix() to link fix files.

Definition at line 315 of file post.py.

Referenced by hwrf.post.PostOneWRF.run(), hwrf.wps.Geogrid.run(), hwrf.wps.Ungrib.run(), and hwrf.wps.Metgrid.run().

def hwrf.post.PostOneWRF.make_control (   self,
  stream 
)

Makes the post control file for the specified stream as the file fort.14 in the local directory.

Figure out what control file to use from the conf section for this task. We look for a stream-specific one first (ie.: "auxhist2_control"). If that is missing we use a default control file from the "control" variable. The control file is then copied to fort.14.

Bug:
this function should use deliver_file with logging

Definition at line 296 of file post.py.

Referenced by hwrf.post.PostOneWRF.run().

def hwrf.post.PostOneWRF.product_name (   self,
  domain 
)

Returns a human readable string representation of the product name for the given domain.

This is used for filenames and product ids.

Parameters
domainthe domain of interes

Definition at line 262 of file post.py.

Referenced by hwrf.post.PostOneWRF.__init__(), and hwrf.post.PostOneWRF.run().

def hwrf.post.PostOneWRF.products (   self,
  args,
  kwargs 
)

Iterates over products.

If the domain keyword is in kwargs, then only the specified domain is iterated. If the domains keyword is in kwargs, then that list of domains is iterated.

Parameters
args,kwargsargument list

Definition at line 280 of file post.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.post.PostOneWRF.requested_time (   self)

Returns the forecast time that is being processed.

Definition at line 322 of file post.py.

def hwrf.post.PostOneWRF.run (   self,
  nosleep = False,
  raiseall = False 
)

Runs the post for one forecast time and all WRF domains.

Parameters
nosleepIf True, disable sleep calls.
raiseallIf True, do not catch exceptions.

Definition at line 364 of file post.py.

Referenced by produtil.datastore.Task.runpart().

def hwrf.post.PostOneWRF.wrf (   self)

Returns the WRFSimulation object.

Definition at line 274 of file post.py.

Referenced by hwrf.post.PostManyWRF.__init__(), hwrf.post.PostManyWRF.products(), and hwrf.post.PostManyWRF.taskname_for().

def hwrf.post.PostOneWRF.wrftask (   self)

Returns the Task that represents the running WRF simulation.

Definition at line 277 of file post.py.

Referenced by hwrf.post.PostManyWRF.__init__().


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