Beispiel #1
0
    def test_fusion_filter_bufr_import(self):
        # Create fusion filter
        testfilter = StationFusionFilter(self.ir108,
                                         ir108=self.ir108,
                                         ir039=self.ir039,
                                         lowcloudmask=self.lowcloudmask,
                                         elev=self.elev,
                                         bufrfile=testbufr,
                                         time=self.time,
                                         area=area_def)
        ret, mask = testfilter.apply()

        # Evaluate results
        self.assertEqual(testfilter.visarr.shape, (141, 298))
        self.assertEqual(np.sum(~testfilter.fogmask), 20)
        self.assertEqual(np.sum(~testfilter.nofogmask), 181)
Beispiel #2
0
 def test_fusion_filter_dem_interpolation(self):
     # Create fusion filter
     testfilter = StationFusionFilter(self.ir108,
                                      ir108=self.ir108,
                                      ir039=self.ir039,
                                      lowcloudmask=self.lowcloudmask,
                                      elev=self.elev,
                                      bufrfile=testbufr,
                                      time=self.time,
                                      area=area_def,
                                      plot=False,
                                      save=True,
                                      resize=5)
     ret, mask = testfilter.apply()
     # Evaluate results
     np.testing.assert_array_equal(ret, self.ir108)
Beispiel #3
0
 def test_fusion_validation(self):
     # Create fusion filter
     lowcluster, nlowclst = ndimage.label(self.test_cloudmask)
     valid = StationFusionFilter.validate_fogmask(self.test_stations,
                                                  self.test_nostations,
                                                  lowcluster, nlowclst,
                                                  True, elev=self.test_elev)
     # Evaluate results
     self.assertEqual(np.sum(valid[0]), 0)
     self.assertEqual(np.sum(valid[1]), 1)
     self.assertEqual(np.sum(valid[2]), 1)
     self.assertEqual(np.sum(valid[3]), 0)
Beispiel #4
0
 def test_fusion_filter_dem_merge(self):
     # Create fusion filter
     testfilter = StationFusionFilter(self.ir108,
                                      ir108=self.ir108,
                                      ir039=self.ir039,
                                      lowcloudmask=testfogmask,
                                      elev=self.elev,
                                      bufrfile=testbufr,
                                      time=self.time,
                                      area=area_def)
     # No cloud mask
     nomask, novalid = testfilter.interpolate_dem(self.test_stations,
                                                  self.test_elev, 50)
     noother, novalido = testfilter.interpolate_dem(self.test_stations_valid,
                                                    self.test_elev, 50)
     # With cloud mask
     mask, valid = testfilter.interpolate_dem(self.test_stations,
                                              self.test_elev, 50,
                                              self.test_cloudmask)
     other, valido = testfilter.interpolate_dem(self.test_stations_valid,
                                                self.test_elev, 50,
                                                self.test_cloudmask)
     nomaskmerge = nomask & (novalid >= novalido)
     othermerge = ~noother & (novalido >= novalid)
     # Evaluate results
     self.assertEqual(np.sum(nomaskmerge), 4)
     self.assertEqual(np.sum(othermerge), 5)
Beispiel #5
0
 def test_dem_interpolation_valid(self):
     # Create fusion filter
     testfilter = StationFusionFilter(self.ir108,
                                      ir108=self.ir108,
                                      ir039=self.ir039,
                                      lowcloudmask=testfogmask,
                                      elev=self.elev,
                                      bufrfile=testbufr,
                                      time=self.time,
                                      area=area_def)
     # No cloud mask
     nomask, novalid = testfilter.interpolate_dem(self.test_stations,
                                                  self.test_elev, 50)
     noother, novalido = testfilter.interpolate_dem(self.test_stations_valid,
                                                    self.test_elev, 50)
     # With cloud mask
     mask, valid = testfilter.interpolate_dem(self.test_stations,
                                              self.test_elev, 50,
                                              self.test_cloudmask)
     other, valido = testfilter.interpolate_dem(self.test_stations_valid,
                                                self.test_elev, 50,
                                                self.test_cloudmask)
     # Evaluate results
     self.assertEqual(np.sum(~nomask), 4)
     self.assertEqual(np.sum(novalid), 4)
     self.assertEqual(np.sum(~noother), 5)
     self.assertEqual(np.sum(novalido), 11)
     self.assertEqual(np.sum(~mask), 1)
     self.assertEqual(np.sum(valid), 1)
     self.assertEqual(np.sum(~other), 2)
     self.assertEqual(np.sum(valido), 5)
Beispiel #6
0
 def test_dem_interpolation_method(self):
     # Create fusion filter
     testfilter = StationFusionFilter(self.ir108,
                                      ir108=self.ir108,
                                      ir039=self.ir039,
                                      lowcloudmask=testfogmask,
                                      elev=self.elev,
                                      bufrfile=testbufr,
                                      time=self.time,
                                      area=area_def)
     nomask, validno = testfilter.interpolate_dem(self.test_stations,
                                                  self.test_elev, 50)
     nomask200, validno200 = testfilter.interpolate_dem(self.test_stations,
                                                        self.test_elev, 200)
     mask, valid = testfilter.interpolate_dem(self.test_stations,
                                              self.test_elev,
                                              50, self.test_cloudmask)
     mask200, valid200 = testfilter.interpolate_dem(self.test_stations,
                                                    self.test_elev, 200,
                                                    self.test_cloudmask)
     # Evaluate results
     self.assertEqual(np.sum(~nomask), 4)
     self.assertEqual(np.sum(~nomask200), 6)
     self.assertEqual(np.sum(~mask), 1)
     self.assertEqual(np.sum(~mask200), 2)