Commit 2bccdb7f authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added tests for ETRS/LAEA projection compatibility.

parent 720b54d9
......@@ -415,9 +415,11 @@ class COREG(object):
def _get_image_params(self):
self.ref = GeoArray_CoReg(self.params, 'ref')
self.shift = GeoArray_CoReg(self.params, 'shift')
assert prj_equal(self.ref.prj, self.shift.prj), \
'Input projections are not equal. Different projections are currently not supported. Got %s / %s.' \
% (get_proj4info(proj=self.ref.prj), get_proj4info(proj=self.shift.prj))
if not prj_equal(self.ref.prj, self.shift.prj):
raise RuntimeError(
'Input projections are not equal. Different projections are currently not supported. Got %s / %s.'
% (get_proj4info(proj=self.ref.prj), get_proj4info(proj=self.shift.prj)))
def _get_overlap_properties(self):
overlap_tmp = get_overlap_polygon(self.ref.poly, self.shift.poly, self.v)
......
......@@ -12,6 +12,7 @@ import numpy as np
from .cases import test_cases
from arosics import COREG
from geoarray import GeoArray
from py_tools_ds.geo.projection import EPSG2WKT
class COREG_GLOBAL_init(unittest.TestCase):
......@@ -172,6 +173,38 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
wp=test_cases['INTER1']['wp_close_to_edge'], ws=(256, 256)))
self.assertTrue(CR.success)
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)
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))
def test_shift_calculation_windowOutside(self):
"""Test if shift computation properly raises a ValueError if the given window position is outside of the image
overlap."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment