Commit 80122871 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

SSIM now fails with a warning instead of raising an exception and forcing the...

SSIM now fails with a warning instead of raising an exception and forcing the whole coreg to fail. test_COREG.test_shift_calculation_with_image_coords_only: changed input gt.
parent 83b7087c
Pipeline #1297 failed with stages
in 12 minutes and 2 seconds
......@@ -1147,6 +1147,13 @@ class COREG(object):
matchWinData, _, _ = matchFull.get_mapPos(self.matchBox.mapPoly.bounds, self.matchWin.prj,
rspAlg='cubic', band2get=matchFull.band4match)
# output validation
if not matchWinData.shape == otherWin_deshift_geoArr.shape:
warnings.warn('SSIM input array shapes could not be equalized. SSIM calculation failed. SSIM of the '
'de-shifted target image is set to 0.')
self.ssim_deshifted = 0
return self.ssim_orig, self.ssim_deshifted
self.ssim_deshifted = calc_ssim(otherWin_deshift_geoArr[:], matchWinData, dynamic_range=dr)
if v:
......
......@@ -87,10 +87,12 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
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,
......
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