Radar - Volume#

Import Section#

import datetime as dt
import os

import matplotlib.pyplot as plt
import wradlib as wrl

Utility Functions#

import radarpolarimetry as rp

Load Radar Data Sweep#

Select time#

For a single volume a certain 5 minute interval is selected.

# recent boxpol event
start_time = dt.datetime(2018, 4, 10, 16, 15)
stop_time = dt.datetime(2018, 4, 10, 16, 20)

get file path#

# choose radar specific parameters
scan = "*ppi*"

path = rp.get_xpol_path(start_time=start_time)
file_path = os.path.join(path, scan)

print(file_path)
/radar/rp-data/scans/2018/2018-04/2018-04-10/*ppi*

get file list#

flist = list(rp.create_filelist(os.path.join(file_path, "*"), start_time, stop_time))
display(flist)
['/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_010deg/n_ppi_010deg_12345_20180410161835_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_020deg/n_ppi_020deg_12345_20180410161800_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_031deg/n_ppi_031deg_12345_20180410161734_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_045deg/n_ppi_045deg_12345_20180410161709_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_060deg/n_ppi_060deg_12345_20180410161652_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_082deg/n_ppi_082deg_12345_20180410161636_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_110deg/n_ppi_110deg_12345_20180410161619_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_140deg/n_ppi_140deg_12345_20180410161604_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_180deg/n_ppi_180deg_12345_20180410161549_00.h5',
 '/radar/rp-data/scans/2018/2018-04/2018-04-10/n_ppi_280deg/n_ppi_280deg_12345_20180410161533_00.h5']

load data#

As already learned in radar_timeseries_sweep.md we apply reindex to the data, as we finally want to merge all sweeps into one Dataset.

reindex_angle = dict(start_angle=0, stop_angle=360, angle_res=1.0, direction=1)
vol = rp.load_volume(flist, reindex_angle=reindex_angle)

Exercise 1: Explore the Datatree#

How is the data aligned in the Datatree? Where are the different sweeps? Which information is provided?

display(vol)
<xarray.DataTree 'root'>
Group: /
β”‚   Dimensions:              ()
β”‚   Data variables:
β”‚       volume_number        int64 8B 0
β”‚       platform_type        <U5 20B 'fixed'
β”‚       instrument_type      <U5 20B 'radar'
β”‚       time_coverage_start  <U20 80B '2018-04-10T16:15:33Z'
β”‚       time_coverage_end    <U20 80B '2018-04-10T16:19:11Z'
β”‚       longitude            float64 8B 7.072
β”‚       altitude             float64 8B 99.5
β”‚       latitude             float64 8B 50.73
β”‚   Attributes: (12/15)
β”‚       Conventions:      None
β”‚       instrument_name:  None
β”‚       version:          None
β”‚       title:            None
β”‚       institution:      None
β”‚       references:       None
β”‚       ...               ...
β”‚       ant_gain_h:       44.0
β”‚       ant_gain_v:       44.0
β”‚       noise_power_h:    -1.39495
β”‚       noise_power_v:    -1.09706
β”‚       rx_loss_h:        0.73
β”‚       rx_loss_v:        0.73
β”œβ”€β”€ Group: /sweep_0
β”‚       Dimensions:            (azimuth: 360, range: 750)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:18:45.37700...
β”‚         * range              (range) float32 3kB 100.0 300.0 ... 1.497e+05 1.499e+05
β”‚           x                  (azimuth, range) float64 2MB 0.8725 2.618 ... -1.307e+03
β”‚           y                  (azimuth, range) float64 2MB 99.98 299.9 ... 1.498e+05
β”‚           z                  (azimuth, range) float64 2MB 101.2 104.7 ... 4.038e+03
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 0.9998
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           CMAP               (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 1MB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_1
β”‚       Dimensions:            (azimuth: 360, range: 750)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:18:12.79500...
β”‚         * range              (range) float32 3kB 100.0 300.0 ... 1.497e+05 1.499e+05
β”‚           x                  (azimuth, range) float64 2MB 0.8721 2.616 ... -1.306e+03
β”‚           y                  (azimuth, range) float64 2MB 99.93 299.8 ... 1.497e+05
β”‚           z                  (azimuth, range) float64 2MB 103.0 110.0 ... 6.651e+03
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 2.0
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           CMAP               (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 1MB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_2
β”‚       Dimensions:            (azimuth: 360, range: 750)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:17:45.98600...
β”‚         * range              (range) float32 3kB 100.0 300.0 ... 1.497e+05 1.499e+05
β”‚           x                  (azimuth, range) float64 2MB 0.8714 2.614 ... -1.305e+03
β”‚           y                  (azimuth, range) float64 2MB 99.85 299.5 ... 1.495e+05
β”‚           z                  (azimuth, range) float64 2MB 104.9 115.7 ... 9.52e+03
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 3.098
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           CMAP               (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 1MB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_3
β”‚       Dimensions:            (azimuth: 360, range: 750)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:17:21.86500...
β”‚         * range              (range) float32 3kB 100.0 300.0 ... 1.497e+05 1.499e+05
β”‚           x                  (azimuth, range) float64 2MB 0.8699 2.61 ... -1.302e+03
β”‚           y                  (azimuth, range) float64 2MB 99.69 299.1 ... 1.492e+05
β”‚           z                  (azimuth, range) float64 2MB 107.4 123.1 ... 1.319e+04
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 4.504
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           CMAP               (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 1MB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_4
β”‚       Dimensions:            (azimuth: 360, range: 933)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:17:01.81700...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.397e+05 1.399e+05
β”‚           x                  (azimuth, range) float64 3MB 0.6509 1.953 ... -1.212e+03
β”‚           y                  (azimuth, range) float64 3MB 74.59 223.8 ... 1.389e+05
β”‚           z                  (azimuth, range) float64 3MB 107.3 123.0 ... 1.585e+04
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 5.999
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           CMAP               (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 1MB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_5
β”‚       Dimensions:            (azimuth: 360, range: 800)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:16:46.74100...
β”‚         * range              (range) float32 3kB 62.5 187.5 ... 9.981e+04 9.994e+04
β”‚           x                  (azimuth, range) float64 2MB 0.5398 1.619 ... -861.7
β”‚           y                  (azimuth, range) float64 2MB 61.86 185.6 ... 9.874e+04
β”‚           z                  (azimuth, range) float64 2MB 108.4 126.3 ... 1.494e+04
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 8.207
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           CMAP               (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 1MB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_6
β”‚       Dimensions:            (azimuth: 360, range: 640)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:16:31.66400...
β”‚         * range              (range) float32 3kB 62.5 187.5 ... 7.981e+04 7.994e+04
β”‚           x                  (azimuth, range) float64 2MB 0.5354 1.606 ... -683.5
β”‚           y                  (azimuth, range) float64 2MB 61.35 184.0 ... 7.832e+04
β”‚           z                  (azimuth, range) float64 2MB 111.4 135.3 ... 1.571e+04
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 11.0
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 922kB ...
β”‚           DBZV               (azimuth, range) float32 922kB ...
β”‚           KDP                (azimuth, range) float32 922kB ...
β”‚           RHOHV              (azimuth, range) float32 922kB ...
β”‚           CMAP               (azimuth, range) float32 922kB ...
β”‚           DBTH               (azimuth, range) float32 922kB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 922kB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_7
β”‚       Dimensions:            (azimuth: 360, range: 496)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:16:16.75900...
β”‚         * range              (range) float32 2kB 62.5 187.5 ... 6.181e+04 6.194e+04
β”‚           x                  (azimuth, range) float64 1MB 0.5292 1.588 ... -523.5
β”‚           y                  (azimuth, range) float64 1MB 60.64 181.9 ... 5.999e+04
β”‚           z                  (azimuth, range) float64 1MB 114.6 144.9 ... 1.53e+04
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 14.01
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 714kB ...
β”‚           DBZV               (azimuth, range) float32 714kB ...
β”‚           KDP                (azimuth, range) float32 714kB ...
β”‚           RHOHV              (azimuth, range) float32 714kB ...
β”‚           CMAP               (azimuth, range) float32 714kB ...
β”‚           DBTH               (azimuth, range) float32 714kB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 714kB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
β”œβ”€β”€ Group: /sweep_8
β”‚       Dimensions:            (azimuth: 360, range: 400)
β”‚       Coordinates: (12/15)
β”‚         * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:16:02.84300...
β”‚         * range              (range) float32 2kB 62.5 187.5 ... 4.981e+04 4.994e+04
β”‚           x                  (azimuth, range) float64 1MB 0.5187 1.556 ... -413.7
β”‚           y                  (azimuth, range) float64 1MB 59.44 178.3 ... 4.74e+04
β”‚           z                  (azimuth, range) float64 1MB 118.8 157.5 ... 1.567e+04
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B 'azimuth_surveillance'
β”‚           elevation          float64 8B 18.01
β”‚           longitude          float64 8B 7.072
β”‚           latitude           float64 8B 50.73
β”‚           altitude           float64 8B 99.5
β”‚           crs_wkt            int64 8B 0
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 576kB ...
β”‚           DBZV               (azimuth, range) float32 576kB ...
β”‚           KDP                (azimuth, range) float32 576kB ...
β”‚           RHOHV              (azimuth, range) float32 576kB ...
β”‚           CMAP               (azimuth, range) float32 576kB ...
β”‚           DBTH               (azimuth, range) float32 576kB ...
β”‚           ...                 ...
β”‚           PHIDP              (azimuth, range) float32 576kB ...
β”‚           sweep_number       int64 8B ...
β”‚           prt_mode           <U7 28B ...
β”‚           follow_mode        <U7 28B ...
β”‚           sweep_fixed_angle  float64 8B ...
β”‚           nyquist_velocity   float64 8B ...
└── Group: /sweep_9
        Dimensions:            (azimuth: 360, range: 288)
        Coordinates: (12/15)
          * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
            time               (azimuth) datetime64[ns] 3kB 2018-04-10T16:15:35.85800...
          * range              (range) float32 1kB 62.5 187.5 ... 3.581e+04 3.594e+04
            x                  (azimuth, range) float64 829kB 0.4815 1.445 ... -276.3
            y                  (azimuth, range) float64 829kB 55.18 165.5 ... 3.167e+04
            z                  (azimuth, range) float64 829kB 128.8 187.5 ... 1.703e+04
            ...                 ...
            sweep_mode         <U20 80B 'azimuth_surveillance'
            elevation          float64 8B 28.0
            longitude          float64 8B 7.072
            latitude           float64 8B 50.73
            altitude           float64 8B 99.5
            crs_wkt            int64 8B 0
        Data variables: (12/18)
            DBZH               (azimuth, range) float32 415kB ...
            DBZV               (azimuth, range) float32 415kB ...
            KDP                (azimuth, range) float32 415kB ...
            RHOHV              (azimuth, range) float32 415kB ...
            CMAP               (azimuth, range) float32 415kB ...
            DBTH               (azimuth, range) float32 415kB ...
            ...                 ...
            PHIDP              (azimuth, range) float32 415kB ...
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float64 8B ...
            nyquist_velocity   float64 8B ...

Select single sweep and plot Reflectivity#

rp.plot_moment(vol["sweep_0"].DBZH, vmin=0)
<matplotlib.collections.QuadMesh at 0x7fdc9d7857f0>
../../_images/a2ef10ebaea39ae5bbf26a26c3fe4348f88ef48c0fd47f40a571c4bf0a25d711.png

Compress Datatree into Dataset#

For this to work we need to reindex along the range. First we calculate the minimal range resolution.

rres = min([vol[ds].range.attrs["meters_between_gates"] for ds in vol.children])

In the second step we iterate over the sweeps and reindex over range with nearest neighbor scheme. This brings all sweeps to a common range grid.

Warning: The nearest neighbour range reindexing does not work well for phase based measurements (PHIDP, KDP) as wrong values could be interpolated. Be careful when trying to interpret images.

Finally all sweeps are concatenated along a new dimension sweep_fixed_angle.

el = vol.pipe(rp.concat_sweep_angle, rres)
display(el)
<xarray.Dataset> Size: 415MB
Dimensions:            (sweep_fixed_angle: 10, azimuth: 360, range: 1200)
Coordinates: (12/16)
  * sweep_fixed_angle  (sweep_fixed_angle) float64 80B 1.0 2.0 3.1 ... 18.0 28.0
    elevation          (sweep_fixed_angle) float64 80B 0.9998 2.0 ... 18.01 28.0
  * azimuth            (azimuth) float64 3kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
    time               (sweep_fixed_angle, azimuth) datetime64[ns] 29kB 2018-...
  * range              (range) float64 10kB 62.5 187.5 ... 1.498e+05 1.499e+05
    x                  (sweep_fixed_angle, azimuth, range) float64 35MB 0.872...
    ...                 ...
    bins               (sweep_fixed_angle, azimuth, range) float32 17MB 100.0...
    sweep_mode         <U20 80B 'azimuth_surveillance'
    longitude          float64 8B 7.072
    latitude           float64 8B 50.73
    altitude           float64 8B 99.5
    crs_wkt            int64 8B 0
Data variables: (12/17)
    DBZH               (sweep_fixed_angle, azimuth, range) float32 17MB nan ....
    DBZV               (sweep_fixed_angle, azimuth, range) float32 17MB nan ....
    KDP                (sweep_fixed_angle, azimuth, range) float32 17MB 15.0 ...
    RHOHV              (sweep_fixed_angle, azimuth, range) float32 17MB 0.582...
    CMAP               (sweep_fixed_angle, azimuth, range) float32 17MB 12.0 ...
    DBTH               (sweep_fixed_angle, azimuth, range) float32 17MB 40.28...
    ...                 ...
    WRADV              (sweep_fixed_angle, azimuth, range) float32 17MB nan ....
    PHIDP              (sweep_fixed_angle, azimuth, range) float32 17MB -88.1...
    sweep_number       (sweep_fixed_angle) int64 80B 0 0 0 0 0 0 0 0 0 0
    prt_mode           (sweep_fixed_angle) <U7 280B 'not_set' ... 'not_set'
    follow_mode        (sweep_fixed_angle) <U7 280B 'not_set' ... 'not_set'
    nyquist_velocity   (sweep_fixed_angle) float64 80B 5.623 6.426 ... 9.237

Extract a single azimuth#

We can extract a certain azimuth angle by using the cross_section_ppi utility-function.

azimuth = 60
rec_rhi = wrl.util.cross_section_ppi(el, azimuth, method="nearest")
rec_rhi.DBZH.plot(
    x="gr", y="z", ylim=(0, 14000), xlim=(0, 140000), vmin=0, cmap="HomeyerRainbow"
)
<matplotlib.collections.QuadMesh at 0x7fdc98a12350>
../../_images/702b411a3bb31e16421f5006d1c9cd8ac13a7a1e283eb5787754ca3bc6c5188a.png

Select two points and create cross section#

p1 = (38000, 0)
p2 = (23000, 40000)

# Plot the chosen line over a PPI
vol["sweep_0"].DBZH.wrl.vis.plot(vmin=0)
plt.plot([p1[0], p2[0]], [p1[1], p2[1]], c="black")
[<matplotlib.lines.Line2D at 0x7fdc9890aad0>]
../../_images/ad901e5ef37dc691349acb07be005e26d971ac30838be9939b8af9daf629b8f3.png
# Extract cross section and plot result
rec_rhi = wrl.util.cross_section_ppi(el, (p1, p2))

# We have to use the new coordinate "xy" (meters along the line from p1 to p2) for plotting

rec_rhi.DBZH.plot(cmap="HomeyerRainbow", x="xy", y="z", ylim=(0, 10000), vmin=0)
<matplotlib.collections.QuadMesh at 0x7fdc986334d0>
../../_images/b7989a8e05dfc23636910b1c62d12370ed8f62cecf0c7f4bd7a2cc68d8ad7a99.png

Exercise 2: Select arbitrary cross section#

Select another (interesting) cut through this volume and plot the resulting cross section.

Solution 2: Select arbitrary cross section#

p1 = (70000, 0)
p2 = (23000, 40000)

# Plot the chosen line over a PPI
vol["sweep_0"].DBZH.wrl.vis.plot(vmin=0)
plt.plot([p1[0], p2[0]], [p1[1], p2[1]], c="black")
[<matplotlib.lines.Line2D at 0x7fdc9868ae90>]
../../_images/a563b2f5ba40297504d13db8a917a327100176a8b97894cf1a8f2c812f1fa412.png
# Extract cross section and plot result
rec_rhi = wrl.util.cross_section_ppi(el, (p1, p2))

# We have to use the new coordinate "xy" (meters along the line from p1 to p2) for plotting
rec_rhi.DBZH.plot(cmap="HomeyerRainbow", x="xy", y="z", ylim=(0, 10000), vmin=0)
<matplotlib.collections.QuadMesh at 0x7fdcb3373610>
../../_images/5b6edb830e058301dfaad6845cc61ad3a93a4dd59443715b752f7842191a7b27.png