I created this hurricane track IPython notebook for all to enjoy. This project was suggested to me by some Python enthusiasts here at Unidata and while I was familiar with IPython and its notebook feature, this was a great opportunity for me to explore the interactive use provided by IPython interactive widgets and how to create an interactive environment in which National Hurricane Center data could be visualized.
This IPython notebook downloads several files from the National Hurricane Center's storm annals. The first file contains a tech list which describes the model abbreviations used in the archived individual storm data files. The second file read in includes a running list of storms dating back to 1851. Since the National Hurricane Center's data spans more than 150 years worth of hurricane seasons, I implemented a set of interactive widgets to select the desired hurricane season year and a specific storm from that year. Data analysis was done with Python's Data Analysis Library, Pandas, and its DataFrame structure. Pandas' GroupBy command allowed for simple yet powerful data wrangling to sort latitudes and longitudes into the necessary order for plotting. The use of matplotlib's artists permitted for fast plotting of tracks throughout time. Essentially, artists are the graphical objects such as lines or text that are painted onto matplotlib's canvas through Figure or Axes. Rather than redrawing each frame with a plot command, we re-set the data for each artist with the next set of latitude and longitude points. A widgets controls whether a single model is plotted or if multiple tracks will be displayed. A widget also controls the time, or frame number, for the plot. Toggling between displaying multiple tracks and a single track is possible. The dashed blue track that is displayed in both modes represents the best track.
By using the slider widget, a specific year can be selected. After pressing the “Get Storm Names” button widget, the dropdown widget will be filled in with all of the storms from that year. When the desired storm is selected, the “Plot Selected Storm” takes care of running the necessary to code to produce the plot.
When the plot appears, the default model displayed is the NHC. Different models can be chosen from the dropdown widget. The forecasted track displayed can be controlled by either the slider widget or with the buttons below it, in increments of one either way.
When the “Add multiple tracks” checkbox widget is selected, a new set of widgets are displayed. In order to select models to be displayed simultaneously, each model must be selected from the dropdown widget separately. After a model is selected, click “Add New Track” until all of the desired models are chosen. When this is done, “Plot New Tracks” will display the tracks on the plot and also change the plot title to include the names of all of the chosen models. “Clear Plot” will erase all selected tracks and allow for the process to be repeated with a different set of models.
I really enjoyed this experience of creating fast and efficient methods to handle robust data sets, but what I find really exciting is visualizing them in a useful way. I am eager to see how the community responds to my initial efforts and in which direction they choose to take my work. This notebook can be found on GitHub or downloaded here. I encourage you to leave me a comment below with your thoughts or become a contributor to the GitHub branch. You are also welcome to drop a note at Unidata's python support mailbox.