wind package¶
Submodules¶
wind.vmax module¶
vmax
– calculate maximum wind speed from pressure deficit¶
CreationDate: 2006-10-30 Description: Calculate Vmax from pressure difference and vice versa. Offers three relations for calculating Vmax based on the pressure difference - Atkinson & Holliday (1977), Holland (1980) and Willoughby & Rahn (2004). The default is the Holland relation.
The normalisations to 10m AGL, 10-minute-mean winds were taken from Harper (2002).
SeeAlso: (related programs) Constraints: Input pressures should be in Pa (not hPa) Version: $Rev: 810 $
Version: 220 ModifiedBy: Craig Arthur ModifiedDate: 2006-12-01 Modification: Added pDiff function
Version: 267 ModifiedBy: Craig Arthur ModifiedDate: 2007-02-19 Modification: Normalised all vmax relations to provide 10m AGL, 10-minute-mean wind speeds
- References
Atkinson and Holliday 1977: Tropical Cyclone Minimum Sea Level Pressure / Maximum Sustained Wind Relationship for the Wetern North Pacific. Mon. Wea. Rev., 105, 421-427
Holland, G. 1980: An Analytic Model of the Wind and Pressure Profiles in Hurricanes. Mon. Wea. Rev, 108, 1212-1218
Willoughby, H.E. and M.E. Rahn, 2004: Parametric Representation of the Primary Hurricane Vortex. Part I: Observations and Evaluation of the Holland (1980) Model. Mon. Wea. Rev., 132, 3033-3048
Harper, B.A. 2002: Tropical Cyclone Parameter Estimation in the Australian Region: Wind-Pressure Relationships and Related Issues for Engineering Planning and Design.
$Id: vmax.py 810 2012-02-21 07:52:50Z nsummons $
-
pDiff
(vMax, pEnv, vMaxType='holland', beta=1.3, rho=1.15)¶ Inverse functions to calculate central pressure from vMax Assumes vMax is given in metres/second. Returns pCentre in Pa.
-
vmax
(pCentre, pEnv, type='holland', beta=1.3, rho=1.15)¶ Calculate the maximum wind speed from the pressure difference.
- Parameters
pc (float) – central pressure (Pa)
pe (float) – environmental pressure (Pa)
type (str) – which Vmax relation to use (Willoughby & Rahn, Holland or Atkinson & Holliday)
beta (float) – Holland’s (1980) beta parameter. Only used for the Holland estimation (type=holland)
rho (float) – air density (default=1.15 kg/m^3)
- Returns
maximum wind speed. For types 1 & 2, this is a gradient level wind. The relation used in type 3 (Atkinson & Holliday) was determined using surface wind observations so should be used with caution at the gradient level.
- Raises
ValueError – if environmental pressure is lower than central pressure
Note: The pressure should ideally be passed in units of Pa, but the function will accept hPa and automatically convert to Pa.
wind.windmodels module¶
This provides classes and methods that calculate the gradient level and surface (10-m above ground) wind speed, based on a number of parametric profiles and boundary layer models. These classes and methods provide the wind field at a single point in time. The complete wind swath is evaluated in the calling classes.
The windmodels.WindSpeedModel
classes define the
wind-pressure relations that define the maximum wind speed for a given
central pressure deficit.
The windmodels.WindProfileModel
classes define parametric
radial profiles of gradient level wind speed around the primary TC
vortex. These do not account for TC motion or interaction with the
surface.
The windmodels.WindFieldModel
classes define the boundary
layer models implemented, which relate the gradient level vortex to
the surface wind speed, incorporating the wavenumber-1 assymetry due
to storm forward motion, and the effects of (uniform) surface
roughness.
Wind speeds are assumed to represent a 1-minute mean wind speed. Conversion to other averaging periods is performed by application of gust factors in the calling classes.
- Note
Not all models are fully implemented - some cannot be fully implemented, as the mathematical formulation results in discontinuous profiles (e.g. Rankine vortex), for which a mathematical representation of the vorticity cannot be defined. The vorticity is required for the
windmodels.KepertWindFieldModel
. Users should carefully select the combinations of wind profiles and wind fields to ensure sensible results.
-
class
AtkinsonWindSpeed
(windProfileModel)¶ Bases:
wind.windmodels.WindSpeedModel
Atkinson and Holliday (1977), Tropical Cyclone Minimum Sea Level Pressure / Maximum Sustained Wind Relationship for the Western North Pacific . Mon. Wea. Rev., 105, 421-427 Maximum 10m, 1-minute wind speed. Uses
pEnv
as 1010 hPa.-
maximum
()¶ Maximum wind speed.
-
-
class
DoubleHollandWindProfile
(lat, lon, eP, cP, rMax, beta1, beta2, rMax2=150.0, windSpeedModel=<class 'wind.windmodels.HollandWindSpeed'>)¶ Bases:
wind.windmodels.WindProfileModel
McConochie et al’s double Holland vortex model (based on Cardone et al, 1994). This application is the Coral Sea adaptation of the double vortex model (it can also be used for concentric eye-wall configurations).
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
beta1 (float) – β parameter for the primary vortex.
beta2 (float) – β parameter for the secondary vortex.
rmax2 (float) – Optional. Radius to the secondary wind maximum (default=250 km).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
secondDerivative
()¶ Second derivative of the profile.
-
velocity
(R)¶ Calculate velocity as a function of radial distance. Represents the velocity of teh gradient level vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level wind speed.
- Return type
numpy.ndarray
-
vorticity
(R)¶ Calculate the vorticity associated with the (gradient level) vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level (relative) vorticity.
- Return type
numpy.ndarray
-
class
HollandWindProfile
(lat, lon, eP, cP, rMax, beta, windSpeedModel=<class 'wind.windmodels.HollandWindSpeed'>)¶ Bases:
wind.windmodels.WindProfileModel
Holland profile. For r < rMax, we reset the wind field to a cubic profile to avoid the barotropic instability mentioned in Kepert & Wang (2001).
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (m).
beta (float) – β parameter.
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
firstDerivative
()¶ First derivative of profile at rMax
-
secondDerivative
()¶ Second derivative of profile at rMax.
-
velocity
(R)¶ Calculate velocity as a function of radial distance. Represents the velocity of teh gradient level vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre (metres).- Returns
Array of gradient level wind speed.
- Return type
numpy.ndarray
-
vorticity
(R)¶ Calculate the vorticity associated with the (gradient level) vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre (metres).- Returns
Array of gradient level (relative) vorticity.
- Return type
numpy.ndarray
-
class
HollandWindSpeed
(windProfileModel)¶ Bases:
wind.windmodels.WindSpeedModel
Holland (1980), An Analytic Model of the Wind and Pressure Profiles in Hurricanes. Mon. Wea. Rev, 108, 1212-1218 Density of air is assumed to be 1.15 kg/m^3. β is assumed to be 1.3. Other values can be specified. Gradient level wind (assumed maximum).
-
maximum
()¶ Maximum wind speed.
-
-
class
HubbertWindField
(windProfileModel)¶ Bases:
wind.windmodels.WindFieldModel
Hubbert, G.D., G.J. Holland, L.M. Leslie and M.J. Manton, 1991: A Real-Time System for Forecasting Tropical Cyclone Storm Surges. Weather and Forecasting, 6, 86-97
- Parameters
R (
numpy.ndarray
) – Distance from the storm centre to the grid (km).lam (
numpy.ndarray
) – Direction (geographic bearing, positive clockwise) from storm centre to the grid.vFm (float) – Foward speed of the storm (m/s).
thetaFm (float) – Forward direction of the storm (geographic bearing, positive clockwise, radians).
thetaMax (float) – Bearing of the location of the maximum wind speed, relative to the direction of motion.
-
field
(R, lam, vFm, thetaFm, thetaMax=0.0)¶ The wind field.
-
class
JelesnianskiWindProfile
(lat, lon, eP, cP, rMax, windSpeedModel=<class 'wind.windmodels.WilloughbyWindSpeed'>)¶ Bases:
wind.windmodels.WindProfileModel
Jelesnianski model of the wind profile.
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (m).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
velocity
(R)¶ Calculate velocity as a function of radial distance. Represents the velocity of teh gradient level vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre (metres).- Returns
Array of gradient level wind speed.
- Return type
numpy.ndarray
-
vorticity
(R)¶ Calculate the vorticity associated with the (gradient level) vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre (metres).- Returns
Array of gradient level (relative) vorticity.
- Return type
numpy.ndarray
-
class
KepertWindField
(windProfileModel)¶ Bases:
wind.windmodels.WindFieldModel
Kepert, J., 2001: The Dynamics of Boundary Layer Jets within the Tropical Cyclone Core. Part I: Linear Theory. J. Atmos. Sci., 58, 2469-2484
-
field
(R, lam, vFm, thetaFm, thetaMax=0.0)¶ - Parameters
R (
numpy.ndarray
) – Distance from the storm centre to the grid (km).lam (
numpy.ndarray
) – Direction (geographic bearing, positive clockwise) from storm centre to the grid.vFm (float) – Foward speed of the storm (m/s).
thetaFm (float) – Forward direction of the storm (geographic bearing, positive clockwise, radians).
thetaMax (float) – Bearing of the location of the maximum wind speed, relative to the direction of motion.
-
-
class
McConochieWindField
(windProfileModel)¶ Bases:
wind.windmodels.WindFieldModel
McConochie, J.D., T.A. Hardy and L.B. Mason, 2004: Modelling tropical cyclone over-water wind and pressure fields. Ocean Engineering, 31, 1757-1782.
It appears this paper used 10-minute mean wind speeds for calibration. Therefore, we convert to return a 1-minute sustained wind speed equivalent.
-
field
(R, lam, vFm, thetaFm, thetaMax=0.0)¶ - Parameters
R (
numpy.ndarray
) – Distance from the storm centre to the grid (km).lam (
numpy.ndarray
) – Direction (geographic bearing, positive clockwise) from storm centre to the grid.vFm (float) – Foward speed of the storm (m/s).
thetaFm (float) – Forward direction of the storm (geographic bearing, positive clockwise, radians).
thetaMax (float) – Bearing of the location of the maximum wind speed, relative to the direction of motion.
-
-
class
NewHollandWindProfile
(lat, lon, eP, cP, rMax, rGale=150.0)¶ Bases:
wind.windmodels.WindProfileModel
Holland et al. 2010. In this version, the exponent is allowed to vary linearly outside the radius of maximum wind. i.e. rather than take the sqare root, the exponent varies around 0.5. Currently this version does not have a corresponding vorticity profile set up in windVorticity, so it cannot be applied in wind field modelling.
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
rGale (float) – Radius of gale force winds (default=150 km).
-
velocity
(R)¶ In this incarnation, we are assuming the pressure rate of change and forward velocity is zero, so there is no requirement for a first-pass guess at x.
Calculate velocity as a function of radial distance. Represents the velocity of teh gradient level vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level wind speed.
- Return type
numpy.ndarray
-
vorticity
(R)¶ Calculate the vorticity associated with the (gradient level) vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level (relative) vorticity.
- Return type
numpy.ndarray
-
class
PowellWindProfile
(lat, lon, eP, cP, rMax)¶ Bases:
wind.windmodels.HollandWindProfile
Powell et al, 2005. Another definition of the beta parameter inserted into the Holland model. Unlike Willoughby and Rahn’s model, there is no reliance on vMax. Powell et al. also included a small random term, but since the beta value is also used in the vorticity calculation, we need to ensure the values used in this function and the corresponding vorticity function match.
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
class
RankineWindProfile
(lat, lon, eP, cP, rMax, windSpeedModel=<class 'wind.windmodels.WilloughbyWindSpeed'>)¶ Bases:
wind.windmodels.WindProfileModel
Rankine vortex profile. Vmax determined by dp using, by default, the Willoughby & Rahn method.
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
velocity
(R)¶ Calculate velocity as a function of radial distance. Represents the velocity of teh gradient level vortex.
This includes an assumption about the shape of the profile outside Rmax. The literature indicates 0.4 < alpha < 0.6 (e.g. see Holland, 1980).
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level wind speed.
- Return type
numpy.ndarray
-
vorticity
(R)¶ Calculate the vorticity associated with the (gradient level) vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level (relative) vorticity.
- Return type
numpy.ndarray
-
class
SchloemerWindProfile
(lat, lon, eP, cP, rMax)¶ Bases:
wind.windmodels.HollandWindProfile
Schloemer’s (1954) is the same as the Holland relation with β = 1
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
class
WilloughbyWindProfile
(lat, lon, eP, cP, rMax, windSpeedModel=<class 'wind.windmodels.WilloughbyWindSpeed'>)¶ Bases:
wind.windmodels.HollandWindProfile
The Willoughby & Rahn (2004) relation, which makes β a function of Vmax, rMax and latitude. We use Willoughby & Rahn’s (2004) relation for Vmax only. This determines the β parameter then calls Holland (which means the profile is cubic within Rmax) to calculate the wind profile. The β term calculation is based on Atlantic and Eastern Pacific cyclone data, not Australian data.
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
class
WilloughbyWindSpeed
(windProfileModel)¶ Bases:
wind.windmodels.WindSpeedModel
Willoughby & Rahn (2004), Parametric Representation of the Primary Hurricane Vortex. Part I: Observations and Evaluation of the Holland (1980) Model. Mon. Wea. Rev., 132, 3033-3048
-
maximum
()¶ Maximum wind speed.
-
-
class
WindFieldModel
(windProfileModel)¶ Bases:
object
Wind field (boundary layer) models. These define the boundary layer models implemented, which relate the gradient level vortex to the surface wind speed, incorporating the wavenumber-1 assymetry due to storm forward motion, and the effects of (uniform) surface roughness.
- Parameters
windProfileModel – A wind.WindProfileModel instance.
-
property
f
¶ Helper property to return the coriolis force from the wind profile.
-
field
(R, lam, vFm, thetaFm, thetaMax=0.0)¶ The wind field.
-
property
rMax
¶ Helper property to return the maximum radius from the wind profile.
-
velocity
(R)¶ Helper property to return the wind velocity at radiuses R from the wind profile or the precalculated attribute.
-
vorticity
(R)¶ Helper property to return the wind vorticity at radiuses R from the wind profile or the precalculated attribute.
-
class
WindProfileModel
(lat, lon, eP, cP, rMax, windSpeedModel)¶ Bases:
object
The base wind profile model.
- Parameters
lat (float) – Latitude of TC centre.
lon (float) – Longitude of TC centre.
eP (float) – environmental pressure (hPa).
cP (float) – centrral pressure of the TC (hPa).
rMax (float) – Radius to maximum wind (km).
windSpeedModel (
windmodels.WindSpeedModel
instance.) – A maximum wind speed model to apply.
-
property
dP
¶ Pressure difference.
-
property
vMax
¶ Maximum wind speed.
-
velocity
(R)¶ Calculate velocity as a function of radial distance R. Represents the velocity of teh gradient level vortex.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level wind speed.
- Return type
numpy.ndarray
-
vorticity
(R)¶ Calculate the vorticity associated with the (gradient level) vortex at radius R.
- Parameters
R –
numpy.ndarray
of distance of grid from the TC centre.- Returns
Array of gradient level (relative) vorticity.
- Return type
numpy.ndarray
-
class
WindSpeedModel
(windProfileModel)¶ Bases:
object
Abstract wind speed model.
-
property
cP
¶ Current pressure.
-
property
dP
¶ Pressure difference.
-
property
eP
¶ Environment pressure.
-
maximum
()¶ Maximum wind speed.
-
property
-
allSubclasses
(cls)¶ Recursively find all subclasses of a given class.
-
field
(name)¶ Helper function to return the appropriate wind field model given a name.
-
fieldParams
(name)¶ List of additional parameters required for a wind field model.
-
profile
(name)¶ Helper function to return the appropriate wind profile model given a name.
-
profileParams
(name)¶ List of additional parameters required for a wind profile model.
Module contents¶
wind
– Wind field calculation¶
This module contains the core object for the wind field calculations. It provides the radial profile models to define the primary vortex of the simulated TC, and bounday layer models that define the asymmetry induced by surface friction and forward motion of the TC over the earth’s surface. The final output from the module is a netCDF file containing the maximum surface gust wind speed (a 10-minute mean wind speed, at 10 metres above ground level), along with the components (eastward and westward) that generated the wind gust and the minimum mean sea level pressure over the lifetime of the event. If multiple TCs are contained in a track file, then the output file contains the values from all events (for example, an annual maximum wind speed).
Wind field calculations can be run in parallel using MPI if the mpi4py library is found and TCRM is run using the mpirun command. For example, to run with 10 processors:
$ mpirun -n 10 python tcrm.py cairns.ini
wind
can be correctly initialised and started by
calling the run()
with the location of a configFile:
>>> import wind
>>> wind.run('cairns.ini')
-
class
WindfieldAroundTrack
(track, profileType='powell', windFieldType='kepert', beta=1.3, beta1=1.5, beta2=1.4, thetaMax=70.0, margin=2.0, resolution=0.05, gustFactor=1.35, gridLimit=None, domain='bounded')¶ Bases:
object
The windfield around the tropical cyclone track.
- Parameters
track (
Track
) – the tropical cyclone track.profileType (str) – the wind profile type.
windFieldType (str) – the wind field type.
beta (float) – wind field parameter.
beta1 (float) – wind field parameter.
beta2 (float) – wind field parameter.
thetaMax (float) –
margin (float) –
resolution (float) – Grid resolution (in degrees)
gustFactor (float) – Conversion from 1-min mean to 0.2-sec gust wind speed, for off-sea conditions. See WMO TD1555 (2010) for details.
gridLimit (
dict
) – the domain where the tracks will be generated. Thedict
should contain the keysxMin
,xMax
,yMin
andyMax
. The y variable bounds the latitude and the x variable bounds the longitude.
-
localWindField
(i)¶ Calculate the local wind field at time i around the tropical cyclone.
- Parameters
i (int) – the time.
-
polarGridAroundEye
(i)¶ Generate a polar coordinate grid around the eye of the tropical cyclone at time i.
- Parameters
i (int) – the time.
-
pressureProfile
(i, R)¶ Calculate the pressure profile at time i at the radiuses R around the tropical cyclone.
- Parameters
i (int) – the time.
R (
numpy.ndarray
) – the radiuses around the tropical cyclone.
-
regionalExtremes
(gridLimit, timeStepCallback=None)¶ Calculate the maximum potential wind gust and minimum pressure over the region throughout the life of the tropical cyclone.
- Parameters
gridLimit (
dict
) – the domain where the tracks will be considered. Thedict
should contain the keysxMin
,xMax
,yMin
andyMax
. The y variable bounds the latitude and the x variable bounds the longitude.timeStepCallback (function) – the function to be called on each time step.
-
class
WindfieldGenerator
(config, margin=2.0, resolution=0.05, profileType='powell', windFieldType='kepert', beta=1.5, beta1=1.5, beta2=1.4, thetaMax=70.0, gridLimit=None, domain='bounded', multipliers=None, windfieldPath=None)¶ Bases:
object
The wind field generator.
- Parameters
margin (float) –
resolution (float) –
profileType (str) – the wind profile type.
windFieldType (str) – the wind field type.
beta (float) – wind field parameter.
beta1 (float) – wind field parameter.
beta2 (float) – wind field parameter.
thetaMax (float) –
gridLimit (
dict
) – the domain where the tracks will be generated. Thedict
should contain the keysxMin
,xMax
,yMin
andyMax
. The y variable bounds the latitude and the x variable bounds the longitude.
-
calcLocalWindfield
(results)¶ Calculate a local wind field using the regional windfield data
- Parameters
results – collection of :tuple: track and wind field data
-
calculateExtremesFromTrack
(track, callback=None)¶ Calculate the wind extremes given a single tropical cyclone track.
- Parameters
track (
Track
) – the tropical cyclone track.callback (function) – optional function to be called at each timestep to extract point values for specified locations.
-
calculateExtremesFromTrackfile
(trackfile, callback=None)¶ Calculate the wind extremes from a trackfile that might contain a number of tropical cyclone tracks. The wind extremes are calculated over the tracks, i.e., the maximum gusts and minimum pressures over all tracks are retained.
- Parameters
trackfile (str) – the file name of the trackfile.
callback (function) – optional function to be called at each timestep to extract point values for specified locations.
-
dumpGustsFromTrackfiles
(trackfiles, windfieldPath, timeStepCallback=None)¶ Helper method to dump the maximum wind speeds (gusts) observed over a region to netcdf files. One file is created for every track file.
- Parameters
trackfiles (list of str) – a list of track file filenames.
windfieldPath (str) – the path where to store the gust output files.
filenameFormat (str) – the format string for the output file names. The default is set to ‘gust-%02i-%04i.nc’.
progressCallback (function) – optional function to be called after a file is saved. This can be used to track progress.
timeStepCallback – optional function to be called at each timestep to extract point values for specified locations.
-
dumpGustsFromTracks
(trackiter, windfieldPath, timeStepCallback=None)¶ Dump the maximum wind speeds (gusts) observed over a region to netcdf files. One file is created for every track file.
- Parameters
trackiter (list of
Track
objects) – a list ofTrack
objects.windfieldPath (str) – the path where to store the gust output files.
filenameFormat (str) – the format string for the output file names. The default is set to ‘gust-%02i-%04i.nc’.
timeStepCallback – optional function to be called at each timestep to extract point values for specified locations.
-
plotGustToFile
(result, filename)¶ Plot the wind field on a map
-
saveGustToFile
(trackfile, result, filename)¶ Save gusts to a file.
-
setGridLimit
(track)¶ Set the outer bounds of the grid to encapsulate the extent of a single TC track.
- Parameters
track –
Track
object.
-
balanced
(iterable)¶ Balance an iterator across processors.
This partitions the work evenly across processors. However, it requires the iterator to have been generated on all processors before hand. This is only some magical slicing of the iterator, i.e., a poor man version of scattering.
-
filterTracks
(tracks, gridLimit, margin)¶
-
inRegion
(t, gridLimit, margin)¶ - Parameters
t –
Track
object- Returns
True if the track enters the simulation grid, False otherwise
-
loadTracks
(trackfile)¶ Read tracks from a track .nc file and return a list of
Track
objects.This calls the function ncReadTrackData to parse the track .nc file.
- Parameters
trackfile (str) – the track data filename.
- Returns
list of
Track
objects.
-
loadTracksFromFiles
(trackfiles, gridLimit, margin)¶ Generator that yields
Track
objects from a list of track filenames.When run in parallel, the list trackfiles is distributed across the MPI processors using the balanced function. Track files are loaded in a lazy fashion to reduce memory consumption. The generator returns individual tracks (recall: a trackfile can contain multiple tracks) and only moves on to the next file once all the tracks from the current file have been returned.
- Parameters
trackfiles (list of strings) – list of track filenames. The filenames must include the path to the file.
-
loadTracksFromPath
(path)¶ Helper function to obtain a generator that yields
Track
objects from a directory containing track .csv files.This function calls loadTracksFromFiles to obtain the generator and track filenames are processed in alphabetical order.
- Parameters
path (str) – the directory path.
-
run
(configFile, callback=None)¶ Run the wind field calculations.
- Parameters
configFile (str) – path to a configuration file.
callback (func) – optional callback function to track progress.