コード例 #1
0
    def test_add_easy_fcdr_variables(self):
        delta_x = 16
        delta_y = 17
        ha = HIRSAssert()
        ds = xr.Dataset()
        HIRS4.add_easy_fcdr_variables(ds, 7, lut_size=24, corr_dx=delta_x, corr_dy=delta_y)

        ha.assert_easy_fcdr_uncertainties(ds, chunking=CHUNKING_3D)

        Assertions.assert_correlation_matrices(self, ds, NUM_CHANNELS)
        Assertions.assert_lookup_tables(self, ds, NUM_CHANNELS, 24)
        Assertions.assert_correlation_coefficients(self, ds, NUM_CHANNELS, delta_x, delta_y)
コード例 #2
0
    def test_add_easy_fcdr_variables(self):
        delta_x = 14
        delta_y = 15
        ha = HIRSAssert()
        ds = xr.Dataset()

        HIRS2.add_easy_fcdr_variables(ds, 7, lut_size=22, corr_dx=delta_x, corr_dy=delta_y)

        ha.assert_easy_fcdr_uncertainties(ds, chunking=(10, 7, 56))

        Assertions.assert_correlation_matrices(self, ds, NUM_CHANNELS)
        Assertions.assert_lookup_tables(self, ds, NUM_CHANNELS, 22)
        Assertions.assert_correlation_coefficients(self, ds, NUM_CHANNELS, delta_x, delta_y)
コード例 #3
0
ファイル: avhrr_test.py プロジェクト: gerritholl/FCDRTools
    def test_add_easy_fcdr_variables(self):
        ds = xr.Dataset()
        AVHRR.add_easy_fcdr_variables(ds,
                                      5,
                                      lut_size=LUT_SIZE,
                                      corr_dx=12,
                                      corr_dy=13)

        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_independent_Ch1",
            long_name="independent uncertainty per pixel for channel 1",
            units="percent",
            valid_min=10,
            valid_max=1000)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_structured_Ch1",
            long_name="structured uncertainty per pixel for channel 1",
            units="percent",
            valid_min=3,
            valid_max=5)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_common_Ch1",
            long_name="common uncertainty per pixel for channel 1",
            units="percent",
            valid_min=10,
            valid_max=1000)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_independent_Ch2",
            long_name="independent uncertainty per pixel for channel 2",
            units="percent",
            valid_min=10,
            valid_max=1000)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_structured_Ch2",
            long_name="structured uncertainty per pixel for channel 2",
            units="percent",
            valid_min=3,
            valid_max=5)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_common_Ch2",
            long_name="common uncertainty per pixel for channel 2",
            units="percent",
            valid_min=10,
            valid_max=1000)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_independent_Ch3a",
            long_name="independent uncertainty per pixel for channel 3a",
            units="percent",
            valid_min=10,
            valid_max=1000)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_structured_Ch3a",
            long_name="structured uncertainty per pixel for channel 3a",
            units="percent",
            valid_min=3,
            valid_max=5)
        self._assert_correct_refl_uncertainty_variable(
            ds,
            "u_common_Ch3a",
            long_name="common uncertainty per pixel for channel 3a",
            units="percent",
            valid_min=10,
            valid_max=1000)

        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_independent_Ch3b",
            long_name="independent uncertainty per pixel for channel 3b")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_structured_Ch3b",
            long_name="structured uncertainty per pixel for channel 3b")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_common_Ch3b",
            long_name="common uncertainty per pixel for channel 3b")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_independent_Ch4",
            long_name="independent uncertainty per pixel for channel 4")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_structured_Ch4",
            long_name="structured uncertainty per pixel for channel 4")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_common_Ch4",
            long_name="common uncertainty per pixel for channel 4")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_independent_Ch5",
            long_name="independent uncertainty per pixel for channel 5")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_structured_Ch5",
            long_name="structured uncertainty per pixel for channel 5")
        self._assert_correct_bt_uncertainty_variable(
            ds,
            "u_common_Ch5",
            long_name="common uncertainty per pixel for channel 5")

        Assertions.assert_correlation_matrices(self, ds, NUM_CHANNELS)
        Assertions.assert_lookup_tables(self, ds, NUM_CHANNELS, LUT_SIZE)
        Assertions.assert_correlation_coefficients(self, ds, NUM_CHANNELS, 12,
                                                   13)
コード例 #4
0
    def test_add_easy_fcdr_variables(self):
        delta_x = 17
        delta_y = 18

        ds = xr.Dataset()
        MVIRI.add_easy_fcdr_variables(ds,
                                      8,
                                      lut_size=37,
                                      corr_dx=delta_x,
                                      corr_dy=delta_y)

        reflectance = ds.variables["toa_bidirectional_reflectance_vis"]
        self.assertEqual((5000, 5000), reflectance.shape)
        self.assertTrue(np.isnan(reflectance.data[3, 115]))
        self.assertEqual("toa_bidirectional_reflectance_vis",
                         reflectance.attrs["standard_name"])
        self.assertEqual(
            "top of atmosphere bidirectional reflectance factor per pixel of the visible band with central wavelength 0.7",
            reflectance.attrs["long_name"])
        self.assertEqual("1", reflectance.attrs["units"])
        self.assertEqual(np.uint16, reflectance.encoding['dtype'])
        self.assertEqual(DefaultData.get_default_fill_value(np.uint16),
                         reflectance.encoding['_FillValue'])
        self.assertEqual(3.05176E-05, reflectance.encoding['scale_factor'])
        self.assertEqual(0.0, reflectance.encoding['add_offset'])
        self.assertEqual(CHUNKING, reflectance.encoding["chunksizes"])

        u_indep = ds.variables["u_independent_toa_bidirectional_reflectance"]
        self.assertEqual((5000, 5000), u_indep.shape)
        self.assertTrue(np.isnan(u_indep.data[118, 234]))
        self.assertEqual("independent uncertainty per pixel",
                         u_indep.attrs["long_name"])
        self.assertEqual("1", u_indep.attrs["units"])
        self.assertEqual(np.uint16, u_indep.encoding['dtype'])
        self.assertEqual(DefaultData.get_default_fill_value(np.uint16),
                         u_indep.encoding['_FillValue'])
        self.assertEqual(3.05176E-05, u_indep.encoding['scale_factor'])
        self.assertEqual(0.0, u_indep.encoding['add_offset'])
        self.assertEqual(CHUNKING, u_indep.encoding["chunksizes"])

        u_struct = ds.variables["u_structured_toa_bidirectional_reflectance"]
        self.assertEqual((5000, 5000), u_struct.shape)
        self.assertTrue(np.isnan(u_struct.data[119, 235]))
        self.assertEqual("structured uncertainty per pixel",
                         u_struct.attrs["long_name"])
        self.assertEqual("1", u_struct.attrs["units"])
        self.assertEqual(np.uint16, u_struct.encoding['dtype'])
        self.assertEqual(65535, u_struct.encoding['_FillValue'])
        self.assertEqual(3.05176E-05, u_struct.encoding['scale_factor'])
        self.assertEqual(0.0, u_struct.encoding['add_offset'])
        self.assertEqual(CHUNKING, u_struct.encoding["chunksizes"])

        self._assert_scalar_float_variable(
            ds, "u_common_toa_bidirectional_reflectance",
            "common uncertainty per slot", "1")

        self._assert_scalar_float_variable(
            ds, "sub_satellite_latitude_start",
            "Latitude of the sub satellite point at image start",
            "degrees_north")
        self._assert_scalar_float_variable(
            ds, "sub_satellite_longitude_start",
            "Longitude of the sub satellite point at image start",
            "degrees_east")
        self._assert_scalar_float_variable(
            ds, "sub_satellite_latitude_end",
            "Latitude of the sub satellite point at image end",
            "degrees_north")
        self._assert_scalar_float_variable(
            ds, "sub_satellite_longitude_end",
            "Longitude of the sub satellite point at image end",
            "degrees_east")

        Assertions.assert_correlation_matrices(self, ds, 3)

        channel = ds.coords["channel"]
        self.assertEqual((3, ), channel.shape)
        self.assertEqual("wv", channel[1])

        Assertions.assert_lookup_tables(self, ds, 3, 37)
        Assertions.assert_correlation_coefficients(self, ds, 3, delta_x,
                                                   delta_y)