# Path: wradlib/adjust.py
# class AdjustBase(ipol.IpolBase):
# class AdjustAdd(AdjustBase):
# class AdjustMultiply(AdjustBase):
# class AdjustMixed(AdjustBase):
# class AdjustMFB(AdjustBase):
# class AdjustNone(AdjustBase):
# class GageOnly(AdjustBase):
# class RawAtObs:
#     def __init__(
#         self,
#         obs_coords,
#         raw_coords,
#         nnear_raws=9,
#         stat="median",
#         mingages=5,
#         minval=0.0,
#         mfb_args=None,
#         ipclass=ipol.Idw,
#         **ipargs,
#     ):
#     def _checkip(self, ix, targets):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def _check_shape(self, obs, raw):
#     def _get_valid_pairs(self, obs, raw):
#     def xvalidate(self, obs, raw):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __init__(self, obs_coords, raw_coords, nnear=9, stat="median"):
#     def __call__(self, raw, obs=None):
# def _get_neighbours_ix(obs_coords, raw_coords, nnear):
# def _get_statfunc(funcname):
#         def newfunc(x, y):
# def best(x, y):


import numpy as np
import pytest
from wradlib import adjust
        res = adj(self.obs, self.raw)
        shouldbe = np.array([2.0, 2.0])
        assert np.allclose(res, shouldbe)


class TestGageOnly(Data):
    raw_coords = np.array([[0.0, 0.0], [1.0, 1.0]])
    obs_coords = np.array([[0.5, 0.5], [1.5, 1.5]])
    raw = np.array([2.0, 2.0])
    obs = np.array([4.0, 4.0])
    mingages = 0
    mfb_args = dict(method="mean")

    def test_GageOnly_1(self):
        adj = adjust.GageOnly(
            self.obs_coords,
            self.raw_coords,
            nnear_raws=self.nnear_raws,
            mingages=self.mingages,
        )
        res = adj(self.obs, self.raw)
        shouldbe = np.array([4.0, 4.0])
        assert np.allclose(res, shouldbe)


class TestAdjustHelper:
    def test__get_neighbours_ix(self):
        pass

    def test__get_statfunc(self):

# Path: wradlib/adjust.py
# class AdjustBase(ipol.IpolBase):
# class AdjustAdd(AdjustBase):
# class AdjustMultiply(AdjustBase):
# class AdjustMixed(AdjustBase):
# class AdjustMFB(AdjustBase):
# class AdjustNone(AdjustBase):
# class GageOnly(AdjustBase):
# class RawAtObs:
#     def __init__(
#         self,
#         obs_coords,
#         raw_coords,
#         nnear_raws=9,
#         stat="median",
#         mingages=5,
#         minval=0.0,
#         mfb_args=None,
#         ipclass=ipol.Idw,
#         **ipargs,
#     ):
#     def _checkip(self, ix, targets):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def _check_shape(self, obs, raw):
#     def _get_valid_pairs(self, obs, raw):
#     def xvalidate(self, obs, raw):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __call__(self, obs, raw, targets=None, rawatobs=None, ix=None):
#     def __init__(self, obs_coords, raw_coords, nnear=9, stat="median"):
#     def __call__(self, raw, obs=None):
# def _get_neighbours_ix(obs_coords, raw_coords, nnear):
# def _get_statfunc(funcname):
#         def newfunc(x, y):
# def best(x, y):


# Path: wradlib/tests/test_adjust.py
import numpy as np
import pytest
from wradlib import adjust

        res = adj(self.obs, self.raw)
        shouldbe = np.array([2.0, 2.0])
        assert np.allclose(res, shouldbe)


class TestGageOnly(Data):
    raw_coords = np.array([[0.0, 0.0], [1.0, 1.0]])
    obs_coords = np.array([[0.5, 0.5], [1.5, 1.5]])
    raw = np.array([2.0, 2.0])
    obs = np.array([4.0, 4.0])
    mingages = 0
    mfb_args = dict(method="mean")

    def test_GageOnly_1(self):
        adj = adjust.GageOnly(
            self.obs_coords,
            self.raw_coords,
            nnear_raws=self.nnear_raws,
            mingages=self.mingages,
        )
        res = adj(self.obs, self.raw)
        shouldbe = np.array([4.0, 4.0])
        assert np.allclose(res, shouldbe)


class TestAdjustHelper:
    def test__get_neighbours_ix(self):
        pass

    def test__get_statfunc(self):

        adjust._get_statfunc("median")