def test_run(self): dataset = xr.Dataset() for i in range(0, len(self.BT_VARIABLE_NAMES)): data = DefaultData.create_default_vector(13, np.float32, fill_value=26) dataset[self.BT_VARIABLE_NAMES[i]] = Variable(["matchup"], data) bt_bias_correction = BtBiasCorrection() bt_bias_correction.run(dataset) self.assertAlmostEqual( 26.3524, dataset["amsre.brightness_temperature6V"].data[0], 6) self.assertAlmostEqual( 26.0793, dataset["amsre.brightness_temperature6H"].data[1], 6) self.assertAlmostEqual( 25.8907, dataset["amsre.brightness_temperature10V"].data[2], 5) self.assertAlmostEqual( 25.2479, dataset["amsre.brightness_temperature10H"].data[3], 6) self.assertAlmostEqual( 26.6228, dataset["amsre.brightness_temperature18V"].data[4], 5) self.assertAlmostEqual( 26.2794, dataset["amsre.brightness_temperature18H"].data[5], 6) self.assertAlmostEqual( 26.02, dataset["amsre.brightness_temperature23V"].data[6], 5) self.assertAlmostEqual( 25.7331, dataset["amsre.brightness_temperature23H"].data[7], 5) self.assertAlmostEqual( 25.646, dataset["amsre.brightness_temperature36V"].data[8], 6) self.assertAlmostEqual( 26.1464, dataset["amsre.brightness_temperature36H"].data[9], 5)
def _create_vector_float32_variable(num_matchups): array = DefaultData.create_default_vector(num_matchups, np.float32, fill_value=np.NaN) variable = Variable(["matchup"], array) variable.attrs["_FillValue"] = np.NaN return variable
def test_create_T_A(self): dataset = xr.Dataset() for i in range(0, len(self.BT_VARIABLE_NAMES)): data = DefaultData.create_default_vector(13, np.float32, fill_value=i * 10) dataset[self.BT_VARIABLE_NAMES[i]] = Variable(["matchup_count"], data) T_A = self.retrieval.create_T_A(dataset) self.assertAlmostEqual(0, T_A[0, 0], 8) self.assertAlmostEqual(10, T_A[0, 1], 8) self.assertAlmostEqual(20, T_A[0, 2], 8) self.assertAlmostEqual(30, T_A[0, 3], 8) self.assertAlmostEqual(90, T_A[0, 9], 8)
def _create_vector_uint8_variable(num_matchups): array = DefaultData.create_default_vector(num_matchups, np.uint8) variable = Variable(["matchup"], array) variable.attrs["_FillValue"] = DefaultData.get_default_fill_value( np.uint8) return variable