# 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/georef/polar.py
# def spherical_to_xyz(
#     r, phi, theta, sitecoords, re=None, ke=4.0 / 3.0, squeeze=False, strict_dims=False
# ):
# def spherical_to_proj(r, phi, theta, sitecoords, proj=None, re=None, ke=4.0 / 3.0):
# def centroid_to_polyvert(centroid, delta):
# def spherical_to_polyvert(r, phi, theta, sitecoords, proj=None):
# def spherical_to_centroids(r, phi, theta, sitecoords, proj=None):
# def _check_polar_coords(r, az):
# def _is_sorted(x):
# def _get_range_resolution(x):
# def _get_azimuth_resolution(x):
# def sweep_centroids(nrays, rscale, nbins, elangle):
# def maximum_intensity_projection(
#     data, r=None, az=None, angle=None, elev=None, autoext=True
# ):


import warnings
import numpy as np
from pprint import pprint
from scipy import spatial, stats
from wradlib import util
from wradlib.georef import polar
    minval : float
        threshold value in order to compute metrics only for values larger
        than minval

    Examples
    --------
    >>> obs = np.random.uniform(0, 10, 100)
    >>> est = np.random.uniform(0, 10, 100)
    >>> metrics = ErrorMetrics(obs, est)
    >>> metrics.all() #doctest: +SKIP
    >>> metrics.pprint() #doctest: +SKIP
    >>> metrics.ix #doctest: +SKIP

    See :ref:`/notebooks/verification/wradlib_verify_example.ipynb` and
    :ref:`/notebooks/multisensor/wradlib_adjust_example.ipynb`.

    """

    def __init__(self, obs, est, minval=None):
        # Check input
        if len(obs) != len(est):
            raise ValueError(
                "WRADLIB: obs and est need to have the "
                f"same length. len(obs)={len(obs)}, "
                f"len(est)={len(est)}"
            )
        self.est = est
        self.obs = obs
        # remember those pairs which both have valid obs and est
        self.ix = np.intersect1d(

# 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/georef/polar.py
# def spherical_to_xyz(
#     r, phi, theta, sitecoords, re=None, ke=4.0 / 3.0, squeeze=False, strict_dims=False
# ):
# def spherical_to_proj(r, phi, theta, sitecoords, proj=None, re=None, ke=4.0 / 3.0):
# def centroid_to_polyvert(centroid, delta):
# def spherical_to_polyvert(r, phi, theta, sitecoords, proj=None):
# def spherical_to_centroids(r, phi, theta, sitecoords, proj=None):
# def _check_polar_coords(r, az):
# def _is_sorted(x):
# def _get_range_resolution(x):
# def _get_azimuth_resolution(x):
# def sweep_centroids(nrays, rscale, nbins, elangle):
# def maximum_intensity_projection(
#     data, r=None, az=None, angle=None, elev=None, autoext=True
# ):


# Path: wradlib/verify.py
import warnings
import numpy as np
from pprint import pprint
from scipy import spatial, stats
from wradlib import util
from wradlib.georef import polar

    minval : float
        threshold value in order to compute metrics only for values larger
        than minval

    Examples
    --------
    >>> obs = np.random.uniform(0, 10, 100)
    >>> est = np.random.uniform(0, 10, 100)
    >>> metrics = ErrorMetrics(obs, est)
    >>> metrics.all() #doctest: +SKIP
    >>> metrics.pprint() #doctest: +SKIP
    >>> metrics.ix #doctest: +SKIP

    See :ref:`/notebooks/verification/wradlib_verify_example.ipynb` and
    :ref:`/notebooks/multisensor/wradlib_adjust_example.ipynb`.

    """

    def __init__(self, obs, est, minval=None):
        # Check input
        if len(obs) != len(est):
            raise ValueError(
                "WRADLIB: obs and est need to have the "
                f"same length. len(obs)={len(obs)}, "
                f"len(est)={len(est)}"
            )
        self.est = est
        self.obs = obs
        # remember those pairs which both have valid obs and est
        self.ix = np.intersect1d(

            util._idvalid(obs, minval=minval), util._idvalid(est, minval=minval)