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.
Nice work Florita. For those of you who want to play around with this notebook, and using the conda package manager you can
conda create -n hurricane -c <user> netcdf4-python numpy basemap ipython pyzmq jinja2 tornado pandas
source activate hurricane
At this point, you can run the IPython Notebook in the cloned directory.
I believe you need IPython >= 2.0. True?
Adding some of this information/instructions in the README.md would be good.
Again, nice work!
Posted by Julien on July 21, 2014 at 04:49 AM MDT #
“Clear Plot” will erase all selected tracks and allow for the process to be repeated with a different set of models.
Posted by Vanessa on August 14, 2014 at 09:46 AM MDT #
I finally added the conda instructions to the README on github. Note the conda commands I describe above are not totally correct so please see README for the definitive conda installation instructions.
Posted by Julien on September 24, 2014 at 08:35 AM MDT #
Hi,
Not sure if anyone will see this but does this still work? I'm getting an error when trying to activate the notebook
Posted by George on July 28, 2018 at 08:55 AM MDT #