This page demonstrates Python tips and tricks that I use in my everyday programming as an atmospheric science graduate student.
-Brian Blaylock

Monday, August 5, 2013

Meteolib

Meteolib is a useful package for doing calculations with weather data. The script is found here.

I have found windvec very useful for averaging wind speeds and wind directions. Wind direction is difficult to average because when you average NW and NE winds by the number of degrees it averages to a South wind, and that is not correct. The function windvec will give you the correct vector averaged wind direction.


Saturday, August 3, 2013

Basemap Resolution

I participated in NASA's Student Airborne Research Program during the summer of 2013. A total of 31 students, including myself, participated in the program. We worked on the DC-8 flying laboratory and flew about 4,600 miles all over California. With the data we collected on the plane, each student worked on an individual research project. I was determined to do all my data analysis using Python. One useful tool was the basemap library.

The basemap toolkit allows programmers to draw maps and plot information on the map. I quickly learned that maps can be drawn at various resolutions: crude (c), low (l), intermediate (i), high (h), and full (f). Maps with higher resolution take more computing power and take longer to draw. Below is a comparison of the quality of each map resolution showing Southern California.
On these maps I could add color, latitude and longitude lines, and finally plot data. Shown below is data from the Air Resources Labratory HYSPLIT model showing a 24-hour backward trajectories for Los Angeles on the days shown below. The star is downtown LA and the blue path shows the travel path of an air parcel in LA at the given date and time.

Wind Rose

I found some code online to plot a wind rose. I used data from the my personal weather station to plot wind direction, frequency, and speed on this beautiful wind rose.


I participated in NASA's Student Airborne Research Program in 2013. I studied weather influences on air pollution in the Los Angeles area. As part of my project I made the following pollution rose plots. They are similar to the wind rose shown above, but these only show the wind direction at the daily maximum ozone concentration. Plotted is every day between April 1 and September 30 between 2008 and 2012. It is colored by the max ozone concentration for that day.


Costa Mesa
Los Angeles (Main Street)

San Bernardino
Santa Clarita