wradlib.vpr.CAPPI#
- class wradlib.vpr.CAPPI(polcoords, gridcoords, *, maxrange=None, minelev=None, maxelev=None, ipclass=<class 'wradlib.ipol.Idw'>, **ipargs)[source]#
Bases:
CartesianVolume
Create a Constant Altitude Plan Position Indicator (CAPPI)
A CAPPI gives the value of a target variable (typically reflectivity in dBZ, but here also other variables such as e.g. rainfall intensity) in a defined altitude.
In order to create a CAPPI, you first have to create an instance of this class. Calling this instance with the actual polar volume data will return the CAPPI grid.
- Parameters
polcoords (
numpy.ndarray
) – coordinate array of shape (num bins, 3) Represents the 3-D coordinates of the original radar binsgridcoords (
numpy.ndarray
) – coordinate array of shape (num voxels, 3) Represents the 3-D coordinates of the Cartesian gridmaxrange (
float
) – The maximum radar range (must be the same for each elevation angle)ipclass (
wradlib.ipol.IpolBase
) – an interpolation class fromwradlib.ipol
ipargs (
dict
) – keyword arguments corresponding toipclass
- Returns
output (
numpy.ndarray
) – float 1-d ndarray of the same length asgridcoords
(num voxels,)
See also
Examples
See Recipe #2: Reading and visualizing an ODIM_H5 polar volume.
Here’s an example how a set of CAPPIs can be created from synthetic polar volume data:
>>> import wradlib >>> import numpy as np >>> from osgeo import osr >>> import matplotlib.pyplot as pl >>> pl.interactive(True) >>> # define elevation and azimuth angles, ranges, radar site coordinates, >>> # projection >>> elevs = np.array([0.5,1.5,2.4,3.4,4.3,5.3,6.2,7.5,8.7,10,12,14,16.7,19.5]) >>> azims = np.arange(0., 360., 1.) >>> ranges = np.arange(0., 120000., 1000.) >>> site = (120.255547,14.924218,500.) >>> crs = osr.SpatialReference() >>> _ = crs.ImportFromEPSG(32651) >>> # create Cartesian coordinates corresponding the location of the >>> # polar volume bins >>> polxyz = wradlib.vpr.volcoords_from_polar(site, elevs, ... azims, ranges, crs=crs) # noqa >>> poldata = wradlib.vpr.synthetic_polar_volume(polxyz) >>> # this is the shape of our polar volume >>> polshape = (len(elevs),len(azims),len(ranges)) >>> # now we define the coordinates for the 3-D grid (the CAPPI layers) >>> x = np.linspace(polxyz[:,0].min(), polxyz[:,0].max(), 120) >>> y = np.linspace(polxyz[:,1].min(), polxyz[:,1].max(), 120) >>> z = np.arange(500.,10500.,500.) >>> xyz = wradlib.util.gridaspoints(z, y, x) >>> gridshape = (len(z), len(y), len(x)) >>> # create an instance of the CAPPI class and >>> # use it to create a series of CAPPIs >>> gridder = wradlib.vpr.CAPPI(polxyz, xyz, maxrange=ranges.max(), # noqa ... minelev=elevs.min(), maxelev=elevs.max(), ... ipclass=wradlib.ipol.Idw) >>> gridded = np.ma.masked_invalid( gridder(poldata) ).reshape(gridshape) >>> >>> # plot results >>> levels = np.linspace(0,100,25) >>> wradlib.vis.plot_max_plan_and_vert(x, y, z, gridded, levels=levels, ... cmap=pl.cm.viridis) >>> pl.show()
|
Interpolates the polar data to 3-dimensional Cartesian coordinates |