Exemple #1
0
 def test_lcth_algorithm_interpolate(self):
     lcthalgo = LowCloudHeightAlgorithm(**self.testinput)
     cth = np.random.random_integers(0, 10, (5, 5)).astype(float)
     cth[cth > 7] = np.nan
     mask = np.random.random_integers(0, 1, (5, 5)).astype(bool)
     result = lcthalgo.interpol_cth(cth, mask)
     self.assertEqual(result.shape, (5, 5))
     self.assertTrue(np.all(np.isnan(result[mask])))
     self.assertGreaterEqual(np.sum(np.isnan(result)), np.sum(mask))
    def test_lcth_algorithm_interpolate(self):
        lcthalgo = LowCloudHeightAlgorithm(**self.testinput)
        # originally obtained with np.random.random_integers
        cth = np.array([[6., 3., 10., 7., 4.], [6., 9., 2., 6., 10.],
                        [10., 7., 4., 3., 7.], [7., 2., 5., 4., 1.],
                        [7., 5., 1., 4., 0.]])
        cth[cth > 7] = np.nan

        mask = np.array([[True, True, True, False, True],
                         [False, False, False, False, False],
                         [True, True, True, True, True],
                         [False, True, True, False, True],
                         [False, True, False, True, True]])
        result = lcthalgo.interpol_cth(cth, mask)
        self.assertEqual(result.shape, (5, 5))
        self.assertTrue(np.all(np.isnan(result[mask])))
        self.assertGreaterEqual(np.sum(np.isnan(result)), np.sum(mask))