TrackDataset.gridded_stats¶
- TrackDataset.gridded_stats(request, thresh={}, storm=None, year_range=None, year_range_subtract=None, year_average=False, date_range=('1/1', '12/31'), binsize=1, domain=None, ax=None, return_array=False, cartopy_proj=None, **kwargs)[source]¶
Creates a plot of gridded statistics.
- Parameters
request (str) –
This string is a descriptor for what you want to plot. It will be used to define the variable (e.g. ‘wind’ –> ‘vmax’) and the function (e.g. ‘maximum’ –> np.max()). This string is also used as the plot title.
Variable words to use in request:
wind - (kt). Sustained wind.
pressure - (hPa). Minimum pressure.
wind change - (kt/time). Must be followed by an integer value denoting the length of the time window ‘__ hours’ (e.g., “wind change in 24 hours”).
pressure change - (hPa/time). Must be followed by an integer value denoting the length of the time window ‘__ hours’ (e.g., “pressure change in 24 hours”).
storm motion - (km/hour). Can be followed a length of time window. Otherwise defaults to 24 hours.
Units of all wind variables are knots and pressure variables are hPa. These are added into the title.
Function words to use in request:
maximum
minimum
average
percentile - Percentile must be preceded by an integer [0,100].
number - Number of storms in grid box satisfying filter thresholds.
Example usage: “maximum wind change in 24 hours”, “50th percentile wind”, “number of storms”
thresh (dict, optional) –
Keywords include:
sample_min - minimum number of storms in a grid box for the request to be applied. For the functions ‘percentile’ and ‘average’, ‘sample_min’ defaults to 5 and will override any value less than 5.
v_min - minimum wind for a given point to be included in the request.
p_max - maximum pressure for a given point to be included in the request.
dv_min - minimum change in wind over dt_window for a given point to be included in the request.
dp_max - maximum change in pressure over dt_window for a given point to be included in the request.
dt_window - time window over which change variables are calculated (hours). Default is 24.
dt_align - alignment of dt_window for change variables – ‘start’,’middle’,’end’ – e.g. ‘end’ for dt_window=24 associates a TC point with change over the past 24 hours. Default is middle.
Units of all wind variables = kt, and pressure variables = hPa. These are added to the subtitle.
year_range (list or tuple, optional) – List or tuple representing the start and end years (e.g., (1950,2018)). Default is start and end years of dataset.
year_range_subtract (list or tuple, optional) – A year range to subtract from the previously specified “year_range”. If specified, will create a difference plot.
year_average (bool, optional) – If True, both year ranges will be computed and plotted as an annual average.
date_range (list or tuple, optional) – List or tuple representing the start and end dates as a string in ‘month/day’ format (e.g.,
('6/1','8/15')
). Default is('1/1','12/31')
i.e., the full year.binsize (float, optional) – Grid resolution in degrees. Default is 1 degree.
domain (str, optional) – Domain for the plot. Default is “dynamic”. Please refer to Map Domain Options for available domain options.
ax (axes, optional) – Instance of axes to plot on. If none, one will be generated. Default is none.
return_array (bool, optional) – If True, returns the gridded 2D array used to generate the plot. Default is False.
cartopy_proj (ccrs, optional) – Instance of a cartopy projection to use. If none, one will be generated. Default is none.
- Other Parameters
prop (dict, optional) – Customization properties of plot. Please refer to gridded_stats for available options.
map_prop (dict, optional) – Customization properties of Cartopy map. Please refer to Map prop for available options.
- Returns
By default, the plot axes is returned. If “return_array” are set to True, a dictionary is returned containing both the axes and data array.
Notes
The following properties are available for customizing the plot, via
prop
:Property
Description
plot_values
Boolean for whether to plot label values for each gridpoint. Default is False.
smooth
Number (in units of sigma) to smooth the data using scipy’s gaussian filter. Default is 0 (no smoothing).
cmap
Colormap to use for the plot. If string ‘category’ is passed (default), uses a pre-defined color scale corresponding to the Saffir-Simpson Hurricane Wind Scale.
clevs
Contour levels for the plot. Default is minimum and maximum values in the grid.
left_title
Title string for the left side of the plot. Default is the string passed via the ‘request’ keyword argument.
right_title
Title string for the right side of the plot. Default is ‘All storms’.