示例#1
0
    def test_get_output_xy(self):
        """Test calculation of output xy-coordinates."""
        from pyresample.bilinear import _get_output_xy
        from pyresample._spatial_mp import Proj

        proj = Proj(self.target_def.proj_str)
        out_x, out_y = _get_output_xy(self.target_def, proj)
        self.assertTrue(out_x.all())
        self.assertTrue(out_y.all())
示例#2
0
 def test_get_bounding_corners(self):
     proj = Proj(self.target_def.proj4_string)
     out_x, out_y = bil._get_output_xy(self.target_def, proj)
     in_x, in_y = bil._get_input_xy(self.swath_def, proj, self.input_idxs,
                                    self.idx_ref)
     res = bil._get_bounding_corners(in_x, in_y, out_x, out_y,
                                     self.neighbours, self.idx_ref)
     for i in range(len(res) - 1):
         pt_ = res[i]
         for j in range(2):
             # Only the sixth output location has four valid corners
             self.assertTrue(np.isfinite(pt_[5, j]))
示例#3
0
 def test_get_bounding_corners(self):
     proj = Proj(self.target_def.proj_str)
     out_x, out_y = bil._get_output_xy(self.target_def, proj)
     in_x, in_y = bil._get_input_xy(self.swath_def, proj,
                                    self.input_idxs, self.idx_ref)
     res = bil._get_bounding_corners(in_x, in_y, out_x, out_y,
                                     self.neighbours, self.idx_ref)
     for i in range(len(res) - 1):
         pt_ = res[i]
         for j in range(2):
             # Only the sixth output location has four valid corners
             self.assertTrue(np.isfinite(pt_[5, j]))
示例#4
0
    def test_get_bounding_corners(self):
        """Test calculation of bounding corners."""
        from pyresample.bilinear import (_get_output_xy, _get_input_xy,
                                         _get_bounding_corners)
        from pyresample._spatial_mp import Proj

        proj = Proj(self.target_def.proj_str)
        out_x, out_y = _get_output_xy(self.target_def, proj)
        in_x, in_y = _get_input_xy(self.swath_def, proj, self.input_idxs,
                                   self.idx_ref)
        res = _get_bounding_corners(in_x, in_y, out_x, out_y, self.neighbours,
                                    self.idx_ref)
        for i in range(len(res) - 1):
            pt_ = res[i]
            for j in range(2):
                # Only the sixth output location has four valid corners
                self.assertTrue(np.isfinite(pt_[5, j]))
示例#5
0
    def test_get_four_closest_corners(self):
        """Test calculation of bounding corners."""
        from pyresample.bilinear import (_get_output_xy, _get_input_xy,
                                         _get_four_closest_corners)
        from pyresample._spatial_mp import Proj

        proj = Proj(self.target_def.proj_str)
        out_x, out_y = _get_output_xy(self.target_def)
        in_x, in_y = _get_input_xy(self.source_def, proj, self.input_idxs,
                                   self.idx_ref)
        (pt_1, pt_2, pt_3,
         pt_4), ia_ = _get_four_closest_corners(in_x, in_y, out_x, out_y,
                                                self._neighbours, self.idx_ref)

        self.assertTrue(pt_1.shape == pt_2.shape == pt_3.shape == pt_4.shape ==
                        (self.target_def.size, 2))
        self.assertTrue(ia_.shape == (self.target_def.size, 4))

        # Check which of the locations has four valid X/Y pairs by
        # finding where there are non-NaN values
        res = np.sum(pt_1 + pt_2 + pt_3 + pt_4, axis=1)
        self.assertEqual(np.sum(~np.isnan(res)), 10)
示例#6
0
 def test_get_input_xy(self):
     proj = Proj(self.target_def.proj4_string)
     in_x, in_y = bil._get_output_xy(self.swath_def, proj)
     self.assertTrue(in_x.all())
     self.assertTrue(in_y.all())
示例#7
0
 def test_get_output_xy(self):
     proj = Proj(self.target_def.proj4_string)
     out_x, out_y = bil._get_output_xy(self.target_def, proj)
     self.assertTrue(out_x.all())
     self.assertTrue(out_y.all())
示例#8
0
 def test_get_input_xy(self):
     proj = Proj(self.target_def.proj_str)
     in_x, in_y = bil._get_output_xy(self.swath_def, proj)
     self.assertTrue(in_x.all())
     self.assertTrue(in_y.all())
示例#9
0
 def test_get_output_xy(self):
     proj = Proj(self.target_def.proj_str)
     out_x, out_y = bil._get_output_xy(self.target_def, proj)
     self.assertTrue(out_x.all())
     self.assertTrue(out_y.all())