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_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_data(arm_username,
                                                arm_password,
                                                datastream,
                                                start_date,
                                                end_date,
                                               )
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113023.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113159.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113246.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113628.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113645.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113716.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113929.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113844.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113858.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113059.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113215.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113329.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113128.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113514.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113400.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113041.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113115.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113230.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113258.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113529.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113459.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113415.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113557.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113759.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113700.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113814.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113944.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113829.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113346.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113544.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113428.nc
[DOWNLOADING] houcsapr2cfrS2.a1.20220602.113728.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. 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

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"quicklooks/{radar.scan_type}/{Path(file).stem}.png", dpi=200)
    plt.show()
    plt.close() 
rhi
/srv/conda/envs/notebook/lib/python3.11/site-packages/numpy/core/fromnumeric.py:784: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  a.partition(kth, axis=axis, kind=kind, order=order)
../../_images/78cc13f2cbf173533c95a1b6e3bbc2243893b56e5b70b49c9b784bdb91bf9863.png
rhi
../../_images/008b6b1b4e15f2fee3b4850215c52c91b233bbdbd1a4bd7517839a03e3f90908.png
rhi
../../_images/e1a48b32ee59359fb308d098fda22f91d195f4a7bb6eb0b9103b99326b824a61.png
rhi
../../_images/f029554aaa94805c4a92915553b3055d83139062cc6db797787d5c51198a2e4b.png
rhi
../../_images/d6c38cb83f5436668fc3289976336f3e1fbf2415a6fab6805473529452f62059.png
rhi
../../_images/294ab61577d8602143727d3e22ea9da4e8dde2352ef06e33881bed010259adae.png
rhi
../../_images/dbbfba9087eb4fb2d53a52e1c455d39aeeb2d5be818dea3c1bbe14bc645df876.png
rhi
../../_images/8162255b911cb281467eb4ffbcb76cf5f9f8cec7781770e86c9f4db116dd8918.png
ppi
../../_images/f52260dfef6952729de1e4a38d934f38fcb6710b22f4b71c81be1be13e7fdb1b.png
rhi
../../_images/d79880b7c9acc89865106dd756f95d653324a39bfb47c8750de6fe259f8704d5.png
rhi
../../_images/bec4fe55254010264e21474392ff2640396efc1ba85136e6091d939a747e5800.png
rhi
../../_images/e20efeb9204ea0ebdeb5ceb3a510f746ea633796ef7905f2c317d089d2ae576c.png
ppi
../../_images/0c08bcb20e60577725cb3c7eec5f23b57bdc28e53f0a1015b73ef627384861b9.png
rhi
../../_images/a30e6b0db871f6f45ed017000348cbe8f48c4bd182348610b8dc37729bff4497.png
rhi
../../_images/fda75bb00ddcd344e462204bce7eee762d33b8ea0b68626c02cbe0177fa4f0d4.png
rhi
../../_images/b189d90003569d9ea764529bac6d8c05d6a174a7f2599727742e8802f41cf03f.png
rhi
../../_images/f485e39dbf1d41ea5ede3c38acf056ace21e53a0113bdf95bae935be1b57d72d.png
rhi
../../_images/26a6f95d0667e0583f69a7560e96d93a30273ed1ee0b8b3d968c603451071ba0.png
ppi
../../_images/c55afdd652a19939ca69bd980591f9d0d6d3299388007fddfeeffafbc50f2ba0.png
rhi
../../_images/930206af0e98ff51d5b1ffa3ed2e52ee5bbe8d6fb8a7b43f05e754651c585e5e.png
rhi
../../_images/99e0aca4ec346b0f4c26bc4cd71aa18f26e33e303cb574264f0a03b0526c8eda.png
rhi
../../_images/2429772d83845133d7a23f8ad70f8040a7bdfec667adcfd98b7c7feb176abafe.png
ppi
../../_images/3c2d0d53258434831ee2941e63934c90946f3e9238209e84e7728f23b85879ea.png
rhi
../../_images/8b6f622d83be8ee3ae7cf60c1a3497cd85d321fc48ae3559e23a1934f07cc0fc.png
rhi
../../_images/da6abd9cd2509fd52fb58e8e72bdc1fdd2bf03622c364e4a7dd9a0b2ce7649df.png
rhi
../../_images/a50a49aba4ab7151a6dc7aa6e5584a094e25e9e51c94903bb36561ea7159ad4c.png
rhi
../../_images/0eb5bf92f008662abc9aab0acd6c8247853250eb929be23a95b7acee670ba344.png
rhi
../../_images/df258c8f2faed89fd0a6cae198e78736fe38ee4a1e8a4ed7c93295e3761881a6.png
rhi
../../_images/05e522aed7d11acbef2f07ef1ee86ea603ba9fc6df318762d046f619b4ba35fc.png
rhi
../../_images/44c460d3802fc039f27b3ab56da9a3c81bef73e778109dce4a54d9e306f44961.png
ppi
../../_images/de57b74e8a098f02d6f65a1cd2854cfc3d7a1bb4923e11abb207316284acf0bd.png
ppi
../../_images/91a5c8a216c5d93a7d46e5a67dd9edab1c349415cd355642b9da4dffd0dd6095.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"quicklooks/{radar.scan_type}/{Path(file).stem}.png", dpi=200)
        plt.show()
        plt.close() 
../../_images/f7187a82e00bd545ae1364d587cc5e8a4a46664db2808e1bf335704b89f2d457.png ../../_images/eb66335e8106a1fc17406f4b6a9e2abb10a52ea4300184b7fd414f90f07daab7.png ../../_images/a35177ef8f2dcb0b6c659c61b987b652713d802439df19b880b6c42d781d4900.png ../../_images/dd9dbf0b723a6d22e58867de637b3d684ed5a052677b2fa42da45f6d70a1fbe9.png ../../_images/bc67e72851138bc0d00588dfd951a8467a9156f545bc77140f1d9e9bb96942e9.png ../../_images/4517ebbd12f97ce00a675df7eae44a67c4ca38bb329d547c4e8a56b471b21332.png ../../_images/33c26b64f5a1c062b03f500ee4d1998044e188c624c12957251f08ddc81185fe.png ../../_images/504867548aecf81f0c0b8f2b5e932b054260cb8b254d30ffd9940b611a12e637.png ../../_images/91ed41763dd6cb5f6c94475397149807209638a07f9a798af1fb4296aa0cc396.png ../../_images/4abf05eb2e2638bcd972227144642bbe378e66edc0b887f01cdbacb738072130.png ../../_images/3f2ac581ecf322b419accccdcd209c8aff2d55762131e8579856b428d1755dec.png ../../_images/87626d13f0aafc4f4357733a6d164d692eac2b71a2504ab0c47cdffb7b94fa14.png ../../_images/e70b686c3d5f6b7f1ce298af2ff39ed800e2b4555819699a9ece286cb1e702ef.png ../../_images/b28f380588664209dbb0cf57dd64c6bfe93a3f761537faa845cdf3db55750bb2.png ../../_images/e1fba308ba5a0a0ac3132ae19655b4f528266db4fda52885de4512bcf10b30cd.png ../../_images/bc756b1a21f99eebce63b65dfca9f94392c4f03ccc93ce57e30718f569a0c4c7.png ../../_images/402314c74f3888ec7c87539d18ee88f2be739272207728cabf99da8c8f18b260.png ../../_images/7c5932bad31ca4d361907e90d75682d8c0389265af965ac34bd823dd66dd4edb.png ../../_images/7ac7400e41b0bc66bbf72f3e0ab5e1b77a8e17b39398087cc8c9550cb4be3868.png ../../_images/764e07dc8d3fe0392579c75411d716bac6ca726bdf66d4d6fe85b8f27b8e24f7.png ../../_images/c12d04159ad030982e47a9deae2139a92beb00b1c464a7425e2e1bf35aacc12b.png ../../_images/bf9522d9858460205212b8f60e5e53f2174c893078fed64acd45dd87f8ad381f.png ../../_images/1f374fb97ea21ebf4724a4dfda5dd1539a16018c0bd6895de2232d32032c55ef.png ../../_images/5a38cf357c18173f94fd92990ef88622cb13c7bb6384fc5d286f54ed5c00cf00.png ../../_images/badfce252a6463ce5528c27276ffa4ef30a756262d2ae3d418c11bf011f1ebd6.png ../../_images/52530122686951f7d3de26f2c112c859632c2a0a38fd97fcb2a819e377cdcf1c.png

Create a GIF of teh RHI images

rhi_images = sorted(glob.glob("quicklooks/rhi/*"))
with imageio.get_writer('storm-animation.gif', mode='I') as writer:
    for filename in rhi_images:
        image = imageio.imread(filename)
        writer.append_data(image)
notebooks/example-workflows/storm-animation.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