ToGrid#

In this notebook we show the production of a reflectivity composite from 3 neighboring radars to a common cartesian grid, using the sampling volume size as a quality criterion.

import tempfile
import warnings

import cmweather
import numpy as np
import pyproj
import xarray as xr
import matplotlib.pyplot as plt

import wradlib as wrl
import wradlib_data

warnings.filterwarnings("ignore")
/home/docs/checkouts/readthedocs.org/user_builds/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#

First, we import measurements from three belgian radars. This is done using xarray.open_dataset using xradar.io.backends.odim.OdimBackendEntrypoint.

filenames = ["bejab.pvol.hdf", "bewid.pvol.hdf", "behel.pvol.hdf"]
paths = {f.split(".")[0][2:]: wradlib_data.DATASETS.fetch(f"hdf5/{f}") for f in filenames}
ctree = xr.DataTree()
for radar, filename in paths.items():
    ctree[radar] = xr.open_dataset(filename, engine="odim", group="sweep_0").chunk().wrl.georef.georeference().set_coords("sweep_mode")
display(ctree)
<xarray.DataTree>
Group: /
├── Group: /jab
│       Dimensions:            (azimuth: 360, range: 598)
│       Coordinates: (12/15)
│         * 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               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
│         * range              (range) float32 2kB 250.0 750.0 ... 2.982e+05 2.988e+05
│           x                  (azimuth, range) float64 2MB 2.182 6.545 ... -2.605e+03
│           y                  (azimuth, range) float64 2MB 250.0 750.0 ... 2.986e+05
│           ...                 ...
│           bins               (azimuth, range) float32 861kB 250.0 750.0 ... 2.988e+05
│           sweep_mode         <U20 80B 'azimuth_surveillance'
│           longitude          float64 8B 3.064
│           latitude           float64 8B 51.19
│           altitude           float64 8B 50.0
│           crs_wkt            int64 8B 0
│       Data variables:
│           DBZH               (azimuth, range) float64 2MB dask.array<chunksize=(360, 598), meta=np.ndarray>
│           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
├── Group: /wid
│       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 dask.array<chunksize=(360,), meta=np.ndarray>
│           time               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
│         * 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 dask.array<chunksize=(360, 1000), meta=np.ndarray>
│           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
└── Group: /hel
        Dimensions:            (azimuth: 360, range: 800)
        Coordinates: (12/15)
          * 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               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
          * range              (range) float32 3kB 125.0 375.0 ... 1.996e+05 1.999e+05
            x                  (azimuth, range) float64 2MB 1.091 3.272 ... -1.744e+03
            y                  (azimuth, range) float64 2MB 125.0 375.0 ... 1.998e+05
            ...                 ...
            bins               (azimuth, range) float32 1MB 125.0 375.0 ... 1.999e+05
            sweep_mode         <U20 80B 'azimuth_surveillance'
            longitude          float64 8B 5.406
            latitude           float64 8B 51.07
            altitude           float64 8B 140.0
            crs_wkt            int64 8B 0
        Data variables:
            DBZH               (azimuth, range) float64 2MB dask.array<chunksize=(360, 800), meta=np.ndarray>
            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

Plot Overview#

fig, axs = plt.subplots(1, 3, figsize=(18, 5), sharey=True)
ax = axs.flat[0]
ctree["jab"].ds.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60)
ax.set_aspect("equal")
ax.set_title("Radar Jabbeke")
ax = axs.flat[1]
ctree["wid"].ds.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60)
ax.set_aspect("equal")
ax.set_title("Radar Wideumont")
ax = axs.flat[2]
ctree["hel"].ds.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60)
ax.set_aspect("equal")
ax.set_title("Radar Helchteren")
fig.tight_layout()
../../_images/b5ff2c66f6f9aac624128ea33c7cb9d495db379bbaa35ba4303cceda75e78722.png

Georeference UTM#

proj_utm = pyproj.CRS.from_epsg(32632)
kwargs = dict(crs=proj_utm)
for radar in ctree.children:
    ctree[radar].ds = ctree[radar].ds.wrl.georef.georeference(crs=proj_utm)
display(ctree)
<xarray.DataTree>
Group: /
├── Group: /jab
│       Dimensions:            (azimuth: 360, range: 598)
│       Coordinates: (12/15)
│         * 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               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
│         * range              (range) float32 2kB 250.0 750.0 ... 2.982e+05 2.988e+05
│           x                  (azimuth, range) float64 2MB 8.539e+04 ... 1.074e+05
│           y                  (azimuth, range) float64 2MB 5.688e+06 ... 5.986e+06
│           ...                 ...
│           bins               (azimuth, range) float32 861kB 250.0 750.0 ... 2.988e+05
│           sweep_mode         <U20 80B 'azimuth_surveillance'
│           longitude          float64 8B 3.064
│           latitude           float64 8B 51.19
│           altitude           float64 8B 50.0
│           crs_wkt            int64 8B 0
│       Data variables:
│           DBZH               (azimuth, range) float64 2MB dask.array<chunksize=(360, 598), meta=np.ndarray>
│           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
├── Group: /wid
│       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 dask.array<chunksize=(360,), meta=np.ndarray>
│           time               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
│         * range              (range) float32 4kB 125.0 375.0 ... 2.496e+05 2.499e+05
│           x                  (azimuth, range) float64 3MB 2.492e+05 ... 2.588e+05
│           y                  (azimuth, range) float64 3MB 5.535e+06 ... 5.785e+06
│           ...                 ...
│           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 dask.array<chunksize=(360, 1000), meta=np.ndarray>
│           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
└── Group: /hel
        Dimensions:            (azimuth: 360, range: 800)
        Coordinates: (12/15)
          * 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               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
          * range              (range) float32 3kB 125.0 375.0 ... 1.996e+05 1.999e+05
            x                  (azimuth, range) float64 2MB 2.483e+05 ... 2.564e+05
            y                  (azimuth, range) float64 2MB 5.664e+06 ... 5.863e+06
            ...                 ...
            bins               (azimuth, range) float32 1MB 125.0 375.0 ... 1.999e+05
            sweep_mode         <U20 80B 'azimuth_surveillance'
            longitude          float64 8B 5.406
            latitude           float64 8B 51.07
            altitude           float64 8B 140.0
            crs_wkt            int64 8B 0
        Data variables:
            DBZH               (azimuth, range) float64 2MB dask.array<chunksize=(360, 800), meta=np.ndarray>
            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
fig, axs = plt.subplots(1, 3, figsize=(18, 5), sharey=True)
ax = axs.flat[0]
ctree["jab"].ds.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60)
ax.set_aspect("equal")
ax.set_title("Radar Jabbeke")
ax = axs.flat[1]
ctree["wid"].ds.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60)
ax.set_aspect("equal")
ax.set_title("Radar Wideumont")
ax = axs.flat[2]
ctree["hel"].ds.DBZH.wrl.vis.plot(ax=ax, vmin=0, vmax=60)
ax.set_aspect("equal")
ax.set_title("Radar Helchteren")
fig.tight_layout()
../../_images/48d7ca5e4915478229e91d36e303ba19d1a8d19121750141062b8d82b7881210.png

Calculate Quality#

for radar in ctree.children:
    rng = ctree[radar].ds.range
    azimuth = ctree[radar].ds.azimuth
    rscale = rng.diff("range").median().values
    qual = rng.wrl.qual.pulse_volume(rscale, 1.0).expand_dims(azimuth=ctree[radar].ds.azimuth)
    ctree[radar].ds = ctree[radar].ds.assign(QUAL=qual)
display(ctree)
<xarray.DataTree>
Group: /
├── Group: /jab
│       Dimensions:            (azimuth: 360, range: 598)
│       Coordinates: (12/15)
│         * 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               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
│         * range              (range) float32 2kB 250.0 750.0 ... 2.982e+05 2.988e+05
│           x                  (azimuth, range) float64 2MB 8.539e+04 ... 1.074e+05
│           y                  (azimuth, range) float64 2MB 5.688e+06 ... 5.986e+06
│           ...                 ...
│           bins               (azimuth, range) float32 861kB 250.0 750.0 ... 2.988e+05
│           sweep_mode         <U20 80B 'azimuth_surveillance'
│           longitude          float64 8B 3.064
│           latitude           float64 8B 51.19
│           altitude           float64 8B 50.0
│           crs_wkt            int64 8B 0
│       Data variables:
│           DBZH               (azimuth, range) float64 2MB dask.array<chunksize=(360, 598), meta=np.ndarray>
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float64 8B ...
│           nyquist_velocity   object 8B ...
│           QUAL               (azimuth, range) float64 2MB 7.477e+03 ... 1.068e+10
│       Attributes:
│           Conventions:  ODIM_H5/V2_2
├── Group: /wid
│       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 dask.array<chunksize=(360,), meta=np.ndarray>
│           time               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
│         * range              (range) float32 4kB 125.0 375.0 ... 2.496e+05 2.499e+05
│           x                  (azimuth, range) float64 3MB 2.492e+05 ... 2.588e+05
│           y                  (azimuth, range) float64 3MB 5.535e+06 ... 5.785e+06
│           ...                 ...
│           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 dask.array<chunksize=(360, 1000), meta=np.ndarray>
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float64 8B ...
│           nyquist_velocity   object 8B ...
│           QUAL               (azimuth, range) float64 3MB 934.6 ... 3.735e+09
│       Attributes:
│           Conventions:  ODIM_H5/V2_2
└── Group: /hel
        Dimensions:            (azimuth: 360, range: 800)
        Coordinates: (12/15)
          * 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               (azimuth) datetime64[ns] 3kB dask.array<chunksize=(360,), meta=np.ndarray>
          * range              (range) float32 3kB 125.0 375.0 ... 1.996e+05 1.999e+05
            x                  (azimuth, range) float64 2MB 2.483e+05 ... 2.564e+05
            y                  (azimuth, range) float64 2MB 5.664e+06 ... 5.863e+06
            ...                 ...
            bins               (azimuth, range) float32 1MB 125.0 375.0 ... 1.999e+05
            sweep_mode         <U20 80B 'azimuth_surveillance'
            longitude          float64 8B 5.406
            latitude           float64 8B 51.07
            altitude           float64 8B 140.0
            crs_wkt            int64 8B 0
        Data variables:
            DBZH               (azimuth, range) float64 2MB dask.array<chunksize=(360, 800), meta=np.ndarray>
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float64 8B ...
            nyquist_velocity   object 8B ...
            QUAL               (azimuth, range) float64 2MB 934.6 8.411e+03 ... 2.39e+09
        Attributes:
            Conventions:  ODIM_H5/V2_2

Gridding#

First, we create a Datset with cartesian coordinates, which can hold our three radars. We are using wradlib.comp.CompMethods.togrid to interpolate our sweep data to the cartesian domain. As an interpolator we use wradlib.ipol.Nearest.

xmin, xmax, ymin, ymax = ctree.wrl.util.bbox()
x = np.linspace(xmin, xmax + 1000.0, 1000)
y = np.linspace(ymin, ymax + 1000.0, 1000)
cart = xr.Dataset(coords={"x": (["x"], x), "y": (["y"], y)})
display(cart)
<xarray.Dataset> Size: 16kB
Dimensions:  (x: 1000, y: 1000)
Coordinates:
  * x        (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.991e+05 4.999e+05
  * y        (y) float64 8kB 5.285e+06 5.286e+06 ... 5.987e+06 5.988e+06
Data variables:
    *empty*
gtree = xr.DataTree()
for radar in ctree.children:
    gridded = ctree[radar].ds.wrl.comp.togrid(cart)
    gtree[radar] = gridded
display(gtree)
<xarray.DataTree>
Group: /
├── Group: /jab
│       Dimensions:            (y: 1000, x: 1000)
│       Coordinates:
│         * y                  (y) float64 8kB 5.285e+06 5.286e+06 ... 5.988e+06
│         * x                  (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.999e+05
│           sweep_mode         <U20 80B 'azimuth_surveillance'
│           longitude          float64 8B 3.064
│           latitude           float64 8B 51.19
│           altitude           float64 8B 50.0
│           crs_wkt            int64 8B 0
│       Data variables:
│           DBZH               (y, x) float64 8MB dask.array<chunksize=(1000, 1000), meta=np.ndarray>
│           QUAL               (y, x) float64 8MB nan nan nan nan ... nan nan nan nan
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float64 8B ...
│           nyquist_velocity   object 8B ...
├── Group: /wid
│       Dimensions:            (y: 1000, x: 1000)
│       Coordinates:
│         * y                  (y) float64 8kB 5.285e+06 5.286e+06 ... 5.988e+06
│         * x                  (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.999e+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               (y, x) float64 8MB dask.array<chunksize=(1000, 1000), meta=np.ndarray>
│           QUAL               (y, x) float64 8MB nan nan nan nan ... nan nan nan nan
│           sweep_number       int64 8B ...
│           prt_mode           <U7 28B ...
│           follow_mode        <U7 28B ...
│           sweep_fixed_angle  float64 8B ...
│           nyquist_velocity   object 8B ...
└── Group: /hel
        Dimensions:            (y: 1000, x: 1000)
        Coordinates:
          * y                  (y) float64 8kB 5.285e+06 5.286e+06 ... 5.988e+06
          * x                  (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.999e+05
            sweep_mode         <U20 80B 'azimuth_surveillance'
            longitude          float64 8B 5.406
            latitude           float64 8B 51.07
            altitude           float64 8B 140.0
            crs_wkt            int64 8B 0
        Data variables:
            DBZH               (y, x) float64 8MB dask.array<chunksize=(1000, 1000), meta=np.ndarray>
            QUAL               (y, x) float64 8MB nan nan nan nan ... nan nan nan nan
            sweep_number       int64 8B ...
            prt_mode           <U7 28B ...
            follow_mode        <U7 28B ...
            sweep_fixed_angle  float64 8B ...
            nyquist_velocity   object 8B ...
fig, axs = plt.subplots(1, 3, figsize=(18, 5), sharey=True)
ax = axs.flat[0]
gtree["jab"].ds.DBZH.plot(ax=ax, vmin=0, vmax=60, cmap="HomeyerRainbow")
ax.set_aspect("equal")
ax.set_title("Radar Jabbeke")
ax = axs.flat[1]
gtree["wid"].ds.DBZH.plot(ax=ax, vmin=0, vmax=60, cmap="HomeyerRainbow")
ax.set_aspect("equal")
ax.set_title("Radar Wideumont")
ax = axs.flat[2]
gtree["hel"].ds.DBZH.plot(ax=ax, vmin=0, vmax=60, cmap="HomeyerRainbow")
ax.set_aspect("equal")
ax.set_title("Radar Helchteren")
fig.tight_layout()
../../_images/c827f861088ddb220e902877d92ad22fae5a3615a4e59ba766e7160ef692630d.png
fig, axs = plt.subplots(1, 3, figsize=(18, 5), sharey=True)
ax = axs.flat[0]
gtree["jab"].ds.QUAL.plot(ax=ax)
ax.set_aspect("equal")
ax.set_title("Radar Jabbeke")
ax = axs.flat[1]
gtree["wid"].ds.QUAL.plot(ax=ax)
ax.set_aspect("equal")
ax.set_title("Radar Wideumont")
ax = axs.flat[2]
gtree["hel"].ds.QUAL.plot(ax=ax)
ax.set_aspect("equal")
ax.set_title("Radar Helchteren")
fig.tight_layout()
../../_images/5376715d270c122ea47a538e51689f322c329b10483e2929f9b92129381ac8cc.png

Compositing#

Before compositing we combine the three radar grids as well as the quality grids into one Dataset, respectively.

radars = xr.DataArray(gtree.children, dims="radar")
radargrids = xr.concat([gtree[radar].ds.DBZH for radar in gtree.children], dim=radars)
# normalizing Quality between 1. and 0.
qualitygrids = xr.concat([1. - (gtree[radar].ds.QUAL / gtree[radar].ds.QUAL.max()) for radar in gtree.children], dim=radars)

display(radargrids)
display(qualitygrids)
<xarray.DataArray 'DBZH' (radar: 3, y: 1000, x: 1000)> Size: 24MB
dask.array<concatenate, shape=(3, 1000, 1000), dtype=float64, chunksize=(1, 1000, 1000), chunktype=numpy.ndarray>
Coordinates:
  * radar       (radar) <U3 36B 'jab' 'wid' 'hel'
    longitude   (radar) float64 24B 3.064 5.506 5.406
    latitude    (radar) float64 24B 51.19 49.91 51.07
    altitude    (radar) float64 24B 50.0 590.0 140.0
  * y           (y) float64 8kB 5.285e+06 5.286e+06 ... 5.987e+06 5.988e+06
  * x           (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.991e+05 4.999e+05
    sweep_mode  <U20 80B 'azimuth_surveillance'
    crs_wkt     int64 8B 0
Attributes:
    _Undetect:      0.0
    long_name:      Equivalent reflectivity factor H
    standard_name:  radar_equivalent_reflectivity_factor_h
    units:          dBZ
<xarray.DataArray 'QUAL' (radar: 3, y: 1000, x: 1000)> Size: 24MB
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]],

       [[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]],

       [[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=(3, 1000, 1000))
Coordinates:
  * radar       (radar) <U3 36B 'jab' 'wid' 'hel'
    longitude   (radar) float64 24B 3.064 5.506 5.406
    latitude    (radar) float64 24B 51.19 49.91 51.07
    altitude    (radar) float64 24B 50.0 590.0 140.0
  * y           (y) float64 8kB 5.285e+06 5.286e+06 ... 5.987e+06 5.988e+06
  * x           (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.991e+05 4.999e+05
    sweep_mode  <U20 80B 'azimuth_surveillance'
    crs_wkt     int64 8B 0
Attributes:
    units:                           meters
    standard_name:                   projection_range_coordinate
    long_name:                       range_to_measurement_volume
    axis:                            radial_range_coordinate
    meters_between_gates:            500.0
    spacing_is_constant:             true
    meters_to_center_of_first_gate:  250.0

Then we finally can call wradlib.comp.CompMethods.compose_weighted to create the final output.

composite = radargrids.wrl.comp.compose_weighted(qualitygrids)
display(composite)
<xarray.DataArray 'DBZH' (y: 1000, x: 1000)> Size: 8MB
dask.array<where, shape=(1000, 1000), dtype=float64, chunksize=(1000, 1000), chunktype=numpy.ndarray>
Coordinates:
  * y           (y) float64 8kB 5.285e+06 5.286e+06 ... 5.987e+06 5.988e+06
  * x           (x) float64 8kB -2.143e+05 -2.136e+05 ... 4.991e+05 4.999e+05
    sweep_mode  <U20 80B 'azimuth_surveillance'
    crs_wkt     int64 8B 0
Attributes:
    _Undetect:      0.0
    long_name:      Equivalent reflectivity factor H
    standard_name:  radar_equivalent_reflectivity_factor_h
    units:          dBZ

Plot Result#

composite.where(composite>0.1).plot(cmap="HomeyerRainbow", vmin=0, vmax=60)
<matplotlib.collections.QuadMesh at 0x79012c35bed0>
../../_images/064d41643cc6be65b8fa5d04e458db6ad77ca03f5f59fc6109a0e85234b0c259.png