Commit 3e61aa76 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added two test cases for local co-registration and the respective test data.

parent 798b46a9
Pipeline #378 failed with stages
in 3 minutes and 42 seconds
......@@ -1520,5 +1520,6 @@ python arosics.py local /path/to/your/ref_image.bsq /path/to/your/tgt_image.bsq
# Credits
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the
[audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
[audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
The test data represent modified Copernicus Sentinel data (2016).
......@@ -64,6 +64,7 @@ Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
The test data represent modified Copernicus Sentinel data (2016).
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the local co-registration module of AROSICS."""
import unittest
import os
# custom
import arosics
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)
)
)
class COREG_LOCAL_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']
def test_coreg_init_from_disk(self):
self.CRL = COREG_LOCAL(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_LOCAL(self.ref_gA, self.tgt_gA, **self.coreg_kwargs)
class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
"""Test case for the complete workflow of local 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']
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_calculation_of_tie_point_grid(self):
# get instance of COREG_LOCAL object
CRL = COREG_LOCAL(self.ref_path, self.tgt_path, **self.coreg_kwargs)
# use the getter of the CoRegPoints_table to calculate tie point grid
TPG = CRL.CoRegPoints_table
# test tie point grid visualization
CRL.view_CoRegPoints()
# test shift correction and output writer
CRL.correct_shifts()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `arosics` package."""
import unittest
from arosics import COREG
from arosics import COREG_LOCAL
class TestArosics(unittest.TestCase):
"""Tests for `arosics` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_000_something(self):
"""Test something."""
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