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

This is a wrapper around the hwrf_nhc_products Fortran program. More...

Detailed Description

This is a wrapper around the hwrf_nhc_products Fortran program.

Definition at line 26 of file nhc_products.py.

Inheritance diagram for hwrf.nhc_products.NHCProducts:
hwrf.hwrftask.HWRFTask produtil.datastore.Task produtil.datastore.Datum

Public Member Functions

def __init__ (self, dstore, conf, section, wrftask, track, domains, vitals, stream='auxhist1', fcstlen=126, kwargs)
 NHCProducts constructor. More...
 
def canrun
 Determines if the hwrf_nhc_products program can be run yet. More...
 
def get_res_cutoff
 Calculates resolution cutoff information. More...
 
def nesting_level (self, moad, nest)
 Determines the nesting level Determines the nesting level of the specified nest relative to the given moad. More...
 
def write_namelist (self, f, wrf, moad, inner)
 Writes the products.nml namelist file. More...
 
def product (self, name)
 Convenience function that returns the product with the given name, or raises KeyError if none is found. More...
 
def wrfdiag_products
 Iterates over wrfdiag file products. More...
 
def products
 Returns Product objects describing files produced by this Task. More...
 
def run
 Copies inputs, runs the hwrf_nhc_input, and delivers results. More...
 
def rewrite_swath_ctl (self, ctlfile)
 Modifies the swath.ctl file to point to a lower-case swath.dat filename. More...
 
def deliver_outlist (self)
 Reads the "outlist" output file from hwrf_nhc_products and delivers the listed files to the com directory. More...
 
def deliver_wrfdiag (self)
 Delivers wrfdiag files to their destination. 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

 state
 
- 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.nhc_products.NHCProducts.__init__ (   self,
  dstore,
  conf,
  section,
  wrftask,
  track,
  domains,
  vitals,
  stream = 'auxhist1',
  fcstlen = 126,
  kwargs 
)

NHCProducts constructor.

Parameters
dstorethe produtil.datastore.Datastore
confthe HWRFConfig object
sectionthe config section to use
wrftaskthe ExternalWRFTask, WRFAtmos or WRFCoupledPOM, or similar task, that can provide wrfdiag files and other WRF outputs.
trackthe final tracker output Product
domainsthe list of WRFDomains whose wrfdiag files should be processed
vitalsthe tcvitals
streamthe WRF output stream for wrfdiag files
fcstlenforecast length in hours
kwargsOther keyword arguments are passed to the superclass constructor.

Definition at line 29 of file nhc_products.py.

Member Function Documentation

def hwrf.nhc_products.NHCProducts.canrun (   self,
  silent = True 
)

Determines if the hwrf_nhc_products program can be run yet.

Parameters
silentIf silent=True, does not log anything.
Returns
True if the program can run, False otherwise

Definition at line 92 of file nhc_products.py.

def hwrf.nhc_products.NHCProducts.deliver_outlist (   self)

Reads the "outlist" output file from hwrf_nhc_products and delivers the listed files to the com directory.

Definition at line 384 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.run().

def hwrf.nhc_products.NHCProducts.deliver_wrfdiag (   self)

Delivers wrfdiag files to their destination.

Definition at line 446 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.run().

def hwrf.nhc_products.NHCProducts.get_res_cutoff (   self,
  wrf,
  fudge_factor = 0.8 
)

Calculates resolution cutoff information.

Calculates the outermost radius from the domain center at which the storm center can be, while still considered to be resolved by that domain. This is used to detect failures of the nest motion, and report which nests actually contain the storm. Iterates over radii for each nest, yielding a radius in km.

Parameters
wrfthe hwrf.wrf.WRFSimulation being run
fudge_factorfudge factor to reduce resolution to politically correct values

Definition at line 117 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.write_namelist().

def hwrf.nhc_products.NHCProducts.nesting_level (   self,
  moad,
  nest 
)

Determines the nesting level Determines the nesting level of the specified nest relative to the given moad.

If nest=moad, the result is 0, if nest is the direct child of moad, then 1, if it is the grandchild, then 2, and so on.

Parameters
moadthe outermost domain
nestthe nest of interest
Returns
the nesting level, an integer

Definition at line 140 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.write_namelist().

def hwrf.nhc_products.NHCProducts.product (   self,
  name 
)

Convenience function that returns the product with the given name, or raises KeyError if none is found.

Definition at line 268 of file nhc_products.py.

def hwrf.nhc_products.NHCProducts.products (   self,
  what = None 
)

Returns Product objects describing files produced by this Task.

Parameters
whatif specified, the name of the product of interest. Otherwise, all products are iterated over

Definition at line 280 of file nhc_products.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.nhc_products.NHCProducts.rewrite_swath_ctl (   self,
  ctlfile 
)

Modifies the swath.ctl file to point to a lower-case swath.dat filename.

Parameters
ctlfilethe file to modify

Definition at line 342 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.deliver_outlist().

def hwrf.nhc_products.NHCProducts.run (   self,
  deliver_wrfdiag = False 
)

Copies inputs, runs the hwrf_nhc_input, and delivers results.

Parameters
deliver_wrfdiagif True, wrfdiag files are also delivered

Definition at line 292 of file nhc_products.py.

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

def hwrf.nhc_products.NHCProducts.wrfdiag_products (   self,
  what = None 
)

Iterates over wrfdiag file products.

Parameters
whatignored

Definition at line 272 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.deliver_wrfdiag().

def hwrf.nhc_products.NHCProducts.write_namelist (   self,
  f,
  wrf,
  moad,
  inner 
)

Writes the products.nml namelist file.

This is an internal implementation function; do not call it directly. Writes the products.nml namelist to file object f.

Parameters
fthe opened file object
wrfthe hwrf.wrf.WRFSimulation
moadthe outermost domain, an hwrf.wrf.WRFDomain
innerthe innermost domain, an hwrf.wrf.WRFDomain

Definition at line 157 of file nhc_products.py.

Referenced by hwrf.nhc_products.NHCProducts.run().


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