def test_run_total_column_water_vapour(self): self.dataset = xr.Dataset() data = DefaultData.create_default_array_3d(3, 3, 11, np.float32, fill_value=np.NaN) data[0, :, :] = 11.52932 data[1, :, :] = 11.529235 data[2, :, :] = 11.52744 self.dataset["amsre.nwp.log_surface_pressure"] = Variable( ["matchup_count", "ny", "nx"], data) data = DefaultData.create_default_array_4d(3, 3, 60, 11, np.float32, fill_value=np.NaN) data[0, :, 1, 1] = np.float32( np.array([ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.3609621E-8, 3.7061102E-7, 4.273528E-6, 2.6397798E-5, 3.5652188E-6, 1.5417224E-4, 1.9648654E-4, 9.139678E-5, 8.232285E-6, 6.5089694E-7, 4.0974975E-9, 0.0 ])) data[1, :, 1, 1] = np.float32( np.array([ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0075588E-7, 1.054102E-6, 1.1424428E-5, 2.2602183E-6, 1.546818E-4, 1.9482679E-4, 8.667531E-5, 4.7594845E-6, 2.708914E-9, 0.0, 0.0 ])) data[2, :, 1, 1] = np.float32( np.array([ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.7519864E-9, 4.7594305E-8, 1.3165399E-6, 1.2988783E-4, 8.855922E-6, 3.5680281E-7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ])) self.dataset["amsre.nwp.cloud_liquid_water"] = Variable( ["matchup_count", "cloud_layers", "ny", "nx"], data) prep_data = self.preprocessor.run(self.dataset) variable = prep_data.variables["amsre.nwp.total_column_liquid_water"] self.assertEqual((11, ), variable.shape) self.assertAlmostEqual(0.064784802, variable.data[0], 8) self.assertAlmostEqual(0.059696566, variable.data[1], 8) self.assertAlmostEqual(0.028990015, variable.data[2], 8)
def setUp(self): self.preprocessor = Preprocessor() self.dataset = xr.Dataset() data = DefaultData.create_default_array_3d(5, 5, 11, np.int8) self.dataset["amsre.nwp.log_surface_pressure"] = Variable( ["macwenameifdifferentlyhere", "ny_test", "nx_test"], data) data = DefaultData.create_default_array_4d(5, 5, 60, 11, np.float32, fill_value=np.NaN) self.dataset["amsre.nwp.cloud_liquid_water"] = Variable([ "macwenameifdifferentlyhere", "cloud_layers", "ny_test", "nx_test" ], data)