HWRF  trunk@4391
Public Member Functions | Static Public Attributes | Properties | List of all members
hwrf.tracker.TrackerTask Class Reference

This task runs the GFDL Vortex Tracker on HWRF output. More...

Detailed Description

This task runs the GFDL Vortex Tracker on HWRF output.

It is intended to be used with the GRIBTask. At present, this only supports a moving grid tracker. Placeholders are present for a stationary grid tracker invocation, but those are not tested.

Definition at line 649 of file tracker.py.

Inheritance diagram for hwrf.tracker.TrackerTask:
hwrf.hwrftask.HWRFTask produtil.datastore.Task produtil.datastore.Datum

Public Member Functions

def __init__ (self, ds, conf, section, start, end, step, write_vit=True, phaseflag=True, structflag=False, ikeflag=False, realtime=True, kwargs)
 Creates a new TrackerTask. More...
 
def send_raw_atcfunix
 Requests delivery of the raw, unmodified atcfunix file to the specified location. More...
 
def product (self, name)
 Returns the tracker Product with the specified product name or raises KeyError if none is found. More...
 
def products
 Iterates over all tracker Products. More...
 
def send_atcfunix_subset
 Requests delivery of a cleaned subset of the tracker atcfunix file, only up to the specified forecast hour. More...
 
def send_atcfunix
 Requests delivery of a cleaned-up version of the full length atcfunix file. More...
 
def getwrite_vit (self)
 Flag: output genesis vitals?
 
def getphaseflag (self)
 Flag: output phase info?
 
def getstructflag (self)
 Flag: output structure info?
 
def getikeflag (self)
 Flag: output IKE info?
 
def getrealtime (self)
 Flag: run in real-time mode?
 
def grab_gribs (self, gribtask, gribname)
 Loops through the given gribtask, getting all products with specified name (gribname) for the times requested in the TrackerBase constructor. More...
 
def add_moving_grid (self, tcvitals, gribtask, gribname)
 Tells the tracker to run in moving grid mode, for the specified storm. More...
 
def add_regional_grid (self, gribtask, gribname)
 Adds a stationary grid on which to run the tracker. More...
 
def add_storm (self, tcvitals)
 Specifies the tcvitals for a storm to track. More...
 
def link_grib (self, inputlist)
 Symbolically links all input GRIB1/2 files to the current working directory using the file naming convention expected by the tracker. More...
 
def concat_grib (self, filename, ixfilename)
 Concats all input GRIB1/2 files into a single file, waiting for each one to become available first. More...
 
def make_namelist (self, filename)
 Construct the tracker namelist and write it to the specified file. More...
 
def run (self)
 Runs the tracker and delivers the resulting track files. More...
 
def call_completed_callbacks
 Calls callbacks for all completed products. 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...
 

Static Public Attributes

string NOVITALS = ''
 Constant used to represent the lack of vitals data. More...
 

Properties

 write_vit = property(getwrite_vit,None,None,'Flag: output genesis vitals?')
 Output genesis vitals? Read-only property. More...
 
 phaseflag = property(getphaseflag,None,None,'Flag: output phase info?')
 Output phase info? Read-only property. More...
 
 structflag
 Output storm structure information? Read-only property. More...
 
 ikeflag
 Output storm IKE information? Read-only property. More...
 
 realtime = property(getrealtime,None,None,'Flag: run in real-time mode?')
 Run in real-time mode? Read-only property. 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...
 

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...
 

Constructor & Destructor Documentation

def hwrf.tracker.TrackerTask.__init__ (   self,
  ds,
  conf,
  section,
  start,
  end,
  step,
  write_vit = True,
  phaseflag = True,
  structflag = False,
  ikeflag = False,
  realtime = True,
  kwargs 
)

Creates a new TrackerTask.

Parameters
dsthe produtil.datastore.Datastore to use
confthe hwrf.config.HWRFConfig for configuration options
sectionthe HWRFConfig section to use
start,end,stepthe times at which data may be available from the GRIBTasks.
realtimethe tracker should wait for data to appear and call delivery scripts at every forecast time.
write_vit,phaseflag,structflag,ikeflagPassded on to the tracker namelist.
kwargspassed to hwrf.hwrftask.HWRFTask.__init__()

See the tracker documentation for details.

Definition at line 660 of file tracker.py.

Member Function Documentation

def hwrf.tracker.TrackerTask.add_moving_grid (   self,
  tcvitals,
  gribtask,
  gribname 
)

Tells the tracker to run in moving grid mode, for the specified storm.

Parameters
tcvitalsThe tcvitals must be an hwrf.storminfo.StormInfo.
gribtaskThe gribtask must be an hwrf.gribtask.GRIBTask.
gribnameThe gribname is the name in the hwrf.regrib.RegribMany of the operation that produces the tracker input for this moving storm.

Definition at line 849 of file tracker.py.

def hwrf.tracker.TrackerTask.add_regional_grid (   self,
  gribtask,
  gribname 
)

Adds a stationary grid on which to run the tracker.

Parameters
gribtaskThe gribtask must be an hwrf.gribtask.GRIBTask to create the input.
gribnameThe gribname is the operation name in the grib task's hwrf.regrib.RegribMany for the GRIB data source.

Definition at line 882 of file tracker.py.

def hwrf.tracker.TrackerTask.add_storm (   self,
  tcvitals 
)

Specifies the tcvitals for a storm to track.

Parameters
tcvitalsthe hwrf.storminfo.StormInfo to use

Definition at line 896 of file tracker.py.

def hwrf.tracker.TrackerTask.call_completed_callbacks (   self,
  logger = None 
)

Calls callbacks for all completed products.

Parameters
loggera logging.Logger for log messages

Definition at line 1180 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.run().

def hwrf.tracker.TrackerTask.concat_grib (   self,
  filename,
  ixfilename 
)

Concats all input GRIB1/2 files into a single file, waiting for each one to become available first.

Produces the grbindex output for that file at the end. Only works in regional grid mode, and will raise TrackerModeError if the mode is unknown or moving grid.

Note
This is routine is untested because it is a bad idea. It results in duplication of an enormous amount of data. However, historically, this is how the tracker used to be run.
Parameters
filenamethe input GRIB1 file name
ixfilenamethe output index file name

Definition at line 963 of file tracker.py.

def hwrf.tracker.TrackerTask.grab_gribs (   self,
  gribtask,
  gribname 
)

Loops through the given gribtask, getting all products with specified name (gribname) for the times requested in the TrackerBase constructor.

Will raise MissingGRIBError if any times have no product. Returns a TimeArray of Product objects.

Parameters
gribtaskthe hwrf.gribtask.GRIBTask to query
gribnamethe grib product name

Definition at line 819 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.add_moving_grid(), and hwrf.tracker.TrackerTask.add_regional_grid().

def hwrf.tracker.TrackerTask.link_grib (   self,
  inputlist 
)

Symbolically links all input GRIB1/2 files to the current working directory using the file naming convention expected by the tracker.

If self.realtime=False, then will also check for the files' existence and will raise MissingGRIBError if one is missing. If self.realtime=True, then it is assumed the tracker is being run in waitfor mode and will wait for the data on its own. In either case, GRIBLocationError will be raised if any GRIB's Product.location is None or '' (the location must be known to make the symlink).

Parameters
inputlista file to create with the list of tracker input files

Definition at line 909 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.run().

def hwrf.tracker.TrackerTask.make_namelist (   self,
  filename 
)

Construct the tracker namelist and write it to the specified file.

The "realtime" flag is True when running in real-time mode, and False if not.

Parameters
filenamethe output namelist file's name

Definition at line 991 of file tracker.py.

Referenced by hwrf.wps.Geogrid.run(), hwrf.wps.Ungrib.run(), hwrf.wps.Metgrid.run(), and hwrf.tracker.TrackerTask.run().

def hwrf.tracker.TrackerTask.product (   self,
  name 
)

Returns the tracker Product with the specified product name or raises KeyError if none is found.

Parameters
namethe product name

Definition at line 714 of file tracker.py.

def hwrf.tracker.TrackerTask.products (   self,
  name = None 
)
def hwrf.tracker.TrackerTask.run (   self)

Runs the tracker and delivers the resulting track files.

Definition at line 1086 of file tracker.py.

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

def hwrf.tracker.TrackerTask.send_atcfunix (   self,
  prodname,
  location,
  category = None 
)

Requests delivery of a cleaned-up version of the full length atcfunix file.

This is the same as calling send_atcfunix_subset with the full simulation length as the end time. The prodname will be the Product's name, and the location is the delivery location. If specified and not None, the category will be the Product's category, otherwise it will be this Task's taskname. Note that if realtime=True is enabled, the category must be the taskname.

Parameters
prodnamethe new product's name
locationthe delivery location
categorythe product category instead of self.taskname

Definition at line 769 of file tracker.py.

def hwrf.tracker.TrackerTask.send_atcfunix_subset (   self,
  prodname,
  location,
  fhr = None,
  category = None,
  freq = 1,
  cut = None 
)

Requests delivery of a cleaned subset of the tracker atcfunix file, only up to the specified forecast hour.

This creates a new CleanATCFSubsetProduct with the specified product name and category. If the category is unspecified or None, then this class's taskname will be used. Note that the taskname MUST be used if running in realtime=True mode.

Parameters
prodnamethe name of the product
locationthe delivery location, which will be sent through confstrinterp() to perform string replacement
fhrthe last forecast hour
categorythe product category to use instead of self.taskname
freqthe output ATCF frequency in hours
cutthe last character to include in each line. For example, 112 is the RMW

Definition at line 726 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.send_atcfunix().

def hwrf.tracker.TrackerTask.send_raw_atcfunix (   self,
  prodname,
  location,
  category = None 
)

Requests delivery of the raw, unmodified atcfunix file to the specified location.

This creates a new RawATCFProduct with the specified product name and category. If the category is unspecified or None, then this class's taskname will be used. Note that the taskname MUST be used if running in realtime=True mode.

Parameters
prodnamethe name of the new product
locationthe output file location, which will be sent through confstrinterp() to do string replacement on forecast and analysis times, and other variables
categoryif specified, the product category. By default, this task's taskname is used.

Definition at line 693 of file tracker.py.

Member Data Documentation

hwrf.tracker.TrackerTask.NOVITALS = ''
static

Constant used to represent the lack of vitals data.

Definition at line 657 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.add_regional_grid().

Property Documentation

hwrf.tracker.TrackerTask.ikeflag
static
Initial value:
1 = property(getikeflag,None,None,
2  'Flag: output storm IKE information?')

Output storm IKE information? Read-only property.

Definition at line 809 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.make_namelist(), and hwrf.tracker.TrackerTask.run().

hwrf.tracker.TrackerTask.phaseflag = property(getphaseflag,None,None,'Flag: output phase info?')
static

Output phase info? Read-only property.

Definition at line 795 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.make_namelist(), and hwrf.tracker.TrackerTask.run().

hwrf.tracker.TrackerTask.realtime = property(getrealtime,None,None,'Flag: run in real-time mode?')
static
hwrf.tracker.TrackerTask.structflag
static
Initial value:
1 = property(getstructflag,None,None,
2  'Flag: output storm structure information?')

Output storm structure information? Read-only property.

Definition at line 801 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.make_namelist(), and hwrf.tracker.TrackerTask.run().

hwrf.tracker.TrackerTask.write_vit = property(getwrite_vit,None,None,'Flag: output genesis vitals?')
static

Output genesis vitals? Read-only property.

Definition at line 789 of file tracker.py.

Referenced by hwrf.tracker.TrackerTask.make_namelist(), and hwrf.tracker.TrackerTask.run().


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