xarray ODIM backend#

In this example, we read ODIM_H5 (HDF5) data files using the xradar odim backend. Throughout the notebook xarray accessors are used to access wradlib functionality.

import glob
import os
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 ODIM_H5 Volume Data#

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

Inspect RadarVolume#

display(vol)
<xarray.DataTree>
Group: /
│   Dimensions:              (sweep: 14)
│   Coordinates:
│       latitude             float32 4B ...
│       longitude            float32 4B ...
│       altitude             float32 4B ...
│   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 '2011-06-10T11:40:02Z'
│       time_coverage_end    <U20 80B '2011-06-10T11:43:54Z'
│       sweep_fixed_angle    (sweep) float32 56B 0.3 0.4 0.8 1.1 ... 15.0 20.0 25.0
│       sweep_group_name     (sweep) int64 112B 0 1 2 3 4 5 6 7 8 9 10 11 12 13
│   Attributes:
│       Conventions:      ODIM_H5/V2_2
│       instrument_name:  None
│       version:          None
│       title:            None
│       institution:      None
│       references:       None
│       source:           None
│       history:          None
│       comment:          im/exported using xradar
├── Group: /sweep_0
│       Dimensions:            (azimuth: 360, range: 320)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:17.36111...
│         * range              (range) float32 1kB 500.0 1.5e+03 ... 3.185e+05 3.195e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 461kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_1
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:36.80555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_2
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:56.30555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_3
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:41:15.80555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_4
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:41:36.30555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_5
│       Dimensions:            (azimuth: 360, range: 340)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:42:10.47919...
│         * range              (range) float32 1kB 250.0 750.0 ... 1.692e+05 1.698e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 490kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
...
├── Group: /sweep_8
│       Dimensions:            (azimuth: 360, range: 300)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:42:49.01665...
│         * range              (range) float32 1kB 250.0 750.0 ... 1.492e+05 1.498e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 432kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_9
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:42:59.79165...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_10
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:09.54166...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_11
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:29.87496...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_12
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:39.23608...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
└── Group: /sweep_13
        Dimensions:            (azimuth: 360, range: 240)
        Coordinates:
          * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
            elevation          (azimuth) float32 1kB ...
            time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:48.76387...
          * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
        Data variables:
            DBZH               (azimuth, range) float32 346kB ...
            sweep_mode         <U20 80B ...
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float32 4B ...
            nyquist_velocity   object 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: 14)
│   Coordinates:
│       latitude             float32 4B ...
│       longitude            float32 4B ...
│       altitude             float32 4B ...
│   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 '2011-06-10T11:40:02Z'
│       time_coverage_end    <U20 80B '2011-06-10T11:43:54Z'
│       sweep_fixed_angle    (sweep) float32 56B 0.3 0.4 0.8 1.1 ... 15.0 20.0 25.0
│       sweep_group_name     (sweep) int64 112B 0 1 2 3 4 5 6 7 8 9 10 11 12 13
│   Attributes:
│       Conventions:      ODIM_H5/V2_2
│       instrument_name:  None
│       version:          None
│       title:            None
│       institution:      None
│       references:       None
│       source:           None
│       history:          None
│       comment:          im/exported using xradar
├── Group: /sweep_0
│       Dimensions:            (azimuth: 360, range: 320)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:17.36111...
│         * range              (range) float32 1kB 500.0 1.5e+03 ... 3.185e+05 3.195e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 461kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_1
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:36.80555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_2
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:56.30555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_3
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:41:15.80555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_4
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:41:36.30555...
│         * range              (range) float32 960B 500.0 1.5e+03 ... 2.395e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_5
│       Dimensions:            (azimuth: 360, range: 340)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:42:10.47919...
│         * range              (range) float32 1kB 250.0 750.0 ... 1.692e+05 1.698e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 490kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
...
├── Group: /sweep_8
│       Dimensions:            (azimuth: 360, range: 300)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:42:49.01665...
│         * range              (range) float32 1kB 250.0 750.0 ... 1.492e+05 1.498e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 432kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_9
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:42:59.79165...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_10
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:09.54166...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_11
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:29.87496...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
├── Group: /sweep_12
│       Dimensions:            (azimuth: 360, range: 240)
│       Coordinates:
│         * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
│           elevation          (azimuth) float32 1kB ...
│           time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:39.23608...
│         * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
│       Data variables:
│           DBZH               (azimuth, range) float32 346kB ...
│           sweep_mode         <U20 80B ...
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float32 4B ...
│           nyquist_velocity   object 8B ...
└── Group: /sweep_13
        Dimensions:            (azimuth: 360, range: 240)
        Coordinates:
          * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
            elevation          (azimuth) float32 1kB ...
            time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:43:48.76387...
          * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
        Data variables:
            DBZH               (azimuth, range) float32 346kB ...
            sweep_mode         <U20 80B ...
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float32 4B ...
            nyquist_velocity   object 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: 14, azimuth: 360, range: 320)
    Coordinates:
      * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
        elevation          (azimuth) float32 1kB ...
        time               (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:17.36111...
      * range              (range) float32 1kB 500.0 1.5e+03 ... 3.185e+05 3.195e+05
    Dimensions without coordinates: sweep
    Data variables:
        DBZH               (azimuth, range) float32 461kB ...
        sweep_mode         <U20 80B ...
        sweep_number       int64 8B ...
        prt_mode           <U7 28B ...
        follow_mode        <U7 28B ...
        sweep_fixed_angle  float32 4B ...
        nyquist_velocity   object 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()

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: 360, range: 320)> Size: 461kB
[115200 values with dtype=float32]
Coordinates: (12/15)
  * azimuth     (azimuth) float32 1kB 0.5 1.5 2.5 3.5 ... 357.5 358.5 359.5
    elevation   (azimuth) float32 1kB 0.3 0.3 0.3 0.3 0.3 ... 0.3 0.3 0.3 0.3
    time        (azimuth) datetime64[ns] 3kB 2011-06-10T11:40:17.361118208 .....
  * range       (range) float32 1kB 500.0 1.5e+03 ... 3.185e+05 3.195e+05
    x           (azimuth, range) float64 922kB 4.363 13.09 ... -2.786e+03
    y           (azimuth, range) float64 922kB 500.0 1.5e+03 ... 3.193e+05
    ...          ...
    bins        (azimuth, range) float32 461kB 500.0 1.5e+03 ... 3.195e+05
    sweep_mode  <U20 80B 'azimuth_surveillance'
    latitude    float32 4B 52.95
    longitude   float32 4B 4.79
    altitude    float32 4B 50.0
    crs_wkt     int64 8B 0
Attributes:
    _Undetect:      0.0
    units:          dBZ
    standard_name:  radar_equivalent_reflectivity_factor_h
    long_name:      Equivalent reflectivity factor H

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 0x733cf01267b0>
../../../_images/af72030a9a10ed0fc78b52501f4aa340c3211dabca586e3b5bc907a232657182.png
fig = plt.figure(figsize=(10, 10))
pm = swp.DBZH.wrl.vis.plot(crs={"latmin": 33e3}, fig=fig)
../../../_images/130dc1299a02a5c0593c1b07a8fbc3fc746459fef240716088ec2c7fe0b8539a.png

Retrieve explicit group#

swp_b = xr.open_dataset(
    f, engine="odim", group="sweep_13", backend_kwargs=dict(reindex_angle=False)
)
display(swp_b)
<xarray.Dataset> Size: 352kB
Dimensions:            (azimuth: 360, range: 240)
Coordinates:
  * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
    elevation          (azimuth) float32 1kB ...
    time               (azimuth) datetime64[ns] 3kB ...
  * range              (range) float32 960B 250.0 750.0 ... 1.192e+05 1.198e+05
    longitude          float32 4B ...
    latitude           float32 4B ...
    altitude           float32 4B ...
Data variables:
    DBZH               (azimuth, range) float32 346kB ...
    sweep_mode         <U20 80B ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float32 4B ...
    nyquist_velocity   object 8B ...
Attributes:
    Conventions:  ODIM_H5/V2_2

Use xr.open_mfdataset to retrieve timeseries of explicit group#

flist = ["hdf5/71_20181220_060628.pvol.h5", "hdf5/71_20181220_061228.pvol.h5"]
flist = [wradlib_data.DATASETS.fetch(f) for f in flist]
ts = xr.open_mfdataset(
    flist, engine="odim", concat_dim="volume_time", combine="nested", group="sweep_0"
)
display(ts)
Downloading file 'hdf5/71_20181220_060628.pvol.h5' from 'https://github.com/wradlib/wradlib-data/raw/main/data/hdf5/71_20181220_060628.pvol.h5' to '/home/docs/.cache/wradlib-data'.
Downloading file 'hdf5/71_20181220_061228.pvol.h5' from 'https://github.com/wradlib/wradlib-data/raw/main/data/hdf5/71_20181220_061228.pvol.h5' to '/home/docs/.cache/wradlib-data'.
<xarray.Dataset> Size: 80MB
Dimensions:            (volume_time: 2, azimuth: 360, range: 1200)
Coordinates:
  * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
    elevation          (azimuth) float64 3kB dask.array<chunksize=(360,), meta=np.ndarray>
    time               (volume_time, azimuth) datetime64[ns] 6kB 2018-12-20T0...
  * range              (range) float32 5kB 125.0 375.0 ... 2.996e+05 2.999e+05
    longitude          float64 8B 151.2
    latitude           float64 8B -33.7
    altitude           float64 8B 195.0
Dimensions without coordinates: volume_time
Data variables: (12/18)
    DBZH               (volume_time, azimuth, range) float64 7MB dask.array<chunksize=(1, 360, 1200), meta=np.ndarray>
    DBZH_CLEAN         (volume_time, azimuth, range) float64 7MB dask.array<chunksize=(1, 360, 1200), meta=np.ndarray>
    VRADDH             (volume_time, azimuth, range) float64 7MB dask.array<chunksize=(1, 360, 1200), meta=np.ndarray>
    VRADH              (volume_time, azimuth, range) float64 7MB dask.array<chunksize=(1, 360, 1200), meta=np.ndarray>
    WRADH              (volume_time, azimuth, range) float64 7MB dask.array<chunksize=(1, 360, 1200), meta=np.ndarray>
    TH                 (volume_time, azimuth, range) float64 7MB dask.array<chunksize=(1, 360, 1200), meta=np.ndarray>
    ...                 ...
    sweep_mode         (volume_time) <U20 160B 'azimuth_surveillance' 'azimut...
    sweep_number       (volume_time) int64 16B 0 0
    prt_mode           (volume_time) <U7 56B 'not_set' 'not_set'
    follow_mode        (volume_time) <U7 56B 'not_set' 'not_set'
    sweep_fixed_angle  (volume_time) float64 16B 0.5 0.5
    nyquist_velocity   (volume_time) float64 16B 26.23 26.23
Attributes:
    Conventions:  ODIM_H5/V2_2