ODIM_H5#

[1]:
import xarray as xr
from open_radar_data import DATASETS

import xradar as xd

Download#

Fetching ODIM_H5 radar data file from open-radar-data repository.

[2]:
filename = DATASETS.fetch("71_20181220_060628.pvol.h5")

xr.open_dataset#

Making use of the xarray odim backend. We also need to provide the group. We use CfRadial2 group access pattern.

[3]:
ds = xr.open_dataset(filename, group="sweep_0", engine="odim")
display(ds)
<xarray.Dataset> Size: 40MB
Dimensions:            (azimuth: 360, range: 1200)
Coordinates:
    elevation          (azimuth) float64 3kB ...
    time               (azimuth) datetime64[ns] 3kB ...
  * range              (range) float32 5kB 125.0 375.0 ... 2.996e+05 2.999e+05
    longitude          float64 8B ...
    latitude           float64 8B ...
    altitude           float64 8B ...
  * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
Data variables: (12/17)
    DBZH               (azimuth, range) float64 3MB ...
    DBZH_CLEAN         (azimuth, range) float64 3MB ...
    VRADDH             (azimuth, range) float64 3MB ...
    VRADH              (azimuth, range) float64 3MB ...
    WRADH              (azimuth, range) float64 3MB ...
    TH                 (azimuth, range) float64 3MB ...
    ...                 ...
    CLASS              (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 ...
[4]:
ds.sweep_fixed_angle.values
[4]:
array(0.5)

Plot Time vs. Azimuth#

[5]:
ds.azimuth.plot()
[5]:
[<matplotlib.lines.Line2D at 0x7fb2fd375d50>]
../_images/notebooks_ODIM_H5_8_1.png

Plot Range vs. Time#

[6]:
ds.DBZH.plot()
[6]:
<matplotlib.collections.QuadMesh at 0x7fb2f5243210>
../_images/notebooks_ODIM_H5_10_1.png

Plot Range vs. Azimuth#

We need to sort by azimuth and specify the y-coordinate.

[7]:
ds.DBZH.sortby("azimuth").plot(y="azimuth")
[7]:
<matplotlib.collections.QuadMesh at 0x7fb2f40b2210>
../_images/notebooks_ODIM_H5_12_1.png

backend_kwargs#

Beside first_dim there are several additional backend_kwargs for the odim backend, which handle different aspects of angle alignment. This comes into play, when azimuth and/or elevation arrays are not evenly spacend and other issues.

[8]:
?xd.io.OdimBackendEntrypoint
[9]:
ds = xr.open_dataset(filename, group="sweep_0", engine="odim", first_dim="time")
display(ds)
<xarray.Dataset> Size: 40MB
Dimensions:            (time: 360, range: 1200)
Coordinates:
    elevation          (time) float64 3kB ...
  * time               (time) datetime64[ns] 3kB 2018-12-20T06:06:28.04027776...
  * range              (range) float32 5kB 125.0 375.0 ... 2.996e+05 2.999e+05
    longitude          float64 8B ...
    latitude           float64 8B ...
    altitude           float64 8B ...
    azimuth            (time) float32 1kB ...
Data variables: (12/17)
    DBZH               (time, range) float64 3MB ...
    DBZH_CLEAN         (time, range) float64 3MB ...
    VRADDH             (time, range) float64 3MB ...
    VRADH              (time, range) float64 3MB ...
    WRADH              (time, range) float64 3MB ...
    TH                 (time, range) float64 3MB ...
    ...                 ...
    CLASS              (time, range) float32 2MB ...
    sweep_mode         <U20 80B ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float64 8B ...

open_odim_datatree#

The same works analoguous with the datatree loader. But additionally we can provide a sweep string, number or list.

[10]:
?xd.io.open_odim_datatree
[11]:
dtree = xd.io.open_odim_datatree(filename, sweep=8)
display(dtree)
<xarray.DatasetView> Size: 232B
Dimensions:              ()
Data variables:
    volume_number        int64 8B 0
    platform_type        <U5 20B 'fixed'
    instrument_type      <U5 20B 'radar'
    time_coverage_start  <U20 80B '2018-12-20T06:09:21Z'
    time_coverage_end    <U20 80B '2018-12-20T06:09:34Z'
    longitude            float64 8B 151.2
    altitude             float64 8B 195.0
    latitude             float64 8B -33.7
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

Plot Sweep Range vs. Time#

[12]:
dtree["sweep_0"].ds.DBZH.sortby("time").plot(y="time")
[12]:
<matplotlib.collections.QuadMesh at 0x7fb2fe6ba410>
../_images/notebooks_ODIM_H5_20_1.png

Plot Sweep Range vs. Azimuth#

[13]:
dtree["sweep_0"].ds.DBZH.plot()
[13]:
<matplotlib.collections.QuadMesh at 0x7fb2f4655c90>
../_images/notebooks_ODIM_H5_22_1.png
[14]:
dtree = xd.io.open_odim_datatree(filename, sweep="sweep_8")
display(dtree)
<xarray.DatasetView> Size: 232B
Dimensions:              ()
Data variables:
    volume_number        int64 8B 0
    platform_type        <U5 20B 'fixed'
    instrument_type      <U5 20B 'radar'
    time_coverage_start  <U20 80B '2018-12-20T06:09:21Z'
    time_coverage_end    <U20 80B '2018-12-20T06:09:34Z'
    longitude            float64 8B 151.2
    altitude             float64 8B 195.0
    latitude             float64 8B -33.7
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
[15]:
dtree = xd.io.open_odim_datatree(filename, sweep=[0, 1, 8])
display(dtree)
<xarray.DatasetView> Size: 232B
Dimensions:              ()
Data variables:
    volume_number        int64 8B 0
    platform_type        <U5 20B 'fixed'
    instrument_type      <U5 20B 'radar'
    time_coverage_start  <U20 80B '2018-12-20T06:06:59Z'
    time_coverage_end    <U20 80B '2018-12-20T06:09:48Z'
    longitude            float64 8B 151.2
    altitude             float64 8B 195.0
    latitude             float64 8B -33.7
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
[16]:
dtree = xd.io.open_odim_datatree(filename, sweep=["sweep_0", "sweep_1", "sweep_8"])
display(dtree)
<xarray.DatasetView> Size: 232B
Dimensions:              ()
Data variables:
    volume_number        int64 8B 0
    platform_type        <U5 20B 'fixed'
    instrument_type      <U5 20B 'radar'
    time_coverage_start  <U20 80B '2018-12-20T06:06:28Z'
    time_coverage_end    <U20 80B '2018-12-20T06:09:34Z'
    longitude            float64 8B 151.2
    altitude             float64 8B 195.0
    latitude             float64 8B -33.7
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