Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_loess(self):
grid = self._load()
filled0 = pyinterp.fill.loess(grid, num_threads=0)
filled1 = pyinterp.fill.loess(grid, num_threads=1)
data = np.copy(grid.array)
data[np.isnan(data)] = 0
filled0[np.isnan(filled0)] = 0
filled1[np.isnan(filled1)] = 0
self.assertEqual((filled0 - filled1).mean(), 0)
self.assertEqual(np.ma.fix_invalid(grid.array - filled1).mean(), 0)
self.assertNotEqual((data - filled1).mean(), 0)
def test_loess_3d(self):
grid = self._load(True)
filled0 = pyinterp.fill.loess(grid, num_threads=0)
filled0[np.isnan(filled0)] = 0
self.assertEqual((filled0[:, :, 0] - filled0[:, :, 1]).mean(), 0)
def test_loess(self):
grid = self._load()
filled0 = pyinterp.fill.loess(grid, num_threads=0)
filled1 = pyinterp.fill.loess(grid, num_threads=1)
data = np.copy(grid.array)
data[np.isnan(data)] = 0
filled0[np.isnan(filled0)] = 0
filled1[np.isnan(filled1)] = 0
self.assertEqual((filled0 - filled1).mean(), 0)
self.assertEqual(np.ma.fix_invalid(grid.array - filled1).mean(), 0)
self.assertNotEqual((data - filled1).mean(), 0)