def test_MissingErrors(self): with pytest.raises(ipol.MissingSourcesError): ipol.Nearest(np.array([]), self.trg) with pytest.raises(ipol.MissingTargetsError): ipol.Nearest(self.src, np.array([])) with pytest.raises(ipol.MissingSourcesError): ipol.Idw(np.array([]), self.trg) with pytest.raises(ipol.MissingTargetsError): ipol.Idw(self.src, np.array([])) with pytest.raises(ipol.MissingSourcesError): ipol.Linear(np.array([]), self.trg) with pytest.raises(ipol.MissingTargetsError): ipol.Linear(self.src, np.array([])) with pytest.raises(ipol.MissingSourcesError): ipol.OrdinaryKriging(np.array([]), self.trg) with pytest.raises(ipol.MissingTargetsError): ipol.OrdinaryKriging(self.src, np.array([])) with pytest.raises(ipol.MissingSourcesError): ipol.ExternalDriftKriging(np.array([]), self.trg) with pytest.raises(ipol.MissingTargetsError): ipol.ExternalDriftKriging(self.src, np.array([]))
def test_Linear_1(self): """testing the basic behaviour of the Linear class""" ip = ipol.Linear(self.src_lin, self.trg_lin) # input more than one dataset res = ip(self.vals_lin) self.assertTrue( np.allclose( res, np.array([[1., 2., 3.], [2., 2., 2.], [1.5, 2., 2.5], [3., 2., 1.]]))) # input only one flat array res = ip(self.vals_lin[:, 2]) self.assertTrue(np.allclose(res, np.array([3., 2., 2.5, 1.])))