xarray GAMIC backend#

In this example, we read GAMIC (HDF5) data files using the xradar gamic backend.

import glob
import wradlib as wrl
import wradlib_data
import warnings
from IPython.display import display

import matplotlib.pyplot as plt
import numpy as np
import xradar as xd
import xarray as xr

warnings.filterwarnings("ignore")

Load GAMIC HDF5 Volume Data#

fpath = "hdf5/DWD-Vol-2_99999_20180601054047_00.h5"
f = wradlib_data.DATASETS.fetch(fpath)
vol = xd.io.open_gamic_datatree(f)
Downloading file 'hdf5/DWD-Vol-2_99999_20180601054047_00.h5' from 'https://github.com/wradlib/wradlib-data/raw/main/data/hdf5/DWD-Vol-2_99999_20180601054047_00.h5' to '/home/docs/.cache/wradlib-data'.

Inspect RadarVolume#

display(vol)
<xarray.DataTree>
Group: /
β”‚   Dimensions:              (sweep: 10)
β”‚   Coordinates:
β”‚       latitude             float64 8B ...
β”‚       longitude            float64 8B ...
β”‚       altitude             float64 8B ...
β”‚   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 '2018-06-01T05:40:47Z'
β”‚       time_coverage_end    <U20 80B '2018-06-01T05:44:16Z'
β”‚       sweep_fixed_angle    (sweep) float64 80B 28.0 18.0 14.0 11.0 ... 3.1 1.7 0.6
β”‚       sweep_group_name     (sweep) int64 80B 0 1 2 3 4 5 6 7 8 9
β”‚   Attributes:
β”‚       Conventions:      None
β”‚       instrument_name:  None
β”‚       version:          None
β”‚       title:            None
β”‚       institution:      None
β”‚       references:       None
β”‚       source:           gamic
β”‚       history:          None
β”‚       comment:          im/exported using xradar
β”œβ”€β”€ Group: /sweep_0
β”‚       Dimensions:            (azimuth: 361, range: 360)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5219 1.519 2.53 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:40:57.36300...
β”‚         * range              (range) float32 1kB 50.0 150.0 ... 3.585e+04 3.595e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 520kB ...
β”‚           DBZV               (azimuth, range) float32 520kB ...
β”‚           KDP                (azimuth, range) float32 520kB ...
β”‚           RHOHV              (azimuth, range) float32 520kB ...
β”‚           DBTH               (azimuth, range) float32 520kB ...
β”‚           DBTV               (azimuth, range) float32 520kB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 500)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5246 1.533 2.543 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:10.99700...
β”‚         * range              (range) float32 2kB 50.0 150.0 ... 4.985e+04 4.995e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 722kB ...
β”‚           DBZV               (azimuth, range) float32 722kB ...
β”‚           KDP                (azimuth, range) float32 722kB ...
β”‚           RHOHV              (azimuth, range) float32 722kB ...
β”‚           DBTH               (azimuth, range) float32 722kB ...
β”‚           DBTV               (azimuth, range) float32 722kB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 620)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5191 1.524 2.527 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:24.84300...
β”‚         * range              (range) float32 2kB 50.0 150.0 ... 6.185e+04 6.195e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 895kB ...
β”‚           DBZV               (azimuth, range) float32 895kB ...
β”‚           KDP                (azimuth, range) float32 895kB ...
β”‚           RHOHV              (azimuth, range) float32 895kB ...
β”‚           DBTH               (azimuth, range) float32 895kB ...
β”‚           DBTV               (azimuth, range) float32 895kB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 800)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5164 1.522 2.513 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:39.36900...
β”‚         * range              (range) float32 3kB 50.0 150.0 ... 7.985e+04 7.995e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 1050)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5219 1.522 2.513 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:54.36900...
β”‚         * range              (range) float32 4kB 50.0 150.0 ... 1.048e+05 1.05e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 2MB ...
β”‚           DBZV               (azimuth, range) float32 2MB ...
β”‚           KDP                (azimuth, range) float32 2MB ...
β”‚           RHOHV              (azimuth, range) float32 2MB ...
β”‚           DBTH               (azimuth, range) float32 2MB ...
β”‚           DBTV               (azimuth, range) float32 2MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1400)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5273 1.522 2.53 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:42:09.37000...
β”‚         * range              (range) float32 6kB 50.0 150.0 ... 1.398e+05 1.4e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 2MB ...
β”‚           DBZV               (azimuth, range) float32 2MB ...
β”‚           KDP                (azimuth, range) float32 2MB ...
β”‚           RHOHV              (azimuth, range) float32 2MB ...
β”‚           DBTH               (azimuth, range) float32 2MB ...
β”‚           DBTV               (azimuth, range) float32 2MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1000)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5219 1.522 2.516 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:42:27.84100...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 1000)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5246 1.538 2.521 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:42:51.84200...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1000)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5191 1.516 2.516 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:43:17.69900...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1000)
        Coordinates:
          * azimuth            (azimuth) float64 3kB 0.5109 1.519 2.519 ... 358.5 359.5
            elevation          (azimuth) float64 3kB ...
            time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:43:49.40400...
          * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
        Data variables: (12/18)
            DBZH               (azimuth, range) float32 1MB ...
            DBZV               (azimuth, range) float32 1MB ...
            KDP                (azimuth, range) float32 1MB ...
            RHOHV              (azimuth, range) float32 1MB ...
            DBTH               (azimuth, range) float32 1MB ...
            DBTV               (azimuth, range) float32 1MB ...
            ...                 ...
            sweep_mode         <U20 80B ...
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float64 8B ...
            nyquist_velocity   float64 8B ...

Inspect root group#

The sweep dimension contains the number of scans in this radar volume. Further the dataset consists of variables (location coordinates, time_coverage) and attributes (Conventions, metadata).

vol.root
<xarray.DataTree>
Group: /
β”‚   Dimensions:              (sweep: 10)
β”‚   Coordinates:
β”‚       latitude             float64 8B ...
β”‚       longitude            float64 8B ...
β”‚       altitude             float64 8B ...
β”‚   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 '2018-06-01T05:40:47Z'
β”‚       time_coverage_end    <U20 80B '2018-06-01T05:44:16Z'
β”‚       sweep_fixed_angle    (sweep) float64 80B 28.0 18.0 14.0 11.0 ... 3.1 1.7 0.6
β”‚       sweep_group_name     (sweep) int64 80B 0 1 2 3 4 5 6 7 8 9
β”‚   Attributes:
β”‚       Conventions:      None
β”‚       instrument_name:  None
β”‚       version:          None
β”‚       title:            None
β”‚       institution:      None
β”‚       references:       None
β”‚       source:           gamic
β”‚       history:          None
β”‚       comment:          im/exported using xradar
β”œβ”€β”€ Group: /sweep_0
β”‚       Dimensions:            (azimuth: 361, range: 360)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5219 1.519 2.53 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:40:57.36300...
β”‚         * range              (range) float32 1kB 50.0 150.0 ... 3.585e+04 3.595e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 520kB ...
β”‚           DBZV               (azimuth, range) float32 520kB ...
β”‚           KDP                (azimuth, range) float32 520kB ...
β”‚           RHOHV              (azimuth, range) float32 520kB ...
β”‚           DBTH               (azimuth, range) float32 520kB ...
β”‚           DBTV               (azimuth, range) float32 520kB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 500)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5246 1.533 2.543 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:10.99700...
β”‚         * range              (range) float32 2kB 50.0 150.0 ... 4.985e+04 4.995e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 722kB ...
β”‚           DBZV               (azimuth, range) float32 722kB ...
β”‚           KDP                (azimuth, range) float32 722kB ...
β”‚           RHOHV              (azimuth, range) float32 722kB ...
β”‚           DBTH               (azimuth, range) float32 722kB ...
β”‚           DBTV               (azimuth, range) float32 722kB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 620)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5191 1.524 2.527 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:24.84300...
β”‚         * range              (range) float32 2kB 50.0 150.0 ... 6.185e+04 6.195e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 895kB ...
β”‚           DBZV               (azimuth, range) float32 895kB ...
β”‚           KDP                (azimuth, range) float32 895kB ...
β”‚           RHOHV              (azimuth, range) float32 895kB ...
β”‚           DBTH               (azimuth, range) float32 895kB ...
β”‚           DBTV               (azimuth, range) float32 895kB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 800)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5164 1.522 2.513 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:39.36900...
β”‚         * range              (range) float32 3kB 50.0 150.0 ... 7.985e+04 7.995e+04
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 1050)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5219 1.522 2.513 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:41:54.36900...
β”‚         * range              (range) float32 4kB 50.0 150.0 ... 1.048e+05 1.05e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 2MB ...
β”‚           DBZV               (azimuth, range) float32 2MB ...
β”‚           KDP                (azimuth, range) float32 2MB ...
β”‚           RHOHV              (azimuth, range) float32 2MB ...
β”‚           DBTH               (azimuth, range) float32 2MB ...
β”‚           DBTV               (azimuth, range) float32 2MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1400)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5273 1.522 2.53 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:42:09.37000...
β”‚         * range              (range) float32 6kB 50.0 150.0 ... 1.398e+05 1.4e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 2MB ...
β”‚           DBZV               (azimuth, range) float32 2MB ...
β”‚           KDP                (azimuth, range) float32 2MB ...
β”‚           RHOHV              (azimuth, range) float32 2MB ...
β”‚           DBTH               (azimuth, range) float32 2MB ...
β”‚           DBTV               (azimuth, range) float32 2MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1000)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5219 1.522 2.516 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:42:27.84100...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 361, range: 1000)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5246 1.538 2.521 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:42:51.84200...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1000)
β”‚       Coordinates:
β”‚         * azimuth            (azimuth) float64 3kB 0.5191 1.516 2.516 ... 358.5 359.5
β”‚           elevation          (azimuth) float64 3kB ...
β”‚           time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:43:17.69900...
β”‚         * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
β”‚       Data variables: (12/18)
β”‚           DBZH               (azimuth, range) float32 1MB ...
β”‚           DBZV               (azimuth, range) float32 1MB ...
β”‚           KDP                (azimuth, range) float32 1MB ...
β”‚           RHOHV              (azimuth, range) float32 1MB ...
β”‚           DBTH               (azimuth, range) float32 1MB ...
β”‚           DBTV               (azimuth, range) float32 1MB ...
β”‚           ...                 ...
β”‚           sweep_mode         <U20 80B ...
β”‚           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: 1000)
        Coordinates:
          * azimuth            (azimuth) float64 3kB 0.5109 1.519 2.519 ... 358.5 359.5
            elevation          (azimuth) float64 3kB ...
            time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:43:49.40400...
          * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
        Data variables: (12/18)
            DBZH               (azimuth, range) float32 1MB ...
            DBZV               (azimuth, range) float32 1MB ...
            KDP                (azimuth, range) float32 1MB ...
            RHOHV              (azimuth, range) float32 1MB ...
            DBTH               (azimuth, range) float32 1MB ...
            DBTV               (azimuth, range) float32 1MB ...
            ...                 ...
            sweep_mode         <U20 80B ...
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float64 8B ...
            nyquist_velocity   float64 8B ...

Inspect sweep group(s)#

The sweep-groups can be accessed via their respective keys. The dimensions consist of range and time with added coordinates azimuth, elevation, range and time. There will be variables like radar moments (DBZH etc.) and sweep-dependent metadata (like fixed_angle, sweep_mode etc.).

display(vol["sweep_0"])
<xarray.DataTree 'sweep_0'>
Group: /sweep_0
    Dimensions:            (sweep: 10, azimuth: 361, range: 360)
    Coordinates:
      * azimuth            (azimuth) float64 3kB 0.5219 1.519 2.53 ... 358.5 359.5
        elevation          (azimuth) float64 3kB ...
        time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:40:57.36300...
      * range              (range) float32 1kB 50.0 150.0 ... 3.585e+04 3.595e+04
    Dimensions without coordinates: sweep
    Data variables: (12/18)
        DBZH               (azimuth, range) float32 520kB ...
        DBZV               (azimuth, range) float32 520kB ...
        KDP                (azimuth, range) float32 520kB ...
        RHOHV              (azimuth, range) float32 520kB ...
        DBTH               (azimuth, range) float32 520kB ...
        DBTV               (azimuth, range) float32 520kB ...
        ...                 ...
        sweep_mode         <U20 80B ...
        sweep_number       int64 8B ...
        prt_mode           <U7 28B ...
        follow_mode        <U7 28B ...
        sweep_fixed_angle  float64 8B ...
        nyquist_velocity   float64 8B ...

Georeferencing#

swp = vol["sweep_0"].to_dataset(inherit="all_coords")
swp = swp.assign_coords(sweep_mode=swp.sweep_mode)
swp = swp.wrl.georef.georeference()
display(swp)
<xarray.Dataset> Size: 12MB
Dimensions:            (azimuth: 361, range: 360)
Coordinates: (12/15)
  * azimuth            (azimuth) float64 3kB 0.5219 1.519 2.53 ... 358.5 359.5
    elevation          (azimuth) float64 3kB 28.0 28.0 28.0 ... 28.0 28.0 28.0
    time               (azimuth) datetime64[ns] 3kB 2018-06-01T05:40:57.36300...
  * range              (range) float32 1kB 50.0 150.0 ... 3.585e+04 3.595e+04
    x                  (azimuth, range) float64 1MB 0.4021 1.206 ... -267.3
    y                  (azimuth, range) float64 1MB 44.14 132.4 ... 3.168e+04
    ...                 ...
    bins               (azimuth, range) float32 520kB 50.0 150.0 ... 3.595e+04
    sweep_mode         <U20 80B 'azimuth_surveillance'
    latitude           float64 8B 50.93
    longitude          float64 8B 6.457
    altitude           float64 8B 310.0
    crs_wkt            int64 8B 0
Data variables: (12/17)
    DBZH               (azimuth, range) float32 520kB ...
    DBZV               (azimuth, range) float32 520kB ...
    KDP                (azimuth, range) float32 520kB ...
    RHOHV              (azimuth, range) float32 520kB ...
    DBTH               (azimuth, range) float32 520kB ...
    DBTV               (azimuth, range) float32 520kB ...
    ...                 ...
    PHIDP              (azimuth, range) float32 520kB ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float64 8B ...
    nyquist_velocity   float64 8B ...

Inspect radar moments#

The DataArrays can be accessed by key or by attribute. Each DataArray has dimensions and coordinates of its parent dataset. There are attributes connected which are defined by ODIM_H5 standard.

display(swp.DBZH)
<xarray.DataArray 'DBZH' (azimuth: 361, range: 360)> Size: 520kB
[129960 values with dtype=float32]
Coordinates: (12/15)
  * azimuth     (azimuth) float64 3kB 0.5219 1.519 2.53 ... 357.5 358.5 359.5
    elevation   (azimuth) float64 3kB 28.0 28.0 28.0 28.0 ... 28.0 28.0 28.0
    time        (azimuth) datetime64[ns] 3kB 2018-06-01T05:40:57.363000 ... 2...
  * range       (range) float32 1kB 50.0 150.0 250.0 ... 3.585e+04 3.595e+04
    x           (azimuth, range) float64 1MB 0.4021 1.206 2.01 ... -266.5 -267.3
    y           (azimuth, range) float64 1MB 44.14 132.4 ... 3.159e+04 3.168e+04
    ...          ...
    bins        (azimuth, range) float32 520kB 50.0 150.0 ... 3.595e+04
    sweep_mode  <U20 80B 'azimuth_surveillance'
    latitude    float64 8B 50.93
    longitude   float64 8B 6.457
    altitude    float64 8B 310.0
    crs_wkt     int64 8B 0
Attributes:
    format:         UV8
    is_dft:         0
    unit:           dBZ
    standard_name:  radar_equivalent_reflectivity_factor_h
    units:          dBZ
    long_name:      Equivalent reflectivity factor H
    _Undetect:      0.0

Create simple plot#

Using xarray features a simple plot can be created like this. Note the sortby('time') method, which sorts the radials by time.

For more details on plotting radar data see under Visualization.

swp.DBZH.sortby("time").plot(x="range", y="time", add_labels=False)
<matplotlib.collections.QuadMesh at 0x7638d1ec67b0>
../../../_images/f784367a46264dcf3f15f09c5ec90528a0f76304e538ddfced9fc11af01c74e8.png
fig = plt.figure(figsize=(10, 10))
pm = swp.DBZH.wrl.vis.plot(crs={"latmin": 3e3}, fig=fig)
../../../_images/59985cb1e0b6c634615fe2b1d8b2807744861a99f7b38a3cc306d11625a223cb.png

Retrieve explicit group#

swp_b = xr.open_dataset(
    f, engine="gamic", group="sweep_9", backend_kwargs=dict(reindex_angle=False)
)
display(swp_b)
<xarray.Dataset> Size: 17MB
Dimensions:            (azimuth: 360, range: 1000)
Coordinates:
  * azimuth            (azimuth) float64 3kB 0.5109 1.519 2.519 ... 358.5 359.5
    elevation          (azimuth) float64 3kB ...
    time               (azimuth) datetime64[ns] 3kB ...
  * range              (range) float32 4kB 75.0 225.0 ... 1.498e+05 1.499e+05
    longitude          float64 8B ...
    latitude           float64 8B ...
    altitude           float64 8B ...
Data variables: (12/18)
    DBZH               (azimuth, range) float32 1MB ...
    DBZV               (azimuth, range) float32 1MB ...
    KDP                (azimuth, range) float32 1MB ...
    RHOHV              (azimuth, range) float32 1MB ...
    DBTH               (azimuth, range) float32 1MB ...
    DBTV               (azimuth, range) float32 1MB ...
    ...                 ...
    sweep_mode         <U20 80B ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float64 8B ...
    nyquist_velocity   float64 8B ...
Attributes:
    source:         gamic
    ant_gain_h:     43
    ant_gain_v:     43
    noise_power_h:  -3.40133
    noise_power_v:  -3.13518
    rx_loss_h:      3
    rx_loss_v:      3