Hydrometeorclassification - Membershipfunctions#

The hydrometeorclassification code is based on the paper by Zrnic et.al 2001 utilizing 2D trapezoidal membership functions based on the paper by Straka et. al 2000 adapted by Evaristo et. al 2013 for X-Band.

import matplotlib.pyplot as plt
import wradlib as wrl
import xarray as xr
import radarpolarimetry as rp

Precipitation Types#

pr_types = dict(wrl.classify.pr_types.values())
for k, v in enumerate(pr_types.items()):
    print(f"{k:02} {' - '.join(v)}")
00 LR - Light Rain
01 MR - Moderate Rain
02 HR - Heavy Rain
03 LD - Large Drops
04 HL - Hail
05 RH - Rain/Hail
06 GH - Graupel/Hail
07 DS - Dry Snow
08 WS - Wet Snow
09 HC - H Crystals
10 VC - V Crystals
11 NP - No Precip

Load 2D Membership Functions#

filename = "/radar/wradlib-data/misc/msf_xband_v1.nc"
with rp.rpol_data.open(filename) as f:
    filename = f.name
msf = xr.open_dataset(filename)
display(msf)
<xarray.Dataset> Size: 97kB
Dimensions:  (hmc: 11, idp: 55, trapezoid: 4)
Coordinates:
  * hmc      (hmc) <U2 88B 'LR' 'MR' 'HR' 'LD' 'HL' ... 'GH' 'DS' 'WS' 'HC' 'VC'
  * idp      (idp) float64 440B -10.0 -8.0 -6.0 -4.0 ... 92.0 94.0 96.0 98.0
Dimensions without coordinates: trapezoid
Data variables:
    ZH       (hmc, idp, trapezoid) float64 19kB ...
    ZDR      (hmc, idp, trapezoid) float64 19kB ...
    RHO      (hmc, idp, trapezoid) float64 19kB ...
    KDP      (hmc, idp, trapezoid) float64 19kB ...
    TEMP     (hmc, idp, trapezoid) float64 19kB ...
Attributes:
    version:      1
    title:        2D Membershipfunctions Hydrometeorclassification for XBand
    institution:  Institute of Geosciences, Meteorology Section, University o...
    history:      created by Raquel Evaristo, adapted to netCDF by Kai Mühlbauer
    comment:      created with wradlib

Plot 2D Membership Functions#

minmax = [(0, 50), (-1, 6), (0.0, 1.0), (-5, 35), (-65, 45)]


def plot_msf(hmc):
    fig = plt.figure(figsize=(10, 8))
    t = fig.suptitle(f"{hmc.hmc.values} - {pr_types[hmc.hmc.values.item()]}")
    t.set_y(1.02)
    for k, p in enumerate(hmc.data_vars.values()):
        p = p.where(p != 0)
        ax = fig.add_subplot(3, 2, k + 1)
        p.sel(trapezoid=0).plot(x="idp", c="k", lw=1.0, ax=ax)
        p.sel(trapezoid=1).plot(x="idp", c="k", lw=2.0, ax=ax)
        p.sel(trapezoid=2).plot(x="idp", c="k", lw=2.0, ax=ax)
        p.sel(trapezoid=3).plot(x="idp", c="k", lw=1.0, ax=ax)
        ax.set_xlim((hmc.idp.min(), hmc.idp.max()))
        ax.margins(x=0.05, y=0.05)
        t = ax.set_title(f"{p.long_name}")
        ax.set_ylim(minmax[k])
    fig.tight_layout()
plot_msf(msf.sel(hmc="LR"))
../../_images/8ca4350146d3b7ccbaabfd43851ac8dbb28a217b8e6bf5e9e667de30134ceb30.png

Exercise 1: Plot other Hydrometeor types and discuss#

Solution 1: Plot other Hydrometeor types and discuss#

for k in pr_types:
    if k == "NP":
        continue
    plot_msf(msf.sel(hmc=k))
../../_images/8ca4350146d3b7ccbaabfd43851ac8dbb28a217b8e6bf5e9e667de30134ceb30.png ../../_images/1d89fbe8c0ab90d160ee9e8e2b7c2349d3268a818bbccc8eaaf2d9b3108ae684.png ../../_images/faa3bf3888de8f194531a5fcc5a28dacd5beaa07d7e4348ad3079b58fdf04b0a.png ../../_images/2bccfaacad59b2bd774afa8afcb47c0ddfb9da2474c1690f58f5613ca62ac86b.png ../../_images/1a005c22b33f51253c51da0739dba80b1460d8d8a4dabb1df998bdd18a836d37.png ../../_images/1e3734463cbe469dec2b114a01d794ab231b48612f33bcca1d78e14648ff4e62.png ../../_images/0ef88b1bed3f4498461053c8faf8c5c8c467f2437fe10d2dcfd997193a2673f4.png ../../_images/ef6679943dd4d7220acc22670badcd64c18e3a0c0e82dfd31a083fa83b4df3ec.png ../../_images/9ef9f01c465b032dd46cb3f4ade96fa4d0f95054d0dc7b717b83c35fef9582cf.png ../../_images/769494ef4b589dbc539100197d3d4eae7f5af821bf38beb8ee2fc50eb67e9cd2.png ../../_images/dd6aa27542a1766ba810f7f369a5fc99fe568eefff7f25e1474565e7c8efbe4d.png