Tropical Cyclone Rainfall

This sample script shows how to use Tropycal to retrieve and plot rainfall associated with U.S. tropical cyclones, from the Weather Prediction Center (WPC)’s database.

from tropycal import tracks, rain

Reading In HURTDAT2 Dataset

Let’s start with the HURDAT2 dataset by loading it into memory. By default, this reads in the HURDAT dataset from the National Hurricane Center (NHC) website, unless you specify a local file path using either atlantic_url for the North Atlantic basin on pacific_url for the East & Central Pacific basin.

HURDAT data is not available for the current year. To include the latest data up through today, the “include_btk” flag needs to be set to True, which reads in preliminary best track data from the NHC website. For this example, we’ll set this to False.

Let’s create an instance of a TrackDataset object, which will store the North Atlantic HURDAT2 dataset in memory. Once we have this we can use its methods for various types of analyses.

basin = tracks.TrackDataset(basin='north_atlantic',include_btk=False)
--> Starting to read in HURDAT2 data
--> Completed reading in HURDAT2 data (2.16 seconds)

WPC Rainfall Dataset

Next, we’ll read in rainfall associated with tropical cyclones. Tropical cyclones are known to produce heavy rainfall, with at times catastrophic flooding. The Weather Prediction Center (WPC) routinely issues advisories on tropical cyclones or their remnants inland, and maintains a database of rainfall associated with tropical cyclones in the US.

This dataset is now available in CSV format, and can be easily read into Tropycal using the new Rain module:

--> Starting to read in rainfall data
--> Completed reading in rainfall data (8.87 seconds)

Hurricane Harvey (2017) produced catastrophic flooding over Texas. Let’s pull its rain observations to take a deeper look.

To do so, we’ll first need to retrieve a Storm object for Harvey, then provide it as an input argument to get_storm_rainfall(). This will return a Pandas DataFrame containing all rainfall observations associated with Harvey.

#Retrieve storm object
storm = basin.get_storm(('harvey',2017))

#Retrieve storm rainfall
harvey_rain = rain_obj.get_storm_rainfall(storm)

Now let’s look through the pandas DataFrame containing Harvey’s rainfall:

harvey_rain
Station Total Lat Lon
261570 ABEL 5 SW 1.79 33.60 -85.65
261571 ADDISON 2.17 34.20 -87.18
261572 ALABASTER 1.42 33.18 -86.78
261573 ALBERTVILLE 1.63 34.24 -86.19
261574 ALEXANDER CITY 2.46 32.95 -85.95
... ... ... ... ...
268375 WHITE SULPHUR SPRINGS 1.14 37.80 -80.48
268376 WHITE SULPHUR SPRINGS 0.96 37.80 -80.30
268377 WHITMER 3 W 0.20 38.82 -79.60
268378 WILLIAMSON 0.61 37.67 -82.28
268379 WOLF PEN 0.40 37.53 -81.58

6797 rows × 4 columns



We can use Pandas’ DataFrame utility to rearrange this by the “Total” column (representing rainfall in inches) to see the highest rain total associated with Harvey - which gives us 60.58 inches near Nederland.

harvey_rain.sort_values('Total',ascending=False)
Station Total Lat Lon
267161 Nederland 1.5 SW 60.58 29.950000 -94.010000
266354 Groves 1.3 N 60.54 29.960000 -93.920000
266199 Friendswood 56.00 29.500000 -95.200000
267575 Santa Fe 3 ENE 54.77 29.390000 -95.050000
265621 Friendswood 54.00 29.745100 -95.566600
... ... ... ... ...
263372 MADISON 0.00 39.430000 -92.170000
266215 Fulshear 2.7 WNW 0.00 29.707364 -95.939681
263375 MARSHALL 0.00 39.130000 -93.220000
263376 MARSHFIELD 0.00 37.340000 -92.900000
263374 MANSFIELD 0.00 37.120000 -92.580000

6797 rows × 4 columns



More generically speaking, we can write the code below to retrieve the row with the maximum rainfall for the storm, then retrieve its rain total in inches, station name, and coordinates.

import numpy as np

row = harvey_rain.loc[harvey_rain['Total'] == np.nanmax(harvey_rain['Total'])]

print(f"Max Rainfall = {row['Total'].values[0]} Inches")
print(f"Location = {row['Station'].values[0]}")
print(f"Latitude = {row['Lat'].values[0]}")
print(f"Longitude = {row['Lon'].values[0]}")
Max Rainfall = 60.58 Inches
Location = Nederland 1.5 SW
Latitude = 29.95
Longitude = -94.01

Plotting TC Rainfall

Tropycal provides two methods to plot tropical cyclone rainfall: by grid, or by individual observations.

We’ll start off with plotting gridded rainfall. First we’ll need to interpolate to a cartesian grid using the interpolate_to_grid() method, and retrieve an xarray DataArray of the grid and its associated coordinates. Note that the default is to interpolate to a 0.1 degree grid - you can use the grid_res argument to provide a different resolution.

Next we’ll use the plot_rain_grid() method to plot the output, and provide contour levels for plotting. As Hurricane Harvey was most damaging in Texas, we’ll provide a custom domain zoomed in over Texas.

#Interpolate to grid
grid = rain_obj.interpolate_to_grid(storm,return_xarray=True)

levels = [1,2,4,8,12,16,20,30,40,50,60]
rain_obj.plot_rain_grid(storm,grid,levels,domain={'s':26,'n':39,'w':-103,'e':-82})
Hurricane HARVEY Interpolated WPC Storm Rainfall (in), 17 Aug 2017 – 01 Sep 2017 115 kt • 937 hPa • 11.4 ACE
<GeoAxes: title={'left': 'Hurricane HARVEY\nInterpolated WPC Storm Rainfall (in)', 'right': '17 Aug 2017 – 01 Sep 2017\n115 kt • 937 hPa • 11.4 ACE'}>

Linear interpolation isn’t perfect of course, especially considering that some observations in this dataset aren’t perfectly quality controlled.

To compensate, we can also plot the individual rain observation dots using the plot_rain() method:

levels = [1,2,4,8,12,16,20,30,40,50,60]
rain_obj.plot_rain(storm,levels=levels,domain={'s':26,'n':39,'w':-103,'e':-82})
Hurricane HARVEY WPC Storm Rainfall (inch), 17 Aug 2017 – 01 Sep 2017 115 kt • 937 hPa • 11.4 ACE
<GeoAxes: title={'left': 'Hurricane HARVEY\nWPC Storm Rainfall (inch)', 'right': '17 Aug 2017 – 01 Sep 2017\n115 kt • 937 hPa • 11.4 ACE'}>

The Houston, Texas metro was particularly hard-hit by Hurricane Harvey, with rain totals over 30 inches in many locations.

Let’s filter the plot to only rain observations over 30 inches to highlight this, while zooming in closer over Houston:

levels = [1,2,4,8,12,16,20,30,40,50,60]
rain_obj.plot_rain(storm,levels=levels,minimum_threshold=30,domain={'s':27,'n':32,'w':-99,'e':-92})
Hurricane HARVEY WPC Storm Rainfall (>30 inch), 17 Aug 2017 – 01 Sep 2017 115 kt • 937 hPa • 11.4 ACE
<GeoAxes: title={'left': 'Hurricane HARVEY\nWPC Storm Rainfall (>30 inch)', 'right': '17 Aug 2017 – 01 Sep 2017\n115 kt • 937 hPa • 11.4 ACE'}>

Total running time of the script: ( 0 minutes 18.383 seconds)

Gallery generated by Sphinx-Gallery