Exemple #1
0
    def test_calculation_of_tie_point_grid_float_coords(self):
        # NOTE: This does not test against unequaly sized output of get_image_windows_to_match().

        # overwrite gt and prj
        ref = GeoArray(self.ref_path)
        ref.to_mem()
        ref.filePath = None
        tgt = GeoArray(self.tgt_path)
        tgt.to_mem()
        tgt.filePath = None

        ref.gt = [
            330000.19999996503, 10.00000001, 0.0, 5862000.7999997628, 0.0,
            -10.00000001
        ]
        # ref.gt = [330000.1, 10.1, 0.0, 5862000.1, 0.0, -10.1]
        tgt.gt = [
            335440.19999996503, 10.00000001, 0.0, 5866490.7999997628, 0.0,
            -10.00000001
        ]
        # tgt.gt = [330000.1, 10.1, 0.0, 5862000.1, 0.0, -10.1]

        # get instance of COREG_LOCAL object
        CRL = COREG_LOCAL(ref, tgt, **dict(CPUs=32, **self.coreg_kwargs))
        CRL.calculate_spatial_shifts()
Exemple #2
0
    def test_shift_calculation_noWGS84(self):
        """Test if shift computation properly raises a RunTimeError if the matching window is centered at a cloudy
        image position.
        """

        ref = GeoArray(self.ref_path).to_mem()
        tgt = GeoArray(self.tgt_path).to_mem()

        # force to overwrite projection
        ref.filePath = None
        tgt.filePath = None
        ref.prj = EPSG2WKT(3035)  # ETRS89_LAEA_Europe
        tgt.prj = EPSG2WKT(3035)  # ETRS89_LAEA_Europe

        CR = self.run_shift_detection_correction(ref, tgt, **dict(self.coreg_kwargs))
        self.assertTrue(CR.success)
Exemple #3
0
    def test_shift_calculation_nonquadratic_pixels(self):
        """Test with default parameters - should compute X/Y shifts properly and write the de-shifted target image."""

        # overwrite gt and prj
        ref = GeoArray(self.ref_path)
        ref.to_mem()
        ref.filePath = None
        ref.gt = [330000.00000001, 5.8932, 0.0, 5862000.0000001, 0.0, -10.1]
        tgt = GeoArray(self.tgt_path)
        tgt.to_mem()
        tgt.filePath = None
        tgt.gt = [335440.0000001, 5.8933, 0.0, 5866490.0000001, 0.0, -10.1]

        CR = self.run_shift_detection_correction(ref, tgt,
                                                 **dict(self.coreg_kwargs,
                                                        wp=(341500.0, 5861440.0),
                                                        footprint_poly_ref=None,
                                                        footprint_poly_tgt=None))
        self.assertTrue(CR.success)
Exemple #4
0
    def test_shift_calculation_with_image_coords_only(self):
        """Test with default parameters - should compute X/Y shifts properly and write the de-shifted target image."""
        # FIXME fails when executed alone

        # overwrite gt and prj
        ref = GeoArray(self.ref_path)
        ref.to_mem()
        ref.filePath = None
        ref.gt = [0, 1, 0, 0, 0, -1]
        ref.prj = ''
        tgt = GeoArray(self.tgt_path)
        tgt.to_mem()
        tgt.filePath = None
        tgt.gt = [0, 1, 0, 0, 0, -1]
        tgt.prj = ''

        CR = self.run_shift_detection_correction(ref, tgt,
                                                 **dict(self.coreg_kwargs,
                                                        wp=(1200, -1600),
                                                        footprint_poly_ref=None,
                                                        footprint_poly_tgt=None))
        self.assertTrue(CR.success)
Exemple #5
0
    def test_shift_calculation_different_geographic_datum(self):
        """Test if shift computation properly raises a RunTimeError if the matching window is centered at a cloudy
        image position.
        """

        ref = GeoArray(self.ref_path).to_mem()
        tgt = GeoArray(self.tgt_path).to_mem()

        # force to overwrite projection
        ref.filePath = None
        ref.prj = EPSG2WKT(3035)  # ETRS89_LAEA_Europe

        with self.assertRaises(RuntimeError):
            self.run_shift_detection_correction(ref, tgt, **dict(self.coreg_kwargs))