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

Storm vitals information from ATCF, B-deck, tcvitals or message files. More...

Detailed Description

Storm vitals information from ATCF, B-deck, tcvitals or message files.

Represents all information about a one storm at one time as a Python object. It can read a single line of a tcvitals file, one time from a Best Track file, or CARQ entries from an Aid Deck file at a single time. It will scan multiple lines from a Best Track or CARQ group to get the last forecast hour (up to a maximum of 72hrs) and all possible radii for one time.

This class is meant for complex manipulations of a small amount of data, not for manipulations of whole databases. It can be used for manipulating the entire TCVitals database, or multiple ATCF deck files, but will generally be slower than other libraries – operations will take on the order of ten times as long.

Todo:
Write a separate class for simple manipulations of a whole ATCF database. This could be done efficiently using an in-memory sqlite3 database.

Definition at line 411 of file storminfo.py.

Inheritance diagram for hwrf.storminfo.StormInfo:

Public Member Functions

def __init__
 StormInfo constructor. More...
 
def old (self)
 Returns a copy of this StormInfo, but with the last renumbering or renaming of the vitals undone. More...
 
def copy (self)
 Returns a copy if this object. More...
 
def __sub__ (self, amount)
 Same as self + (-amount) More...
 
def __add__ (self, amount)
 Returns a copy of this object, with the vitals extrapolated forward "amount" hours. More...
 
def hwrf_domain_center
 Uses the 2013 operational HWRF method of deciding the domain center based on the storm location, basin, and, if available, the 72hr forecast location. More...
 
def set_stormtype
 Sets the two letter storm type self.stormtype. More...
 
def rename_storm
 Sets the name of the storm. More...
 
def renumber_storm
 Changes the storm number. More...
 
def swap_numbers (self)
 Swaps the new and old stormid variables. More...
 
def as_tcvitals (self)
 Returns a tcvitals version of this data. More...
 
def as_message (self)
 Returns a message line version of this data. More...
 
def as_tcvitals_or_message
 Internal function that underlies as_tcvitals() and as_message() More...
 
def change_basin
 Changes the basin of this StormInfo. More...
 

Public Attributes

 format
 The linetype argument to the constructor. More...
 
 has_old_stnum
 If True, the various old_* variables are present. More...
 
 line
 Contents of the line of text sent to init
 
 lines
 Multi-line input to the constructor.
 
 rawbasin
 Raw parser data for the basin.
 
 stormtype
 Two character best track storm type.
 
 stormname
 Upper-case storm name.
 
 stnum
 Storm number: 1-49 for real storms, 0 for fake basin-scale, 50-79 for RSMC internal usage, 80-89 for test storms and 90-99 for genesis cases. More...
 
 stormid3
 Three character storm ID from tcvitals: 09L, 91S, 18P, etc. More...
 
 stormid4
 Four character storm ID: AL09, SH91, IO18, etc. More...
 
 stormid3lc
 Three character storm ID from tcvitals: 09l, 91s, 18p, etc. More...
 
 longstormid
 Storm basin, number and year: AL092012. More...
 
 center
 The forecast center (RSMC) whose forecaster provided this information.
 
 flat
 Forecast latitude in degrees North.
 
 flon
 Forecast longitude in degrees East.
 
 havefcstloc
 If True, the fhr, flat and flon are provided.
 
 fhr
 Forecast hour.
 
 stormnamelc
 Lower-case storm name.
 
 technum
 Technique number for ATCF.
 
 when
 The datetime.datetime for the valid time.
 
 YMDH
 The ten digit date and time of the valid time.
 
 qset
 Set of quadrant information keys.
 
 windcode34
 Code sent for 34kt wind radii.
 
 windcode50
 Code sent for 50kt wind radii.
 
 windcode64
 Code sent for 64kt wind radii.
 
 technique
 Technique field for ATCF.
 
 tau
 Tau value from the ATCF.
 
 lat
 Storm center latitude in degrees North, a float.
 
 lon
 Storm center longitude in degrees East, a float.
 
 wmax
 Maximum wind as a float.
 
 pmin
 Minimum pressure as a float.
 
 poci
 Pressure of the outermost closed isobar.
 
 roci
 Radius of the outermost closed isobar.
 
 rmw
 Radius of the maximum wind.
 
 gusts
 Maximum gust.
 
 eyediam
 Eye diameter from the tcvitals.
 
 maxseas
 Maximum sea height as a float.
 
 stormdir
 Storm movement direction from tcvitals, degrees.
 
 stormspeed
 Storm movement speed from tcvitals, m/s float.
 
 depth
 Storm depth: S, M or D; or X for missing.
 
 NE50
 NE quadrant 50kt wind radius.
 
 SE50
 SE quadrant 50kt wind radius.
 
 SW50
 SW quadrant 50kt wind radius.
 
 NW50
 NW quadrant 50kt wind radius.
 
 fstrlat
 Original flat string. More...
 
 fstrlon
 Original flon string. More...
 
 NE64
 NE quadrant 64kt wind radius.
 
 SE64
 SE quadrant 64kt wind radius.
 
 SW64
 SW quadrant 64kt wind radius.
 
 NW64
 NW quadrant 64kt wind radius.
 
 rawcentury
 Raw parser data for the century.
 
 rawstormname
 Raw parser data for the storm name.
 
 rawYYMMDD
 Raw parser data for the date.
 
 rawHHMM
 Raw parser data for the time.
 
 strlat
 Original string version of lat.
 
 strlon
 Original string version of lon.
 
 NE34
 NE quadrant 34kt wind radius.
 
 SE34
 SE quadrant 34kt wind radius.
 
 SW34
 SW quadrant 34kt wind radius.
 
 NW34
 NW quadrant 34kt wind radius.
 
 old_stormtype
 stormtype before Invest renumbering
 
 old_stormname
 stormname before Invest renumbering
 
 old_stnum
 stnum before Invest renumbering
 
 old_stormid3
 stormid3 before Invest renumbering
 
 old_stormid3lc
 stormid3lc before Invest renumbering
 
 old_stormid4
 stormid4 before Invest renumbering
 
 old_longstormid
 longstormid before Invest renumbering
 

Constructor & Destructor Documentation

def hwrf.storminfo.StormInfo.__init__ (   self,
  linetype,
  inputs,
  carq = 'CARQ',
  logger = None,
  raise_all = True 
)

StormInfo constructor.

Constructor for the StormInfo class. You should not call this directly. Instead, use the other parsing functions in this module to generate tcvitals from file objects.

Parameters
linetypetype of vitals: tcvitals, message, carq (ATCF CARQ entries), old, or copy. See below
inputsinputs, converted to a string before processing
carqadditional CARQ data to fill in more information
loggera logging.Logger for log messages
raise_allif True, exceptions will be raised if parser errors happen

The constructor can create StormInfo objects in several ways, specified by the type argument:

  • tcvitals — Parse a line of a tcvitals file.
  • message — Parse a tropical cyclone message file.
  • carq — Parse A deck CARQ entries.
  • old — Take another StormInfo whose storm id/name has been replaced with another id/name through invest renumbering. Swap the old invest id/name with the current non-invest id/name.
  • copy — Do a deep copy of the supplied StormInfo

Definition at line 441 of file storminfo.py.

Member Function Documentation

def hwrf.storminfo.StormInfo.__add__ (   self,
  amount 
)

Returns a copy of this object, with the vitals extrapolated forward "amount" hours.

Only the location is changed.

Parameters
amountthe amount of time to extrapolate forward

Definition at line 522 of file storminfo.py.

def hwrf.storminfo.StormInfo.__sub__ (   self,
  amount 
)

Same as self + (-amount)

Parameters
amountThe amount of time to extrapolate backwards.

Definition at line 518 of file storminfo.py.

def hwrf.storminfo.StormInfo.as_message (   self)

Returns a message line version of this data.

This is not cached, and will be recalculated every time it is called.

Definition at line 1163 of file storminfo.py.

def hwrf.storminfo.StormInfo.as_tcvitals (   self)

Returns a tcvitals version of this data.

This is not cached, and will be recalculated every time it is called.

Definition at line 1158 of file storminfo.py.

def hwrf.storminfo.StormInfo.as_tcvitals_or_message (   self,
  no_century = False 
)

Internal function that underlies as_tcvitals() and as_message()

Returns a tcvitals or message version of this data. This is not cached, and will be recalculated every time it is called.

Parameters
no_centuryIf no_century=True, then only two digits of the year are written, and the line will be a message.

Definition at line 1168 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.as_message(), and hwrf.storminfo.StormInfo.as_tcvitals().

def hwrf.storminfo.StormInfo.change_basin (   self,
  basin,
  subbasin = None,
  discardold = False 
)

Changes the basin of this StormInfo.

Parameters
basinthe primary basin (IO, L, etc.)
subbasinthe subbasin. For example, IO has the subbasins AA and BB.
discardoldIf discardold=False (the default), then the old values are moved to the old_stnum, old_stormid3, etc.

Definition at line 1254 of file storminfo.py.

def hwrf.storminfo.StormInfo.copy (   self)
def hwrf.storminfo.StormInfo.hwrf_domain_center (   self,
  logger = None 
)

Uses the 2013 operational HWRF method of deciding the domain center based on the storm location, basin, and, if available, the 72hr forecast location.

Returns a tuple containing a pair of floats (cenlo, cenla) which are the domain center longitude and latitude, respectively. Results are cached internally so future calls will not have to recompute the center location.

Parameters
loggera logging.Logger for log messages

Definition at line 546 of file storminfo.py.

def hwrf.storminfo.StormInfo.old (   self)

Returns a copy of this StormInfo, but with the last renumbering or renaming of the vitals undone.

Definition at line 511 of file storminfo.py.

def hwrf.storminfo.StormInfo.rename_storm (   self,
  newname,
  discardold = False 
)

Sets the name of the storm.

Parameters
newnamethe new storm name
discardoldIf discardold=False (the default) then the old storm name is moved to self.old_stormname.

Definition at line 1094 of file storminfo.py.

def hwrf.storminfo.StormInfo.renumber_storm (   self,
  newnumber,
  discardold = False 
)

Changes the storm number.

Changes the storm number: the 09 in 09L. That changes self.stnum, stormid3, stormid3lc, stormid4 and longstormid.

Parameters
newnumberthe new storm number
discardoldIf discardold=False (the default), then the old values are moved to the old_stnum, old_stormid3, etc.

Definition at line 1108 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.hwrf_domain_center().

def hwrf.storminfo.StormInfo.set_stormtype (   self,
  stormtype,
  discardold = False 
)

Sets the two letter storm type self.stormtype.

Parameters
discardoldIf discardold=False (the default), then the old value, if any, is moved to self.old_stormtype.
stormtypethe storm type information

Definition at line 1077 of file storminfo.py.

def hwrf.storminfo.StormInfo.swap_numbers (   self)

Swaps the new and old stormid variables.

The stnum and old_stnum are swapped, the stormid3 and old_stormid3 are swapped, and so on.

Definition at line 1140 of file storminfo.py.

Member Data Documentation

hwrf.storminfo.StormInfo.format

The linetype argument to the constructor.

This is the format of the input data: tcvitals, message or carq (atcf).

Definition at line 474 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.change_basin(), and hwrf.storminfo.StormInfo.swap_numbers().

hwrf.storminfo.StormInfo.fstrlat

Original flat string.

Definition at line 1301 of file storminfo.py.

hwrf.storminfo.StormInfo.fstrlon

Original flon string.

Definition at line 1301 of file storminfo.py.

hwrf.storminfo.StormInfo.has_old_stnum

If True, the various old_* variables are present.

If False, they are not even in self.__dict__

Definition at line 475 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.renumber_storm().

hwrf.storminfo.StormInfo.longstormid

Storm basin, number and year: AL092012.

Note that southern hemisphere "years" start at July 1, so July-Dec storms have the next physical year in their longstormid.

Definition at line 1131 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.renumber_storm().

hwrf.storminfo.StormInfo.stnum

Storm number: 1-49 for real storms, 0 for fake basin-scale, 50-79 for RSMC internal usage, 80-89 for test storms and 90-99 for genesis cases.

Definition at line 1124 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.as_tcvitals_or_message(), hwrf.storminfo.StormInfo.renumber_storm(), and hwrf.storminfo.StormInfo.swap_numbers().

hwrf.storminfo.StormInfo.stormid3

Three character storm ID from tcvitals: 09L, 91S, 18P, etc.

Upper-case

Definition at line 1125 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.renumber_storm().

hwrf.storminfo.StormInfo.stormid3lc

Three character storm ID from tcvitals: 09l, 91s, 18p, etc.

Lower-case.

Definition at line 1127 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.renumber_storm().

hwrf.storminfo.StormInfo.stormid4

Four character storm ID: AL09, SH91, IO18, etc.

Definition at line 1126 of file storminfo.py.

Referenced by hwrf.storminfo.StormInfo.renumber_storm().


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