Exemplo n.º 1
0
    def test_global_to_global(self):
        """Test coordinates generated when the input and output coordinate
        systems are the same, in this case Plate-Carree."""
        plugin = NeighbourSelection()
        x_points = np.array([0, 10, 20])
        y_points = np.array([0, 0, 10])
        expected = np.stack((x_points, y_points), axis=1)
        result = plugin._transform_sites_coordinate_system(
            x_points, y_points, self.global_orography)

        self.assertArrayAlmostEqual(result, expected)
Exemplo n.º 2
0
    def test_region_to_region(self):
        """Test coordinates generated when the input and output coordinate
        systems are the same, in this case Lambert Azimuthal Equal Areas."""
        plugin = NeighbourSelection(
            site_coordinate_system=self.region_projection.as_cartopy_crs())
        x_points = np.array([0, 1, 2])
        y_points = np.array([0, 0, 1])
        expected = np.stack((x_points, y_points), axis=1)
        result = plugin._transform_sites_coordinate_system(
            x_points, y_points, self.region_orography)

        self.assertArrayAlmostEqual(result, expected)
Exemplo n.º 3
0
 def test_global_to_region(self):
     """Test coordinates generated when transforming from a global to
     regional coordinate system, in this case PlateCarree to Lambert
     Azimuthal Equal Areas."""
     plugin = NeighbourSelection()
     x_points = np.array([0, 10, 20])
     y_points = np.array([0, 0, 10])
     expected = [[0., 0.], [1111782.53516264, 0.],
                 [2189747.33076441, 1121357.32401753]]
     result = plugin._transform_sites_coordinate_system(
         x_points, y_points, self.region_orography)
     self.assertArrayAlmostEqual(result, expected)
Exemplo n.º 4
0
 def test_region_to_global(self):
     """Test coordinates generated when transforming from a regional to
     global coordinate system, in this case Lambert Azimuthal Equal Areas
     to PlateCarree."""
     plugin = NeighbourSelection(
         site_coordinate_system=self.region_projection.as_cartopy_crs())
     x_points = np.array([0, 1, 2])
     y_points = np.array([0, 0, 1])
     expected = [[0., 0.], [8.98315284e-06, 0.],
                 [1.79663057e-05, 9.04369476e-06]]
     result = plugin._transform_sites_coordinate_system(
         x_points, y_points, self.global_orography)
     self.assertArrayAlmostEqual(result, expected)