HWRF  trunk@4391
Public Member Functions | Public Attributes | Properties | List of all members
hwrf.init.HWRFInit Class Reference

Runs the deterministic model initialization. More...

Detailed Description

Runs the deterministic model initialization.

This class runs the WPS, real, prep_hybrid (if enabled), WRF wrfanl and ghost jobs, and runs the tracker to find the parent vortex. Passes that into the relocation (if enabled) to produce the final vortex. It encapsulates that logic within one top-level wrapper object, and provides a way to run several parts of the initialization from a single function call.

Definition at line 26 of file init.py.

Inheritance diagram for hwrf.init.HWRFInit:
hwrf.hwrftask.HWRFTask produtil.datastore.Task produtil.datastore.Datum hwrf.init.InitBeforeGSI

Public Member Functions

def __init__ (self, ds, conf, section, wrf, initlen, fcstlen, outdir=None, realfcst=False, wrfghost=None, prep=True, track=True, in_ftime=None, in_atime=None, geogrid=None, prep_one_time=None, relocate=True, modin=None, ibdystep=None, fgat_times=None, prepfcst=None, kwargs)
 HWRFInit constructor. More...
 
def fgat_times (self)
 Iterates over all fgat times, if known. More...
 
def run_relocate (self)
 Runs the relocate jobs, if present. More...
 
def get_ftime (self)
 Returns the parent model forecast hour treated as this HWRFInit object's analysis time. More...
 
def get_atime (self)
 Returns the parent model analysis time. More...
 
def run (self)
 Runs all steps of the initialization in sequence. More...
 
def run_through_anl (self)
 Runs the following jobs, if they are enabled: geogrid, ungrib, metgrid, init-length prep_hybrid, init-length real_nmm and wrfanl. More...
 
def run_init_after_anl (self)
 Runs the following jobs if they are enabled: ghost, post, gribber, tracker. More...
 
def run_real_bdy (self)
 Runs boundary processing jobs. More...
 
def inputiter (self)
 Iterates over all needed input data. 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

 outdir
 Output directory for the initialization. More...
 
 initlen
 timedelta for length of initialization
 
 fcstlen
 timedelta for length of forecast
 
 ibdystep
 Timestep between boundary information for the 1 minute forecast.
 
 wrffcst
 Task for running or monitoring the WRF forecast.
 
 wrfdoms
 WRFDomain objects from that wrffcst object.
 
 wrfinit
 Task for running the ~1 minute forecast to generate wrfanl files. More...
 
 bdytimes
 An array of boundary times needed by the forecast run of WRF. More...
 
 ibdytimes
 An array of boundary times needed by the ~1 minute wrf forecast used to create wrfanl and ghost files. More...
 
 external_geogrid
 if a geogrid argument was sent to the constructor, it is stored here
 
 geogrid
 the hwrf.wps.Geogrid object for running geogrid.exe
 
 prep
 the hwrf.prep.PrepHybrid object to run prep_hybrid. More...
 
 runwrfanl
 the hwrf.fcsttask.WRFAnl4Trak object used to run the WRF for to produce the wrfanl files and outer domain time 0 wrfout file
 
 ungrib
 the hwrf.wps.Ungrib object for running ungrib
 
 metgrid
 the hwrf.metgrid.Metgrid object for running metgrid
 
 realinit
 the hwrf.fcsttask.RealNMM object for running real for the WRF init jobs
 
 ungribfcst
 the hwrf.wps.Ungrib object for running ungrib for the full WRF forecast job, if prep=False
 
 metgridfcst
 the hwrf.wps.Metgrid object for running metgrid for the full WRF forecast job if prep=False
 
 realfcst
 the hwrf.fcsttask.RealNMM object
 
 post
 if track=True, this is the hwrf.post.PostOneWRF object used to post-process the wrfanl job's time 0 outer domain wrfout file
 
 gribber
 the hwrf.gribtask.GRIBTask object used to regrib the output of self.post
 
 tracker
 the hwrf.tracker.TrackerTask object used to run the tracker on the gribber
 
 wrfghost
 the WRFSimulation representing the ghost if requested. More...
 
 runghost
 the hwrf.fcsttask.WRFGhost to run the ghost if requested. More...
 
 ghost_domains
 List of ghost domains as hwrf.wrf.WRFDomain objects.
 
 relocation
 The hwrf.relocation.Relocation group of tasks.
 
 rstage1
 The hwrf.relocation.Stage1 task.
 
 rstage2
 The hwrf.relocation.Stage2 task.
 
 rstage3
 The hwrf.relocation.Stage3 task.
 
- 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

 ftime
 Read-only property: forecast time of parent model used for initializing HWRF. More...
 
 atime = property(get_atime,None,None,)
 Read-only property: analysis time of parent model. 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.init.HWRFInit.__init__ (   self,
  ds,
  conf,
  section,
  wrf,
  initlen,
  fcstlen,
  outdir = None,
  realfcst = False,
  wrfghost = None,
  prep = True,
  track = True,
  in_ftime = None,
  in_atime = None,
  geogrid = None,
  prep_one_time = None,
  relocate = True,
  modin = None,
  ibdystep = None,
  fgat_times = None,
  prepfcst = None,
  kwargs 
)

HWRFInit constructor.

Creates the deterministic HWRF initialization. Which pieces are selected, and how they are plugged in to one another, is dependent on the input arguments.

Parameters
dspassed to Datum: the Datastore object for this Task
confthe conf object for this task
sectionthe conf section for this task
wrf(required) the WRFSimulation representing the full WRF forecast
initlen(required) the length of the real_nmm run for the initialization
fcstlen(required) the length of the real_nmm run for the full forecast
outdirThe directory in intercom to receive output. Default: intercom/{taskname}. Individual initialization components will be in subdirectories.
realfcstFlag: do we need to run real for the full forecast length?
wrfghosthwrf.wrf.WRFSimulation object for the wrfghost files. If absent, no wrfghost-related jobs will be run
prepif True, use prep_hybrid input. This changes the way in which real_nmm, ungrib and metgrid are run.
prepfcstIf True AND prep=True, use prep_hybrid for boundary conditions. This changes how realfcst, ungribfcst and metgridfcst are run.
trackRun a post, regribber and tracker on the wrfanl history file for domain 1, to find the location of the parent vortex.
in_ftimeparent model forecast hour to treat as "time 0." This is used for the FGAT to use GDAS forecasts as input
in_atimeparent model analysis time. Default: start time of wrf
geogridShould be an hwrf.wps.Geogrid, or None. This is used to avoid running expensive geogrid jobs multiple times for multiple FGAT hours. (This is especially important for hourly FGAT.) If None or missing, a Geogrid is created.
prep_one_timeFlag. If True, pretend hour 0 is also hour 1, 2, 3, and so on. This is only used by prep_hybrid, and is intended to prevent expensive spectral to grid transformations of hour 3 when only the analysis time is needed from WRF.
relocateIf True, vortex relocation is performed.
modinThe modin argument to hwrf.relocate task constructors. Default: in_dataset.upper()
ibdystepOptional: the boundary input frequency for the ~1 minute forecasts. Default: bdystep.
fgat_timesthe times at which FGAT is run.
kwargsPassed to hwrf.hwrftask.HWRFTask.__init__
Note
If "in_dataset" is in kwargs, it is the option sent to hwrf.input.DataCatalog.locate used for obtaining input files for Ungrib and PrepHybrid.

This constructor creates the following public member variables or accessors. These are intended to be used to query various components of the initialization. The scripting layer can run the sub-objects via their run methods, or it can simply call the self.run_* subroutines to run them in groups.

Reference variables: initlen – timedelta for length of initialization fcstlen – timedelta for length of forecast wrffcst – Task for running or monitoring the WRF forecast wrfdoms – WRFDomain objects from that wrffcst object wrfinit – Task for running the wrfanl run of WRF bdytimes – an array of boundary times needed by the forecast run ibdytimes – an array of boundary times needed by the init run of wrf

Initialization-Length WRF Init: geogrid – the hwrf.wps.Geogrid object for running geogrid.exe external_geogrid – if a geogrid argument was sent to the constructor, it is stored here ungrib – the hwrf.wps.Ungrib object for running ungrib metgrid – the hwrf.metgrid.Metgrid object for running metgrid realinit – the hwrf.fcsttask.RealNMM object for running real for the WRF init jobs runwrfanl – the hwrf.fcsttask.WRFAnl4Trak object used to run the WRF for to produce the wrfanl files and outer domain time 0 wrfout file wrfghost – the WRFSimulation representing the ghost if requested. This is the same as the wrfghost argument to the constructor runghost – the hwrf.fcsttask.WRFGhost to run the ghost if requested.

Prep Hybrid: prep – the hwrf.prep.PrepHybrid object to run prep_hybrid. The same prep object is used for both the init-length and fcst-length initialization.

Forecast-Length WRF Init: ungribfcst – the hwrf.wps.Ungrib object for running ungrib for the full WRF forecast job, if prep=False metgridfcst – the hwrf.wps.Metgrid object for running metgrid for the full WRF forecast job if prep=False realfcst – the hwrf.fcsttask.RealNMM object

Parent domain vortex detection: post – if track=True, this is the hwrf.post.PostOneWRF object used to post-process the wrfanl job's time 0 outer domain wrfout file gribber – the hwrf.gribtask.GRIBTask object used to regrib the output of self.post tracker – the hwrf.tracker.TrackerTask object used to run the tracker on the gribber

Definition at line 82 of file init.py.

Member Function Documentation

def hwrf.init.HWRFInit.fgat_times (   self)

Iterates over all fgat times, if known.

Definition at line 504 of file init.py.

Referenced by hwrf.init.HWRFInit.fgat_times().

def hwrf.init.HWRFInit.get_atime (   self)

Returns the parent model analysis time.

The value of that may differ from this HWRFInit object's analysis time.

Definition at line 526 of file init.py.

def hwrf.init.HWRFInit.get_ftime (   self)

Returns the parent model forecast hour treated as this HWRFInit object's analysis time.

Definition at line 522 of file init.py.

def hwrf.init.HWRFInit.inputiter (   self)

Iterates over all needed input data.

Calls the inputiter for the ungrib, ungribfcst and prep members, iterating over all data they need to run the initialization.

Definition at line 608 of file init.py.

def hwrf.init.HWRFInit.run (   self)

Runs all steps of the initialization in sequence.

Definition at line 539 of file init.py.

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

def hwrf.init.HWRFInit.run_init_after_anl (   self)

Runs the following jobs if they are enabled: ghost, post, gribber, tracker.

Definition at line 562 of file init.py.

Referenced by hwrf.init.HWRFInit.run().

def hwrf.init.HWRFInit.run_real_bdy (   self)

Runs boundary processing jobs.

Runs the forecast-length versions of the following jobs if they are enabled: ungribfcst, metgridfcst, prep_hybrid and real. Note that ungribfcst and metgridfcst should be disabled if prep_hybrid is enabled. That is done in the constructor though; the run_real_bdy will happily run all four jobs if requested.

Definition at line 583 of file init.py.

Referenced by hwrf.init.HWRFInit.run().

def hwrf.init.HWRFInit.run_relocate (   self)

Runs the relocate jobs, if present.

Definition at line 510 of file init.py.

Referenced by hwrf.init.HWRFInit.run().

def hwrf.init.HWRFInit.run_through_anl (   self)

Runs the following jobs, if they are enabled: geogrid, ungrib, metgrid, init-length prep_hybrid, init-length real_nmm and wrfanl.

Definition at line 546 of file init.py.

Referenced by hwrf.init.HWRFInit.run().

Member Data Documentation

hwrf.init.HWRFInit.bdytimes

An array of boundary times needed by the forecast run of WRF.

Definition at line 235 of file init.py.

Referenced by hwrf.init.HWRFInit.run_real_bdy().

hwrf.init.HWRFInit.ibdytimes

An array of boundary times needed by the ~1 minute wrf forecast used to create wrfanl and ghost files.

Definition at line 236 of file init.py.

Referenced by hwrf.init.HWRFInit.run_real_bdy(), and hwrf.init.HWRFInit.run_through_anl().

hwrf.init.HWRFInit.outdir

Output directory for the initialization.

Individual components will be in subdirectories.

Definition at line 206 of file init.py.

hwrf.init.HWRFInit.prep

the hwrf.prep.PrepHybrid object to run prep_hybrid.

The same prep object is used for both the init-length and fcst-length initialization.

Definition at line 283 of file init.py.

hwrf.init.HWRFInit.runghost

the hwrf.fcsttask.WRFGhost to run the ghost if requested.

Definition at line 450 of file init.py.

hwrf.init.HWRFInit.wrfghost

the WRFSimulation representing the ghost if requested.

This is the same as the wrfghost argument to the constructor

Definition at line 449 of file init.py.

hwrf.init.HWRFInit.wrfinit

Task for running the ~1 minute forecast to generate wrfanl files.

Definition at line 225 of file init.py.

Property Documentation

hwrf.init.HWRFInit.atime = property(get_atime,None,None,)
static
hwrf.init.HWRFInit.ftime
static
Initial value:
1 = property(get_ftime,None,None,
2  )

Read-only property: forecast time of parent model used for initializing HWRF.

Definition at line 533 of file init.py.


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