Converting Ugly Text to Beautiful Maps:
Adding METAR Support in MetPy

Max Grover
Max Grover

The primary task that I completed this summer was adding METAR functionality to MetPy. METAR stands for METeorological Aerodrome Report. METARs contain information about surface data including temperature, dew point, wind speed and direction, and several other meteorological variables. Prior to this summer, MetPy did not have the ability to parse METARs. Also, the current parser that is used to generate netCDF files on the Unidata THREDDS server had a substantial amount of missing data. By adding METAR parsing tools, we made additional surface data available to the user, making it easier to make high quality surface maps using MetPy.

Sample METAR
Diagram of a sample METAR
(click to enlarge)

METARs can be encoded by either computers or humans — which can make decoding difficult. Despite having structural guidelines determined by the World Meteorological Organization, there are numerous errors in the observations which cause headaches when attempting to parse out the information. Using Canopy, a parser compiler, a parsing tree was created that is flexible enough to be able to parse out the most important information relevant for station plots including: temperature, dew point, station identifier, time, day of month, along with all the other variables before the remarks section.

Surface map
Example of a surface map

The METAR parsing functionality works either with single strings of text or with text files like those delivered by Unidata's Local Data Manager (LDM). The parser takes the text, parses out the surface observations, then appends them to a single Pandas dataframe. Pandas dataframes are useful in Python because they are easy to subset and assign units to. The data stored in the dataframes can then be used with the Station Plot functionality already in MetPy to create surface maps.

What's Next

One of MetPy's goals is to provide the functionality to replace the General Meteorology Package (GEMPAK). GEMPAK can be used to visualize meteorological data, ranging from GOES-16 satellite imagery to surface data. Previous interns have worked on adding sounding calculations and cross sections, which are useful for a wide variety of applications. MetPy still lacks the ability to make surface maps using a simplified declarative interface. Through using the new METAR parsing functionality, a simplified plotting interface can be implemented which will make it easier for new users to create publication quality maps. Instead of using 30-40 lines of code, the new plotting interface will be able to plot surface data onto a station map in about 10 lines.

Teaching Python
Teaching Python

Unidata Workshop at Albany

Before I even started on my METAR decoding journey, I flew to Albany, New York to aid in teaching the Unidata Python Workshop at the University at Albany, SUNY. Ryan May and I taught professors, students, and others interested in learning how to use Python for meteorological applications.

Comments:

Post a Comment:
Comments are closed for this entry.
Unidata Developer's Blog
A weblog about software development by Unidata developers*
Unidata Developer's Blog
A weblog about software development by Unidata developers*

Welcome

FAQs

News@Unidata blog

Take a poll!

What if we had an ongoing user poll in here?

Browse By Topic
Browse by Topic
« March 2024
SunMonTueWedThuFriSat
     
1
2
3
5
6
7
8
9
10
11
12
13
14
15
16
17
19
20
21
22
23
24
25
26
27
28
29
30
31
      
Today