Millions of people die from air pollution every year. We wanted to visualize the extent and spatial patterns of atmospheric contamination. For our analysis, we focused on PM2.5 fine particulate matter. These tiny particles are considered particularly dangerous. According to the World Health Organization (WHO), they harm health even in smallest quantities.

NASA’s Global Modeling and Assimilation Office (GMAO) provides data for a bunch of trace gases and elements in the atmosphere. The data product containing the PM2,5 data is available in hourly resolution, so we wanted to build an animated visualization. The advantages of an animation are obvious: Not only it reveals the hotspots, but also the atmospheric flows and how the geography affects the spread of air pollutants.

Charting the dust

Besides contributing to the storytelling itself, my main task was to build the ETL process for obtaining the data. As we could think of many other use cases for such a visualization, the process needed to be easily reproducible. I wrote a Python script for the ETL process that downloads all files (one for each hour – e.g. for a year, this marks a total of 24 * 365 = 8760 files) for any given timeframe. Then, a second script reads the data, extracts the desired band and renders a single image for each hour. Parameters control the legend ranges and color scales. This way, the process not only fits for rendering PM2,5 data, but for a lot of other GMAO-provided data sets on other gases or elements in the atmosphere.

In the next step, I manually stitched the rendered frames into a video using After Effects – but you could easily automate this step as well using open-source tools like FFmpeg. The resulting video is finally wrapped around an interactive WebGL globe using a template built by another developer on the team.

The script also calculates an annual mean layer for the whole year, which we used to show where exposure is the worst over the year.

The data pipeline soon paid off in a breaking news situation. A few months later, devastating wildfires raged in Canada. The wind drove the smoke south across the U.S. border as far as New York City, creating dystopian scenes of Big Apple under an orange-dyed sky. Within hours after NASA released the atmosphere data, we were able to publish a stunning visual explainer on the issue.

See it live