Convective/Stratiform Classification (Steiner)

Convective/Stratiform Classification (Steiner)#

This notebook shows the convective/stratiform classification of a single radar sweep according to [Steiner et al., 1995]. Echoes are flagged as convective if they either exceed an absolute intensity threshold or are sufficiently peaked above their local background. Detected convective cores are expanded by a background-dependent radius.

import warnings

import matplotlib.pyplot as plt
import xarray as xr
import wradlib as wrl
import wradlib_data

warnings.filterwarnings("ignore")
/home/docs/checkouts/wradlib/conda/latest/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm

Get radar data#

filename = wradlib_data.DATASETS.fetch("hdf5/bewid.pvol.hdf")
swp = (
    xr.open_dataset(filename, engine="odim", group="sweep_0")
    .wrl.georef.georeference()
    .set_coords("sweep_mode")
)
display(swp)
Downloading file 'hdf5/bewid.pvol.hdf' from 'https://github.com/wradlib/wradlib-data/raw/main/data/hdf5/bewid.pvol.hdf' to '/home/docs/.cache/wradlib-data'.
<xarray.Dataset> Size: 17MB
Dimensions:            (azimuth: 360, range: 1000)
Coordinates: (12/15)
  * azimuth            (azimuth) float32 1kB 0.5 1.5 2.5 ... 357.5 358.5 359.5
    elevation          (azimuth) float64 3kB 0.3 0.3 0.3 0.3 ... 0.3 0.3 0.3 0.3
    time               (azimuth) datetime64[ns] 3kB ...
  * range              (range) float32 4kB 125.0 375.0 ... 2.496e+05 2.499e+05
    x                  (azimuth, range) float64 3MB 1.091 3.272 ... -2.179e+03
    y                  (azimuth, range) float64 3MB 125.0 375.0 ... 2.497e+05
    ...                 ...
    bins               (azimuth, range) float32 1MB 125.0 375.0 ... 2.499e+05
    sweep_mode         <U20 80B 'azimuth_surveillance'
    longitude          float64 8B 5.506
    latitude           float64 8B 49.91
    altitude           float64 8B 590.0
    crs_wkt            int64 8B 0
Data variables:
    DBZH               (azimuth, range) float64 3MB ...
    sweep_number       int64 8B ...
    prt_mode           <U7 28B ...
    follow_mode        <U7 28B ...
    sweep_fixed_angle  float64 8B ...
    nyquist_velocity   object 8B ...
Attributes:
    Conventions:  ODIM_H5/V2_2
    source:       radar
    wmo__id:      06477
    site_name:    Wideumont
    node:         bewid

Classify#

The accessor wradlib.classify.ClassifyMethods.convective_steiner returns a boolean mask which is True for convective echo. The range gate size is taken from the sweep’s range coordinate, all other parameters are Steiner’s defaults.

For plotting we convert the mask to 1 (convective) and 0 (stratiform), masking gates without data.

conv = swp.DBZH.wrl.classify.convective_steiner()
cls = xr.where(conv, 1, 0).where(swp.DBZH > -32)  # -32 dBZ is ODIM nodata
display(cls)
<xarray.DataArray 'convective' (azimuth: 360, range: 1000)> Size: 3MB
array([[nan, nan, nan, ..., nan, nan, nan],
       [nan, nan, nan, ..., nan, nan, nan],
       [nan, nan, nan, ..., nan, nan, nan],
       ...,
       [nan, nan, nan, ..., nan, nan, nan],
       [nan, nan, nan, ..., nan, nan, nan],
       [nan, nan, nan, ..., nan, nan, nan]], shape=(360, 1000))
Coordinates: (12/15)
  * azimuth     (azimuth) float32 1kB 0.5 1.5 2.5 3.5 ... 357.5 358.5 359.5
    elevation   (azimuth) float64 3kB 0.3 0.3 0.3 0.3 0.3 ... 0.3 0.3 0.3 0.3
    time        (azimuth) datetime64[ns] 3kB 2019-06-06T00:04:58.805563392 .....
  * range       (range) float32 4kB 125.0 375.0 625.0 ... 2.496e+05 2.499e+05
    x           (azimuth, range) float64 3MB 1.091 3.272 ... -2.179e+03
    y           (azimuth, range) float64 3MB 125.0 375.0 ... 2.495e+05 2.497e+05
    ...          ...
    bins        (azimuth, range) float32 1MB 125.0 375.0 ... 2.496e+05 2.499e+05
    sweep_mode  <U20 80B 'azimuth_surveillance'
    longitude   float64 8B 5.506
    latitude    float64 8B 49.91
    altitude    float64 8B 590.0
    crs_wkt     int64 8B 0

Plot Result#

fig, axs = plt.subplots(1, 2, figsize=(14, 6), sharey=True)
ax = axs.flat[0]
swp.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60, cmap="HomeyerRainbow")
ax.set_aspect("equal")
ax.set_title("Reflectivity")
ax = axs.flat[1]
cls.wrl.vis.plot(
    ax=ax,
    vmin=0,
    vmax=1,
    cmap="bwr",
    cbar_kwargs=dict(label="0 = stratiform, 1 = convective"),
)
ax.set_aspect("equal")
ax.set_title("Steiner classification")
fig.tight_layout()
../../_images/6bfdef895dcdb918fd6d9ff02cd5f1ebbeb910f50081869960dee651ecf71cad.png