Multipanel hvPlot

Interactive Radar Visualization

Overview

Within this cookbook, we will detail how to create interactive plots of radar data!

  1. Reading data with Xradar

  2. Creating your first interactive figure with Xradar + hvPlot

  3. Combining your plots into a single dashboard

  4. Filtering and Checking Data Quality

  5. Create a Dashboard to Analyze ZDR Bias

Imports

import xradar as xd
import fsspec
import pyart
from open_radar_data import DATASETS
import hvplot.xarray
import holoviews as hv
import panel as pn

hv.extension("bokeh")
## 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

Prerequisites

It is recommended that you are familiar with working with weather radar data, the core data structures, and the basics of reading in different radar datasets.

Concepts

Importance

Notes

Intro to Cartopy

Necessary

Xradar User Guide: Plot a PPI

Necessary

Understanding of NetCDF

Helpful

Familiarity with metadata structure

  • Time to learn: 30 minutes

Reading Data with Xradar

While we have focused much of the content around the Python ARM Radar Toolkit (Py-ART), Xradar is another helpful package we can use to work with this in xarray!

Here, we use data from the Colombian weather radar network, using some remote access tools such as fsspec.

fs = fsspec.filesystem("s3", anon=True)
files = sorted(fs.glob("s3-radaresideam/l2_data/2022/08/09/Carimagua/CAR22080919*"))
files
['s3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809190003.RAWDSVV',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809190315.RAWDSW0',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809190401.RAWDSW3',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809190505.RAWDSW8',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809191003.RAWDSWM',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809191314.RAWDSWT',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809191400.RAWDSWX',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809191504.RAWDSX2',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809191817.RAWDSX7',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809191903.RAWDSXA',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809192005.RAWDSXF',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809192316.RAWDSXM',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809192402.RAWDSXR',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809192504.RAWDSXW',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809192815.RAWDSY1',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809192901.RAWDSY5',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809193004.RAWDSYA',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809193315.RAWDSYG',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809193402.RAWDSYK',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809193816.RAWDSZ0',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809193902.RAWDSZ4',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809194003.RAWDSZ7',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809194315.RAWDSZA',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809194401.RAWDSZE',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809194504.RAWDSZJ',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809194816.RAWDSZP',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809194902.RAWDSZU',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809195003.RAWDSZY',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809195315.RAWDT04',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809195401.RAWDT07',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809195504.RAWDT0D',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809195815.RAWDT0J',
 's3-radaresideam/l2_data/2022/08/09/Carimagua/CAR220809195900.RAWDT0M']

Once we have our files of interest, we can load one in. Let’s read in a single file - for example, we are interested in the 8th file (index=7)

task_file = fsspec.open_local(f'simplecache::s3://{files[7]}',
                                s3={'anon': True},
                                filecache={'cache_storage': '.'})

Read the data in xradar

We use xradar, an open-source toolkit to read weather radar data and load into the Xarray data structure. The data format here is an IRIS file, so we use the open_iris_datatree reader.

radar = xd.io.open_iris_datatree(task_file).xradar.georeference()
radar
<xarray.DatasetView> Size: 248B
Dimensions:              (sweep: 1)
Dimensions without coordinates: sweep
Data variables:
    volume_number        int64 8B 0
    platform_type        <U5 20B 'fixed'
    instrument_type      <U5 20B 'radar'
    time_coverage_start  <U20 80B '2022-08-09T19:15:05Z'
    time_coverage_end    <U20 80B '2022-08-09T19:16:21Z'
    longitude            float64 8B -71.33
    altitude             float64 8B 206.0
    latitude             float64 8B 4.564
    sweep_group_name     (sweep) int64 8B 0
    sweep_fixed_angle    (sweep) float64 8B 0.5
Attributes:
    Conventions:      None
    instrument_name:  carimagua-radar
    version:          None
    title:            None
    institution:      None
    references:       None
    source:           Sigmet
    history:          None
    comment:          Primera tarea del modo precipitacion / 0.5
    scan_name:        SURVP       

Creating Your First Interactive Figure with Xradar and hvPlot

hvPlot is helpful tool when working with interactive visualizions! It is a tool built on top of several other packages, that we can use with Xarray.

By default, this visualization plots azimuth along the y-axis and range along the y-axis. While this is desired in certain cases, we cannot gather much spatial information from this.

ref = radar["sweep_0"].DBZH.hvplot.quadmesh(cmap='pyart_ChaseSpectral',
                                            title='Horizontal Reflectivity (dBZ)',
                                            clim=(-20,60))
ref