wradlib.ipol.interpolate_polar#
- wradlib.ipol.interpolate_polar(data, *, mask=None, ipclass=<class 'wradlib.ipol.Nearest'>)[source]#
- wradlib.ipol.interpolate_polar(obj: DataArray, mask, **kwargs)
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
- Keyword Arguments
mask (
numpy.ndarray
) – boolean array with pixels to be interpolated set to True; must have the same shape as dataipclass (
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 >>> da = wrl.georef.create_xarray_dataarray(filled_a) >>> da = da.wrl.georef.georeference() >>> pm = wrl.vis.plot(da) >>> # 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 >>> da = wrl.georef.create_xarray_dataarray(filled_b) >>> da = da.wrl.georef.georeference() >>> pm = wrl.vis.plot(da)