# Path: wradlib/dp.py
# def process_raw_phidp_vulpiani(
#     phidp, dr, ndespeckle=5, winlen=7, niter=2, copy=False, **kwargs
# ):
# def unfold_phi_vulpiani(phidp, kdp, th=-20, winlen=7):
# def _fill_sweep(dat, kind="nan_to_num", fill_value=0.0):
# def kdp_from_phidp(
#     phidp, winlen=7, dr=1.0, method="lanczos_conv", skipna=True, **kwargs
# ):
# def unfold_phi(phidp, rho, width=5, copy=False):
# def unfold_phi_naive(phidp, rho, width=5, copy=False):
# def linear_despeckle(data, ndespeckle=3, copy=False):
# def texture(data):
# def depolarization(zdr, rho):
# 
# Path: wradlib/util.py
# def maximum_intensity_projection(*args, **kwargs):
#     def __init__(self, name):
#     def __getattr__(self, name):
# def import_optional(module):
# def _shape_to_size(shape):
# def from_to(tstart, tend, tdelta):
# def _idvalid(data, isinvalid=None, minval=None, maxval=None):
# def meshgrid_n(*arrs):
# def gridaspoints(*arrs):
# def issequence(x):
# def trapezoid(data, x1, x2, x3, x4):
# def filter_window_polar(img, wsize, fun, rscale, random=False):
# def prob_round(x, prec=0):
# def filter_window_cartesian(img, wsize, fun, scale, **kwargs):
# def roll2d_polar(img, shift=1, axis=0):
#     def __repr__(self):
#     def utcoffset(self, dtime):
#     def tzname(self, dtime):
#     def dst(self, dtime):
# def half_power_radius(r, bwhalf):
# def get_raster_origin(coords):
# def find_bbox_indices(coords, bbox):
# def has_geos():
# def get_wradlib_data_path():
# def get_wradlib_data_file(relfile):
# def calculate_polynomial(data, w):
# def medfilt_along_axis(x, n, axis=-1):
# def gradient_along_axis(x):
# def gradient_from_smoothed(x, n=5):
# def center_to_edge(centers):
# def _pad_array(data, pad, mode="reflect", **kwargs):
# def _rolling_dim(data, window):
# def _linregress_1d(rhs, method="lstsq"):
# def _nan_lstsq(y, x):
# def _nan_matrix_inv(y, x):
# def _matrix_inv(x, y):
# def _nan_cov(x, y):
# def _cov(x, y):
# def _lanczos_differentiator(winlen):
# def derivate(data, winlen=7, method="lanczos_conv", skipna=False, **kwargs):
# def despeckle(data, n=3, copy=False):
# def show_versions(file=None):
# def _open_file(name):
# def has_import(module):
# class OptionalModuleStub:
# class UTC(dt.tzinfo):


import sys
import numpy as np
import pytest
from scipy import integrate
from wradlib import dp, util
        res = self.kdp_true[:, self.pad : -self.pad]
        np.testing.assert_array_almost_equal(outx, res, decimal=4)

        # intercompare with lanczos method with NaN handling
        out0 = dp.kdp_from_phidp(
            self.phidp_true.copy(), dr=self.dr, method="lanczos_conv", winlen=window
        )
        np.testing.assert_array_almost_equal(out, out0, decimal=4)

    def test_linear_despeckle_deprecated(self, ndespeckle):
        with pytest.warns(DeprecationWarning):
            dp.linear_despeckle(self.phidp_raw0, ndespeckle=ndespeckle, copy=True)

    def test_linear_despeckle(self, ndespeckle):
        util.despeckle(self.phidp_raw0, n=ndespeckle, copy=True)

    def test_unfold_phi_naive(self):
        dp.unfold_phi_naive(self.phidp_raw0, self.rho)
        dp.unfold_phi_naive(self.phidp_raw0, self.rho, copy=True)

    def test_unfold_phi_vulpiani(self):
        phi_true = np.arange(600)
        phi_raw1 = phi_true.copy()
        phi_raw1[phi_raw1 > 540] -= 360
        phi_raw2 = phi_raw1.copy()
        phi_raw2[phi_raw2 > 180] -= 360
        kdp1 = dp.kdp_from_phidp(phi_raw1)
        kdp2 = dp.kdp_from_phidp(phi_raw2)

        out1 = dp.unfold_phi_vulpiani(phi_raw1.copy(), kdp1)

# Path: wradlib/dp.py
# def process_raw_phidp_vulpiani(
#     phidp, dr, ndespeckle=5, winlen=7, niter=2, copy=False, **kwargs
# ):
# def unfold_phi_vulpiani(phidp, kdp, th=-20, winlen=7):
# def _fill_sweep(dat, kind="nan_to_num", fill_value=0.0):
# def kdp_from_phidp(
#     phidp, winlen=7, dr=1.0, method="lanczos_conv", skipna=True, **kwargs
# ):
# def unfold_phi(phidp, rho, width=5, copy=False):
# def unfold_phi_naive(phidp, rho, width=5, copy=False):
# def linear_despeckle(data, ndespeckle=3, copy=False):
# def texture(data):
# def depolarization(zdr, rho):
# 
# Path: wradlib/util.py
# def maximum_intensity_projection(*args, **kwargs):
#     def __init__(self, name):
#     def __getattr__(self, name):
# def import_optional(module):
# def _shape_to_size(shape):
# def from_to(tstart, tend, tdelta):
# def _idvalid(data, isinvalid=None, minval=None, maxval=None):
# def meshgrid_n(*arrs):
# def gridaspoints(*arrs):
# def issequence(x):
# def trapezoid(data, x1, x2, x3, x4):
# def filter_window_polar(img, wsize, fun, rscale, random=False):
# def prob_round(x, prec=0):
# def filter_window_cartesian(img, wsize, fun, scale, **kwargs):
# def roll2d_polar(img, shift=1, axis=0):
#     def __repr__(self):
#     def utcoffset(self, dtime):
#     def tzname(self, dtime):
#     def dst(self, dtime):
# def half_power_radius(r, bwhalf):
# def get_raster_origin(coords):
# def find_bbox_indices(coords, bbox):
# def has_geos():
# def get_wradlib_data_path():
# def get_wradlib_data_file(relfile):
# def calculate_polynomial(data, w):
# def medfilt_along_axis(x, n, axis=-1):
# def gradient_along_axis(x):
# def gradient_from_smoothed(x, n=5):
# def center_to_edge(centers):
# def _pad_array(data, pad, mode="reflect", **kwargs):
# def _rolling_dim(data, window):
# def _linregress_1d(rhs, method="lstsq"):
# def _nan_lstsq(y, x):
# def _nan_matrix_inv(y, x):
# def _matrix_inv(x, y):
# def _nan_cov(x, y):
# def _cov(x, y):
# def _lanczos_differentiator(winlen):
# def derivate(data, winlen=7, method="lanczos_conv", skipna=False, **kwargs):
# def despeckle(data, n=3, copy=False):
# def show_versions(file=None):
# def _open_file(name):
# def has_import(module):
# class OptionalModuleStub:
# class UTC(dt.tzinfo):


# Path: wradlib/tests/test_dp.py
import sys
import numpy as np
import pytest
from scipy import integrate
from wradlib import dp, util

        res = self.kdp_true[:, self.pad : -self.pad]
        np.testing.assert_array_almost_equal(outx, res, decimal=4)

        # intercompare with lanczos method with NaN handling
        out0 = dp.kdp_from_phidp(
            self.phidp_true.copy(), dr=self.dr, method="lanczos_conv", winlen=window
        )
        np.testing.assert_array_almost_equal(out, out0, decimal=4)

    def test_linear_despeckle_deprecated(self, ndespeckle):
        with pytest.warns(DeprecationWarning):
            dp.linear_despeckle(self.phidp_raw0, ndespeckle=ndespeckle, copy=True)

    def test_linear_despeckle(self, ndespeckle):
        util.despeckle(self.phidp_raw0, n=ndespeckle, copy=True)

    def test_unfold_phi_naive(self):
        dp.unfold_phi_naive(self.phidp_raw0, self.rho)
        dp.unfold_phi_naive(self.phidp_raw0, self.rho, copy=True)

    def test_unfold_phi_vulpiani(self):
        phi_true = np.arange(600)
        phi_raw1 = phi_true.copy()
        phi_raw1[phi_raw1 > 540] -= 360
        phi_raw2 = phi_raw1.copy()
        phi_raw2[phi_raw2 > 180] -= 360
        kdp1 = dp.kdp_from_phidp(phi_raw1)
        kdp2 = dp.kdp_from_phidp(phi_raw2)

        out1 = dp.unfold_phi_vulpiani(phi_raw1.copy(), kdp1)

        out2 = dp.unfold_phi_vulpiani(phi_raw2.copy(), kdp2)