TRACER Animation

Plotting Data from a Field Campaign (TRACER)

Overview

Within this notebook, we will cover:

  1. How to access data from the Atmospheric Radiation Measurment (ARM) user facility

  2. How to setup a workflow to plot both cross sections (RHIs) and horizontal scans (PPIs)

Prerequisites

Concepts

Importance

Notes

Matplotlib Basics

Required

Basic plotting

Py-ART Basics

Required

IO/Visualization


Imports

import glob
import os
from pathlib import Path

import act
import imageio.v2 as imageio
import matplotlib
import matplotlib.pyplot as plt
import pyart
## You are using the Python ARM Radar Toolkit (Py-ART), an open source
## library for working with weather radar data. Py-ART is partly
## supported by the U.S. Department of Energy as part of the Atmospheric
## Radiation Measurement (ARM) Climate Research Facility, an Office of
## Science user facility.
##
## If you use this software to prepare a publication, please cite:
##
##     JJ Helmus and SM Collis, JORS 2016, doi: 10.5334/jors.119

Grab Data from ARM

One of the better cases was from June 2, 2022, where several cold pools and single-cell storms traversed through the domain.

The Tracking Aerosol Convection Interactions ExpeRiment (TRACER) Field Campaign

Data is available from the Atmospheric Radiation Measurment user facility, which helped to lead the TRACER field campaign in Houston, Texas.

The data are available from the ARM data portal (https://adc.arm.gov/).

We are interested in the C-band radar, which is utilizing a cell-tracking algorithm, with the datastream

  • houcsapr2cfrS2.a1

Use the ARM Live API to Download the Data, using ACT

The Atmospheric Data Community Toolkit (ACT) has a helpful module to interface with the data server:

act.discovery.download_arm_data?

Setup our Download Query

Before downloading our data, we need to make sure we have an ARM Data Account, and ARM Live token. Both of these can be found using this link:

Once you sign up, you will see your token. Copy and replace that where we have arm_username and arm_password below.

arm_username = os.getenv("ARM_USERNAME")
arm_password = os.getenv("ARM_PASSWORD")

datastream = "houcsapr2cfrS2.a1"

start_date = "2022-06-02T11:30:00"
end_date = "2022-06-02T11:40:00"

print(len(arm_username), len(arm_password))
8 16
june2_csapr_files = act.discovery.download_arm_data(arm_username,
                                                arm_password,
                                                datastream,
                                                start_date,
                                                end_date,
                                               )
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113215.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113246.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113346.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113128.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113258.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113400.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113415.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113645.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113929.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113829.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113858.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113041.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113023.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113230.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113514.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113059.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113529.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113544.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113716.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113700.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113728.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113944.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113329.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113628.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113428.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113557.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113759.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113844.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113159.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113115.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113459.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113814.nc
If you use these data to prepare a publication, please cite:

Bharadwaj, N., Collis, S., Hardin, J., Isom, B., Lindenmaier, I., Matthews, A.,
Nelson, D., Feng, Y.-C., Rocque, M., Wendler, T., & Castro, V. C-Band Scanning
ARM Precipitation Radar (CSAPR2CFR). Atmospheric Radiation Measurement (ARM)
User Facility. https://doi.org/10.5439/1467901

Read in and Plot the Data

Before following running the next cells, make sure you have created the following directories:

  • quicklooks/ppi

  • quicklooks/rhi

  • quicklooks/vpt

!mkdir quicklooks
!mkdir quicklooks/rhi
!mkdir quicklooks/ppi
!mkdir quicklooks/vpt
mkdir: cannot create directory ‘quicklooks’: File exists

Loop through and plot

We read in the data, check the scan type, and plot a basic RadarDisplay which will automatically detect whether the plot is a vertical cross section (RHI or VPT), or a horizontal scan (PPI).

This offers a solid “quick look”, or initial visualization of the data.

for file in june2_csapr_files:
    radar = pyart.io.read(file)
    print(radar.scan_type)
    display = pyart.graph.RadarDisplay(radar)
    display.plot("reflectivity", 0)
    plt.savefig(f"{radar.scan_type}_{Path(file).stem}.png", dpi=200)
    plt.show()
    plt.close() 
rhi
../../_images/44a5a7550b92a7fea05e7bb4a6b2ec021e210c8e5ec919218948ee13e1a7b536.png
rhi
../../_images/459dae233e5137b2308446073b5692103cadda80ba74ac16d651e0f86548eb5b.png
rhi
../../_images/1bc90a06640fee9c3e955e5de3e536f6a8a666accf5993aa9933332aa84918c0.png
sector
../../_images/c3e01c53b282007fe166e25420082496fd818816eb94dd5ba424f3fd32180a70.png
sector
../../_images/a1f7497f08ac3ee132dab61a5b575e71123b607eb033ed6fc54647b8afb5c0f2.png
rhi
../../_images/d2881d5fc2221f4812716a9ce2a07bcd37f3fb398faee0a47bccfa632482c59d.png
rhi
../../_images/fd10565b0d78420482dae076c5ece091f4216c8a2e5b7c975ff1c32bdd064f58.png
rhi
../../_images/8c61fb25e07aaf7e3b045df1122c2d94f5958d8490bf52681dfebe19dba06ceb.png
rhi
../../_images/df5756d382bc6dc3f38723649a17a6f8774f88cdc05309340a9c21c4703bab8d.png
rhi
../../_images/57fc92a31a3beab49e1f7f33a0e23ac0cfd2e29338e07d69aace6ef25dc42ac7.png
sector
../../_images/8b2cdb91ae513c922192e4f4150d41e51d7d2ec40d549d2f83142fc35fbab7c3.png
rhi
../../_images/1ed11f053ab9ee2ef7508788a99810a75ad78f3b78a088924469116108574c21.png
rhi
../../_images/60f4fe44261849be6e6d284f1aafe17eb22870adca3bad728259b508e6a6be22.png
rhi
../../_images/cfadddab4aca376db3480197f07ebc463eaf3857193cf2acda1d09d3bb34c0ed.png
rhi
../../_images/11f04ca0929cc9d1bbf98f31f112fa15f64d3e10180ffa661306f3d65a6dd88b.png
rhi
../../_images/31d22ad89435d90f323f776807e5a433c4504dad96f1942e79da81ee86be1613.png
rhi
../../_images/46a03a44c2da6feedcccec349c6d2011ff459d4152ccd648c5bf848d4415aab4.png
rhi
../../_images/f4289c44bcb399b01499002c6f0ead61d291db65206382a5d94497beb91fafec.png
rhi
../../_images/bf4bc4c5b167469f81f033d45e5ad0c5710a5d7b5089b8cfaed3e2ad86476aa1.png
rhi
../../_images/52d20a15b769892f0aa167be6eac03cb90c70c0bab98f5450151c9d80568b9be.png
sector
../../_images/4429acf27771ed15463b6d456c7e0803177c31f05388ad934c3c3225436c04f6.png
rhi
../../_images/eec45e84efaae5509ec10d265caf9f089b71fe6298e5170cc33b194bb6239a99.png
rhi
../../_images/32f44d0cd257e7507be592be8bff8da89007fab540b6acff9f7f6bcfe42ffb9d.png
rhi
../../_images/f23f130ca8a2cc389b1dde5caf2603245b3422d3d9483a32f976477e08731dbb.png
sector
../../_images/a25b63689fe0b9632384d3db1080eb6832b8069b2c0cbb32576228d90541b556.png
sector
../../_images/af3d0887e3ef150ff64a5f72f6f54d98e5085b9a2d9f9d16debfecf883a2ca4f.png
rhi
../../_images/804111240417f4f8a9d7d46e238afceed73c069fd8cda4f25759871e9e617b6d.png
rhi
../../_images/9f354c810ee6c2066be6f7a6c1cd87fcb2a1bf2734bd84e2b079081542fd9071.png
rhi
../../_images/3b2be7a5f17c3f9ee39f1b60952280ea6826d018f5ef048e8cadb16ef286164e.png
rhi
../../_images/27f00273c15c29833c4a5da04c1918376a847f1fb7d7bbd8f026e762f05f9444.png
rhi
../../_images/9c581f0704f36f9ed76273b37129e93a279caab645f2a797fc59ad02645b908a.png
rhi
../../_images/389e669b395e9dfde6f933daf22698783faaa727446910b500a95478edc8e233.png

Refine our Plot, Plot Velocity

Let’s focus on the vertical scans of the data, or the RHIs.

You’ll notice that we had some cells around 60 km from the radar, with the vertical axis less than 6 km.

Let’s reflect that in the plots!

Customize our plot look

Before we plot, we can change the size of our font, and style using the following parameters:

font = {'family' : 'serif',
        'weight' : 'bold',
        'size'   : 16}

matplotlib.rc('font', **font)

Apply our Plotting Loop

We:

  • Check to see if the scan is an RHI

  • Plot the reflectivity on one subplot

  • Plot velocity on the other

  • Save our plots

for file in june2_csapr_files:
    radar = pyart.io.read(file)
    if radar.scan_type == 'rhi':
        fig = plt.figure(figsize=(20,8))
        display = pyart.graph.RadarDisplay(radar)
        ax = plt.subplot(121)
        display.plot("reflectivity",
                     0,
                     ax=ax,
                     vmin=-20,
                     vmax=70)
        plt.xlim(62,68)
        plt.ylim(0, 6)
        
        ax2 = plt.subplot(122)
        display.plot("mean_doppler_velocity",
                     0,
                     ax=ax2, 
                     cmap='pyart_balance',
                     vmin=-15,
                     vmax=15)
        plt.xlim(62,68)
        plt.ylim(0, 6)
        plt.savefig(f"{radar.scan_type}_{Path(file).stem}.png", dpi=200)
        plt.show()
        plt.close() 
../../_images/41fbdd3ebe1fc5891b92800fcc1918b874980c26e90cbb0da966efaea6c59906.png ../../_images/21c42b825432f369542dcd2be8da06631b85eace5496e23b825551d2b782a90f.png ../../_images/505dd0cdaf8d2710fa61511c6b2afb3ad6223081892a6aaae4d89ff06468840b.png ../../_images/990a0a8e713ab68c29da6c712203f75c9c2cd51d71042a0a2226a7e0688b1fa1.png ../../_images/654cf2513247dd1a9147ec9c4f7ea5d6ba9711326442108ca43e2b1486d1b0fd.png ../../_images/877beda39a0b03390f3a2e7a44fffbf73ad17b67215e27f2de6ca5dca7003af1.png ../../_images/4994de9e0b9917a5e56f3617af547268d535d600a3c7b5866b85043d4f85bc19.png ../../_images/293272a70028b59fd61c582f6a02fa12b88067f5a76c97cd8a24754b2b8f0013.png ../../_images/798038882ec298d42172d31cb5edab50a56d5cc5c7379b8152f719046603214c.png ../../_images/34b3f12a5ffe5a18f5138a211c9f4c682812093f76395f3e92c751f025f55168.png ../../_images/8439aa784399a7572bbf060b57a1e40b4b37362d0009b72eaff4a92ffb3ac830.png ../../_images/22b5ecf2b625c14d9276d0d497583ec2da4e321424e02f79158d38f7b1188e2b.png ../../_images/58951bdd3ccfcb6cdf375efc455bbb6b55d57087a2be0cd6350547824b795ed6.png ../../_images/05dd481804a3e6565566ddb8b25296857d0942a9eec1c7e32067a6815c72adf7.png ../../_images/016e852e4d655a6d83700b143568acc46fc3487367d99dd97cffdef5bdae2dfa.png ../../_images/d649ac72eef716883e8d9250ef4c57d2bdd112d8aa0fc1f8297c7313007017b2.png ../../_images/77a8eeee1e7131f7286949e86971cf58c81e52db18c06583019aee9b8d2efb41.png ../../_images/9a16b2be9e2b511f77afde5ae6823122b459267bd761d1128dd06109f831938b.png ../../_images/eda8135ec0bdbfccd00cb88f463006de7d6163b604415fe0db549f37a896a447.png ../../_images/4ef2d0fed039eda331cec666328f0416b5a066c4529e768a90c1034d40378819.png ../../_images/93a91bc4cdcf42e01b156bb0480c037a1f1fbeff069c8e8e6777a609cdfff387.png ../../_images/b49e49ae43e4c8c832ccc37184b6a6a11e8826929f21f46e5c12197c10c50e15.png ../../_images/2b285857291e8dabb880eb8be8986853258eca106419f7fd7a0eda58621d31f7.png ../../_images/80092de9e4dec07354a9c41bd06126d17542eea8981b69a336153ce264e30cae.png ../../_images/f60ee29512d80e40f25881c6b381a007deca49c619f74bb40d21c7a626f74c76.png ../../_images/b5271025c4d1d2e49ddda75157507ea3443d9d6edfd16b6a4d17f807e75f9ca7.png

Create a GIF of the RHI images

rhi_images = sorted(glob.glob(f"{radar.scan_type}*"))
with imageio.get_writer('storm-animation.gif', mode='I') as writer:
    for filename in rhi_images:
        image = imageio.imread(filename)
        writer.append_data(image)
../../_images/storm-animation1.gif

Summary

Within this example, we walked through how to access ARM data from a field campaign in Texas, plot a quick look of the data, and refine our plots to investigate a storm!

What’s Next?

We will showcase other data workflow examples, including field campaigns in other regions and data access methods from other data centers.

Resources and References

  • ARM Data Discovery

  • TRACER Field Campaign

  • CSAPR Radar Data:

    • Bharadwaj, N., Collis, S., Hardin, J., Isom, B., Lindenmaier, I., Matthews, A., & Nelson, D. C-Band Scanning ARM Precipitation Radar (CSAPR2CFR). Atmospheric Radiation Measurement (ARM) User Facility. https://doi.org/10.5439/1467901

  • Py-ART:

    • Helmus, J.J. & Collis, S.M., (2016). The Python ARM Radar Toolkit (Py-ART), a Library for Working with Weather Radar Data in the Python Programming Language. Journal of Open Research Software. 4(1), p.e25. DOI: http://doi.org/10.5334/jors.119

  • ACT:

    • Adam Theisen, Ken Kehoe, Zach Sherman, Bobby Jackson, Alyssa Sockol, Corey Godine, Max Grover, Jason Hemedinger, Jenni Kyrouac, Maxwell Levin, Michael Giansiracusa (2022). The Atmospheric Data Community Toolkit (ACT). Zenodo. DOI: https://doi.org/10.5281/zenodo.6712343