def test_x_y(self): """Test that the function returns the lats and lons expected.""" expected_lats = np.array( [ [53.84618597, 53.99730779, 53.93247526], [56.82670954, 56.99111356, 56.9205672], [59.8045105, 59.98499383, 59.90752513], ] ) expected_lons = np.array( [ [-8.58580705, -3.51660018, 1.56242662], [-9.06131306, -3.59656346, 1.88105082], [-9.63368459, -3.69298822, 2.26497216], ] ) plugin = TemporalInterpolation( interval_in_minutes=60, interpolation_method="solar" ) result_lats, result_lons = plugin.calc_lats_lons(self.cube_equalarea) self.assertIsInstance(result_lats, np.ndarray) self.assertEqual(result_lats.shape, (3, 3)) self.assertIsInstance(result_lons, np.ndarray) self.assertEqual(result_lons.shape, (3, 3)) self.assertArrayAlmostEqual(result_lats, expected_lats) self.assertArrayAlmostEqual(result_lons, expected_lons)
def test_lat_lon(self): """Test that the function returns the lats and lons expected.""" expected_lons = np.array([[-20.0, 0.0, 20.0], [-20.0, 0.0, 20.0], [-20.0, 0.0, 20.0]]) expected_lats = np.array([[40.0, 40.0, 40.0], [60.0, 60.0, 60.0], [80.0, 80.0, 80.0]]) plugin = TemporalInterpolation(interval_in_minutes=60, interpolation_method='solar') result_lats, result_lons = plugin.calc_lats_lons(self.cube) self.assertIsInstance(result_lats, np.ndarray) self.assertEqual(result_lats.shape, (3, 3)) self.assertIsInstance(result_lons, np.ndarray) self.assertEqual(result_lons.shape, (3, 3)) self.assertArrayAlmostEqual(result_lats, expected_lats) self.assertArrayAlmostEqual(result_lons, expected_lons)