示例#1
0
    def test_lcth_algorithm_real(self):
        # Compute cloud mask
        cloudfilter = CloudFilter(self.input['ir108'], **self.input)
        cloudfilter.apply()
        snowfilter = SnowFilter(cloudfilter.result, **self.input)
        snowfilter.apply()
        icefilter = IceCloudFilter(snowfilter.result, **self.input)
        icefilter.apply()
        cirrusfilter = CirrusCloudFilter(icefilter.result, **self.input)
        cirrusfilter.apply()
        waterfilter = WaterCloudFilter(cirrusfilter.result,
                                       cloudmask=cloudfilter.mask,
                                       **self.input)
        ret, mask = waterfilter.apply()

        self.ccl = cloudfilter.ccl
        self.input['ccl'] = self.ccl
        self.input['cloudmask'] = ret.mask

        lcthalgo = LowCloudHeightAlgorithm(**self.input)
        ret, mask = lcthalgo.run()
        self.assertEqual(lcthalgo.ir108.shape, (141, 298))
        self.assertEqual(ret.shape, (141, 298))
        self.assertEqual(lcthalgo.shape, (141, 298))
        self.assertEqual(np.ma.is_mask(lcthalgo.mask), True)
        self.assertLessEqual(round(np.nanmax(lcthalgo.dz), 2), 1524.43)
示例#2
0
 def test_lcth_algorithm_artificial_next(self):
     lcthalgo = LowCloudHeightAlgorithm(**self.testnextinput)
     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.nanmax(lcthalgo.dz), 12.)
     self.assertEqual(np.around(lcthalgo.cth[1, 1], 2), 444.23)
示例#3
0
 def test_lcth_algorithm_artificial_complement(self):
     lcthalgo = LowCloudHeightAlgorithm(**self.testinput2)
     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.nanmax(lcthalgo.dz), 1300.)
     self.assertEqual(np.nanmax(np.around(lcthalgo.cth, 2)), 6168.06)
示例#4
0
 def test_lcth_algorithm_artificial(self):
     lcthalgo = LowCloudHeightAlgorithm(**self.testinput)
     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.nanmax(lcthalgo.dz), 800.)
     self.assertEqual(np.nanmax(lcthalgo.cth), 800.)
示例#5
0
 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)
示例#6
0
 def test_lcth_algorithm_linreg_cluster(self):
     """Test single cloud cluster linear regression interpolation"""
     # Get cloud parameters
     from fogpy.filters import CloudFilter
     cloudfilter = CloudFilter(self.ir108, **self.input)
     ret, mask = cloudfilter.apply()
     input = {'ir108': self.ir108,
              'elev': self.elev,
              'ccl': cloudfilter.ccl,
              'cloudmask': cloudfilter.mask,
              'interpolate': False,
              'single': True}
     # Run LCTH algorithm
     lcthalgo = LowCloudHeightAlgorithm(**input)
     ret, mask = lcthalgo.run()
     # lcthalgo.plot_result()
     self.assertEqual(ret.shape, (141, 298))
     self.assertEqual(lcthalgo.shape, (141, 298))
     self.assertEqual(np.ma.is_mask(lcthalgo.mask), True)
     self.assertLessEqual(round(np.nanmax(lcthalgo.dz), 2), 1900)