Last Monday was a big day for folks in the geoscience and astrosciences — the 2017 total solar eclipse! Many of those on the Unidata team made the drive to be in the path of totality, where the sun was completely blocked for a period of up to two and a half minutes. In this MetPy Monday post, we will take a look at some animations made in Python and posted by the team just after the eclipse.
The eclipse ran roughly from 15-21 UTC, beginning in the northern Pacific Ocean and ending in the low latitudes in the Atlantic Ocean. At 21:30 UTC, a set of automated scripts began to run, pulling down all sixteen chanels of GOES-16 imagery for the CONUS, as well as all ASOS observations from the IEM archive. The scripts then proceeded to produce animations of these data that were then tuned and posted on the Unidata YouTube channel that evening. All of the code behind gathering the data and making the animations is enough to fill a few months worth of MetPy Monday posts, so I want to give you a high level over-view of how we accomplished this. The code is publicly available in a GitHub repository for you to download, adapt, and play with.
Let’s start by looking at the simplest of the animations - the animation of the path of the eclipse. We used the NASA-produced eclipse shape files in conjunction with Cartopy to make an animation of the umbra path with time stamps. We first make the basic map as we’ve discussed in past MetPy Mondays. We then use the shapereader module from
cartopy.io to read in the shape files for the umbra path, center path, and individual umbra footprints. We also plot the static features like the state outlines and the umbra path/center.
Next we run through a loop that iterates through the umbra footprints. The NASA shapefile has a umbra footprint for every second of the event, but we just plot every fifteen seconds to speed up the animation. We catch the artist that matplotlib returns from that plotting command and, together with a text time stamp, append them to a list of artists that we will animate using matplotlib’s
To make the satellite animations, we used the Siphon package to download data from the GOES-16 Advanced Baseline Imager (ABI). In this case we archived all data locally since we wanted to preserve the data from the event, but in a more real-time setting the data could be opened without the need to save it to disk. There are a few more details on plotting satellite imagery in our Python workshop satellite notebooks, but in the end it comes down to using an
imshow command and using a list of artists, as before, to produce the animation. We overlaid the umbra path and center line to help guide the eye during the animation.
Personally, I found the temperature change during the eclipse to be the most interesting animation. Earlier this summer I looked at data from an eclipse in 1994 and found that even on hourly observations the temperature drop was very clear and propagated along the path of totality very nicely. I was excited about this eclipse since it cuts across the entirety of CONUS and intersects a lot of stations. My home weather station even observed a roughly 10 C temperature drop during the 95% coverage it experienced.
To get the ASOS observations, we used a modified version of the fetch script from the IEM archive GitHub repository. Each station was an individual HTTP GET request, so the data gathering ran for quite a bit of time. The data were then put into a single file that we parse during the animation process.
Since stations could report at slightly different times, we wrote a small helper that groups stations with data reported in some interval, in this case 10 minutes on either side of the plot time. This does of course introduce some smearing across time, but gives us a more robust plot with as much relevant data as possible plotted at once. We used Pandas to do the data munging as it was the fastest to develop with and had a lot of useful functionality already built in. The same animation technique was used, but this time with a colored scatter plot.
Finally, notice the MetPy logo in the corner of the animations? That’s a sneak peak into MetPy 0.6 which is slated to release next month. There are a lot of exciting new features in 0.6. Once of the new capabilities is the ability to easily add the MetPy or Unidata logos to your plots!
What interesting data visualizations did you see after the eclipse? We've seen everything from traffic maps to Twitter traffic to Google search trends. On next week’s MetPy Monday we will dig into using widgets to explore live GOES-16 data available on Unidata’s THREDDS Data Server!