Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

METAR Temperature Visualization with Lonboard

CIRES University of Colorado Boulder

Overview

Within this notebook, we will create an interactive visualization of the latest METAR data across all stations. We will use the following libraries for our visualizations:

  1. Geopandas

  2. Lonboard

Prerequisites

ConceptsImportanceNotes
PandasRequiredTabular Datasets
  • Time to learn: 10 minutes


Get the past three days of data

This query will request just the latest hours worth of data across all stations.

end time: 2026-10-01 05:27:48.435769
start time: 2026-09-28 05:27:48.435932

Query the database for all data between those timestamps

Loading...

Print the first couple columns of data to get an understanding of the structure

Loading...

Understanding the data columns

The documentation can be found here for the individual columns:

https://github.com/dynamical-org/asos-parquet#key-fields

Print the columns as follows:

Index(['station', 'valid', 'longitude', 'latitude', 'tmpf', 'tmpc', 'dwpf', 'dwpc', 'relh', 'drct', 'sknt', 'gust', 'alti', 'mslp', 'vsby', 'p01i', 'p01m', 'state', 'geometry', 'name', 'elevation', 'country', 'county', 'wfo', 'tzname', 'bbox', 'year'], dtype='str')

Now create a dictionary which assigns descriptions to each column

Plot Timeseries data from a specific station

Select some of the variables from the Boulder, Colorado station, and set the time of each observation as the Dataframe’s index.

Loading...
Loading...

Plotting Across All Stations using Lonboard

Now we will use the library Lonboard to plot the latest temperature data across all stations.

Get the newest observations from each station

Loading...
Index(['station', 'valid', 'longitude', 'latitude', 'tmpf', 'tmpc', 'dwpf', 'dwpc', 'relh', 'drct', 'sknt', 'gust', 'alti', 'mslp', 'vsby', 'p01i', 'p01m', 'state', 'geometry', 'name', 'elevation', 'country', 'county', 'wfo', 'tzname', 'bbox', 'year'], dtype='str')

Create a geometry from the point data using longitude and latitude

And create a GeoPandas DataFrame. We want the data in a form with columns of: [index, feature0, ..., featureN, geometry]. We will use tmpf which is the temperature in degrees Fahrenheit as the singular feature.

Loading...

Figure out the minimum and maximum temperature values for the dataset

min temperature: -4.0 degF, max temperature: 98.6 degF

Mapping the Temperature Gradient with Lonboard

Colors are plotted with a red-blue divergent color scheme. Warmer temperatures are denoted with ‘red’ and cooler temperatures are ‘blue’. An example is below:

<IPython.core.display.Image object>
Loading...

Next, Relative Humidity (‘relh’)

Dark green means a higher value. Red means a lower value.

<IPython.core.display.Image object>
Loading...

References

Future work:

  • Add a legend

  • More interactivity

  • Visualize other variables, such as the u and v horizontal wind components

What’s next?

We will perform a variety of time-series analyses on METAR data.