def test_lcth_algorithm_nan_neighbor(self): lcthalgo = LowCloudHeightAlgorithm(**self.testinput) elev = np.empty((3, 3)) elev[:] = np.nan lcthalgo.elev = elev ret, mask = lcthalgo.run() self.assertEqual(lcthalgo.ir108.shape, (3, 3)) self.assertEqual(ret.shape, (3, 3)) self.assertEqual(lcthalgo.shape, (3, 3)) self.assertEqual(np.ma.is_mask(lcthalgo.mask), True) self.assertEqual(np.isnan(np.nanmax(lcthalgo.dz)), True) self.assertEqual(np.isnan(np.nanmax(lcthalgo.cth)), True)
def lcth_ok(): alg = LowCloudHeightAlgorithm() alg.elev = np.zeros((5, 5)) alg.ir108 = np.arange(260, 265, 0.2).reshape(5, 5) alg.ccl = np.ones((5, 5)) alg.clusters = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 1, 0, 0], [0, 1, 1, 1, 0], [1, 1, 0, 0, 0]], dtype="i4") alg.dz = np.zeros((5, 5)) alg.cth = np.zeros((5, 5)) alg.nlapse = 0 return alg