DataProcess package¶
DataProcess.DataProcess module¶
DataProcess
– basic processing of input database¶
Processes the database of historical TCs into simply formatted text files. Extracts locations, including genesis location, and calculates speed, bearing, genesis day (as the day of the year) annual frequency (of the complete database), pressure rates of change, speed rates of change and bearing rates of change.
-
class
DataProcess
(configFile, progressbar=None)¶ Bases:
object
Processes the database of historical TCs into suitably formatted text files. Data is written to plain text files for ease of access (this may be upgraded in future versions to netCDF files). Currently extracts fields containing the value of cyclone parameters, but no information on the change of parameters.
- Parameters
configFile (str) – Configuration file containing simulation settings
progressbar (
progressbar
) –progressbar
object to print progress to STDOUT
Internal Methods: _lonLat(lon, lat, indicator) Extract longitudes and latitudes _bearing(bear, indicator) Extract bearings _speed(dist, dt, indicator) Extract speeds _pressure(pressure, indicator) Extract pressures _pressureRate(pressure, dt, indicator) Extract rate of presssure change _speedRate(dist, dt, indicator) Extract the acceleration (rate of change of speed) _bearingChange(bear, dt, indicator) Extract the rate of change of bearing _windSpeed(vmax, indicator) Extract the maximum sustained wind speed
-
extractTracks
(index, lon, lat)¶ Extract tracks that only start within the pre-defined domain. The function returns the indices of the tracks that begin within the domain.
- Parameters
index (numpy.ndarray) – indicator of initial positions of TCs (1 = new TC, 0 = continuation of previous TC).
lon (numpy.ndarray) – longitudes of TC positions
lat (numpy.ndarray) – latitudes of TC positions
- Returns
indices corresponding to all points of all tracks that form within the model domain
- Return type
numpy.ndarray
-
processData
(restrictToWindfieldDomain=False)¶ Process raw data into ASCII files that can be read by the main components of the system
- Parameters
restrictToWindfieldDomain (bool) – if True, only process data within the wind field domain, otherwise, process data from across the track generation domain.
DataProcess.CalcFrequency module¶
CalcFrequency
– Calculate annual genesis frequency¶
-
class
CalcFrequency
(configFile, auto_calc_grid_limit)¶ Bases:
object
Calculate the annual mean frequency of TC events based on input dataset. The frequency is calculated for the given domain.
- Parameters
tg_domain (dict) – the domain where the tracks will be generated. The
dict
should contain the keysxMin
,xMax
,yMin
andyMax
. The x variable bounds the longitude and the y variable bounds the latitude.
-
calc
()¶ Calculate the frequency of TC events in a pre-defined domain, based on the input dataset and the full range of years contained in the
origin_year
file.The
origin_year
file is created inDataProcess.processData
and restricts the range to a user-selected range of years.
DataProcess.CalcTrackDomain module¶
CalcTrackDomain
- calculate track generation domain¶
Determine track generator domain, ensuring it encompasses all tracks entering the windfield generator domain.
CreationDate: 2010-03-23
-
class
CalcTrackDomain
(configFile)¶ Bases:
object
Calculate the extents over which tracks will be generated.
Based on the user-selected wind field domain, examine the input dataset and identify the maximal extent covering all TCs that enter the wind field domain. This sets the domain over which synthetic TCs will be generated by teh TrackGenerator module.
- Parameters
configFile (string) – Configuration file containing simulation settings
-
calc
(index, lons, lats)¶ Core function for determining track generation domain
- Parameters
index –
numpy.ndarray
of values indicating the start of a new TC track (1), zero otherwiselons –
numpy.ndarray
representing the longitude of all TC positionslats –
numpy.ndarray
representing the latitude of all TC positions
-
calcDomainFromFile
()¶ Calculate track generation domain, using a file as the input source
- Return type
dict
- Returns
the domain where the tracks will be generated. The
dict
should contain the keysxMin
,xMax
,yMin
andyMax
. The x variable bounds the longitude and the y variable bounds the latitude.
-
calcDomainFromTracks
(index, lons, lats)¶ Calculate track generation domain from input track details
- Parameters
index –
numpy.ndarray
of values indicating the start of a new TC track (1), zero otherwiselons –
numpy.ndarray
representing the longitude of all TC positionslats –
numpy.ndarray
representing the latitude of all TC positions
- Return type
dict
- Returns
the domain where the tracks will be generated. The
dict
should contain the keysxMin
,xMax
,yMin
andyMax
. The x variable bounds the longitude and the y variable bounds the latitude.