Commit 911d341b authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Revised test cases and added test case for global co-registration. Bugfix for...

Revised test cases and added test case for global co-registration. Bugfix for unexpected FFTW return value that caused the matching to fail.

updated __version__ and __versionalias__
parent 19d5b92b
Pipeline #396 passed with stages
in 7 minutes and 27 seconds
......@@ -861,7 +861,9 @@ class COREG(object):
fft_arr1 = pyfftw.FFTW(in_arr1,np.empty_like(in_arr1), axes=(0,1))()
# catch empty output arrays (for some reason this happens sometimes..) -> use numpy fft
if self.fftw_works is None and (np.std(fft_arr0)==0 or np.std(fft_arr1)==0):
# => this is caused by the call of pyfftw.FFTW. Exactly in that moment the input array in_arr0 is
# overwritten with zeros (maybe this is a bug in pyFFTW?)
if self.fftw_works in [None, True] and (np.std(fft_arr0)==0 or np.std(fft_arr1)==0):
self.fftw_works = False
# recreate input arrays and use numpy fft as fallback
in_arr0 = im0[ymin:ymax, xmin:xmax].astype(precision)
......
......@@ -4,8 +4,8 @@
__author__ = """Daniel Scheffler"""
__email__ = 'daniel.scheffler@gfz-potsdam.de'
__version__ = '0.4.4'
__versionalias__ = '2017-07-07_07'
__version__ = '0.4.7'
__versionalias__ = '2017-07-07_08'
from .CoReg import COREG
......
......@@ -26,7 +26,7 @@ test_requirements = ['coverage']
setup(
name='arosics',
version='0.4.6',
version='0.4.7',
description="An Automated and Robust Open-Source Image Co-Registration Software for Multi-Sensor Satellite Data",
long_description=readme + '\n\n' + history,
author="Daniel Scheffler",
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
# custom
import arosics
tests_path = os.path.abspath(os.path.join(arosics.__file__,"../../tests"))
# define test data pathes
test_cases = dict(
INTER1=dict(
ref_path = os.path.join(tests_path, 'data/testcase_inter1_S2A_S2A/ref_S2A_20160608T153121_T33UUU_sub.jp2'),
tgt_path = os.path.join(tests_path, 'data/testcase_inter1_S2A_S2A/tgt_S2A_20160529T153631_T33UUU_sub.jp2'),
kwargs_global = dict(
progress = False,
v = 0),
wp_inside = (344720, 5848485),# (344932, 5842974), # inside of overlap
wp_outside = (349533, 5818862), # outside of overlap
kwargs_local = dict(
grid_res = 100,
progress = False)
)
)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the global co-registration module of AROSICS."""
import unittest
# custom
from .cases import test_cases
from arosics import COREG
from geoarray import GeoArray
class COREG_GLOBAL_init(unittest.TestCase):
"""Test case on object initialization of COREG_LOCAL."""
def setUp(self):
self.ref_path = test_cases['INTER1']['ref_path']
self.tgt_path = test_cases['INTER1']['tgt_path']
self.coreg_kwargs = test_cases['INTER1']['kwargs_global']
self.coreg_kwargs['wp'] = test_cases['INTER1']['wp_inside']
def test_coreg_init_from_disk(self):
self.CRL = COREG(self.ref_path, self.tgt_path, **self.coreg_kwargs)
def test_coreg_init_from_inMem_GeoArray(self):
# get GeoArray instances
self.ref_gA = GeoArray(self.ref_path)
self.tgt_gA = GeoArray(self.tgt_path)
# assure the raster data are in-memory
self.ref_gA.to_mem()
self.tgt_gA.to_mem()
# get instance of COREG_LOCAL object
self.CRL = COREG(self.ref_gA, self.tgt_gA, **self.coreg_kwargs)
class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
"""Test case for the complete workflow of global co-registration based on two Sentinel-2 datasets, one with
~25% cloud cover, the other one without any clouds. The subsets cover the S2A tiles only partly (nodata areas
are present).
"""
def setUp(self):
self.ref_path = test_cases['INTER1']['ref_path']
self.tgt_path = test_cases['INTER1']['tgt_path']
self.coreg_kwargs = test_cases['INTER1']['kwargs_global']
self.coreg_kwargs['wp'] = test_cases['INTER1']['wp_inside']
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_calculation_of_tie_point_grid(self):
# get instance of COREG_LOCAL object
CR = COREG(self.ref_path, self.tgt_path, **self.coreg_kwargs)
# calculate global X/Y shift
CR.calculate_spatial_shifts()
# test shift correction and output writer
CR.correct_shifts()
# TODO test writer (path_out is by now not passed)
......@@ -5,26 +5,12 @@
import unittest
import os
# custom
import arosics
from .cases import test_cases
from arosics import COREG_LOCAL
from geoarray import GeoArray
tests_path = os.path.abspath(os.path.join(arosics.__file__,"../../tests"))
# define test data pathes
test_cases = dict(
INTER1=dict(
ref_path = os.path.join(tests_path, 'data/testcase_inter1_S2A_S2A/ref_S2A_20160608T153121_T33UUU_sub.jp2'),
tgt_path = os.path.join(tests_path, 'data/testcase_inter1_S2A_S2A/tgt_S2A_20160529T153631_T33UUU_sub.jp2'),
kwargs = dict(
grid_res = 100,
progress = False)
)
)
class COREG_LOCAL_init(unittest.TestCase):
......@@ -33,7 +19,7 @@ class COREG_LOCAL_init(unittest.TestCase):
def setUp(self):
self.ref_path = test_cases['INTER1']['ref_path']
self.tgt_path = test_cases['INTER1']['tgt_path']
self.coreg_kwargs = test_cases['INTER1']['kwargs']
self.coreg_kwargs = test_cases['INTER1']['kwargs_local']
def test_coreg_init_from_disk(self):
self.CRL = COREG_LOCAL(self.ref_path, self.tgt_path, **self.coreg_kwargs)
......@@ -60,7 +46,7 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
def setUp(self):
self.ref_path = test_cases['INTER1']['ref_path']
self.tgt_path = test_cases['INTER1']['tgt_path']
self.coreg_kwargs = test_cases['INTER1']['kwargs']
self.coreg_kwargs = test_cases['INTER1']['kwargs_local']
def tearDown(self):
"""Tear down test fixtures, if any."""
......
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