Computing cartesian and geographical coordinates for polar data#

import numpy as np
import wradlib as wrl
import xradar as xd
import warnings

/home/runner/micromamba/envs/wradlib-tests/lib/python3.11/site-packages/h5py/ UserWarning: h5py is running against HDF5 1.14.3 when it was built against 1.14.2, this may cause problems
  _warn(("h5py is running against HDF5 {0} when it was built against {1}, "

Read the data#

Here, we use an OPERA hdf5 dataset.

filename = "hdf5/20130429043000.rad.bewid.pvol.dbzh.scan1.hdf"
filename = wrl.util.get_wradlib_data_file(filename)
pvol =
Dimensions:              ()
Data variables:
    volume_number        int64 0
    platform_type        <U5 'fixed'
    instrument_type      <U5 'radar'
    time_coverage_start  <U20 '2013-04-29T04:30:00Z'
    time_coverage_end    <U20 '2013-04-29T04:31:39Z'
    longitude            float64 5.506
    altitude             float64 592.0
    latitude             float64 49.91
    Conventions:      ODIM_H5/V2_1
    version:          None
    title:            None
    institution:      None
    references:       None
    source:           None
    history:          None
    comment:          im/exported using xradar
    instrument_name:  None

Retrieve azimuthal equidistant coordinates and projection#

for key in list(pvol.children):
    if "sweep" in key:
        pvol[key].ds = pvol[key].ds.wrl.georef.georeference()
pvol["sweep_0"].ds.DBZH.plot(x="x", y="y")
<matplotlib.collections.QuadMesh at 0x7fd706ef9290>

Retrieve geographic coordinates (longitude and latitude)#

Using crs-keyword argument.#

for key in list(pvol.children):
    if "sweep" in key:
        pvol[key].ds = pvol[key].ds.wrl.georef.georeference(
ds1 = pvol["sweep_0"].ds.wrl.georef.georeference(
ds1.DBZH.plot(x="x", y="y")
<matplotlib.collections.QuadMesh at 0x7fd704cbfb50>

Using reproject#

ds2 = pvol["sweep_0"].ds.wrl.georef.reproject(
ds2.DBZH.plot(x="x", y="y")
<matplotlib.collections.QuadMesh at 0x7fd6f4cba850>