wradlib.ipol.interpolate_polar

wradlib.ipol.interpolate_polar(data, mask=None, ipclass=<class 'wradlib.ipol.Nearest'>)

Convenience function to interpolate polar data

Parameters
  • data (numpy.ndarray) – 2 dimensional array (azimuth, ranges) of floats;

    if no mask is assigned explicitly polar data should be a masked array

  • mask (numpy.ndarray) – boolean array with pixels to be interpolated set to True;

    must have the same shape as data

  • ipclass (wradlib.ipol.IpolBase) – A class which inherits from IpolBase.

Returns

filled_data (numpy.ndarray) – 2D array with interpolated values for the values set to True in the mask

Examples

>>> import numpy as np  # noqa
>>> import wradlib as wrl
>>> # creating a data array and mask some values
>>> data = np.arange(12.).reshape(4,3)
>>> masked_values = (data==2) | (data==9)
>>> # interpolate the masked data based on ''masked_values''
>>> filled_a = wrl.ipol.interpolate_polar(data, mask = masked_values, ipclass = wrl.ipol.Linear)  # noqa
>>> ax, pm = wrl.vis.plot_ppi(filled_a)
>>> # the same result can be achieved by using an masked array instead of an explicit mask  # noqa
>>> mdata = np.ma.array(data, mask = masked_values)
>>> filled_b = wrl.ipol.interpolate_polar(mdata, ipclass = wrl.ipol.Linear)  # noqa
>>> ax, pm = wrl.vis.plot_ppi(filled_b)