Commit 8c942e05 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed Tie_Point_Grid.to_PointShapefile(). Added tests for some functions...

Fixed Tie_Point_Grid.to_PointShapefile(). Added tests for some functions within Tie_Point_Grid. Updated version info.
parent c10a11c8
Pipeline #1530 passed with stages
in 2 minutes and 53 seconds
......@@ -611,11 +611,11 @@ class Tie_Point_Grid(object):
GDF2pass = GDF if not skip_nodata else GDF[GDF[skip_nodata_col] != self.outFillVal]
# replace boolean values (cannot be written)
GDF2pass = GDF2pass.replace(False, 0) # replace all booleans where column dtype is not np.bool but np.object
GDF2pass = GDF2pass.replace(True, 1)
for col in GDF2pass.columns:
if GDF2pass[col].dtype == np.bool:
GDF2pass[col] = GDF2pass[col].astype(int)
GDF2pass = GDF2pass.replace(False, 0) # replace all remaining booleans where dtype is not np.bool but np.object
GDF2pass = GDF2pass.replace(True, 1)
path_out = path_out if path_out else \
get_generic_outpath(dir_out=os.path.join(self.dir_out, 'CoRegPoints'),
......
......@@ -12,8 +12,8 @@ from arosics.Tie_Point_Grid import Tie_Point_Grid
__author__ = """Daniel Scheffler"""
__email__ = 'daniel.scheffler@gfz-potsdam.de'
__version__ = '0.6.7'
__versionalias__ = '2017-11-15_01'
__version__ = '0.6.8'
__versionalias__ = '2017-11-16_01'
__all__ = ['COREG',
'COREG_LOCAL',
'DESHIFTER',
......
......@@ -28,7 +28,7 @@ test_requirements = requirements + ['coverage', 'nose', 'nose-htmloutput', 'redn
setup(
name='arosics',
version='0.6.7',
version='0.6.8',
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",
......
......@@ -4,6 +4,9 @@
"""Tests for the module arosics.Tie_Point_Grid."""
import unittest
import tempfile
import os
from importlib import util
# custom
from .cases import test_cases
......@@ -51,24 +54,32 @@ class Test_Tie_Point_Grid(unittest.TestCase):
def test_plot_shift_distribution(self):
self.TPG.plot_shift_distribution()
@unittest.SkipTest
def test_dump_CoRegPoints_table(self):
raise NotImplementedError()
with tempfile.TemporaryDirectory() as tmpdir:
outpath = os.path.join(tmpdir, 'CoRegPoints_table.pkl')
self.TPG.dump_CoRegPoints_table(outpath)
self.assertTrue(os.path.isfile(outpath))
def test_to_GCPList(self):
self.TPG.to_GCPList()
@unittest.SkipTest
def test_to_PointShapefile(self):
# TODO requires to delete output later
self.TPG.to_PointShapefile()
with tempfile.TemporaryDirectory() as tmpdir:
outpath = os.path.join(tmpdir, 'test_out_shapefile.shp')
self.TPG.to_PointShapefile(outpath)
self.assertTrue(os.path.isfile(outpath))
@unittest.SkipTest
def test_to_vectorfield(self):
# TODO requires to delete output later
self.TPG.to_vectorfield()
with tempfile.TemporaryDirectory() as tmpdir:
outpath = os.path.join(tmpdir, 'test_vectorfield.bsq')
self.TPG.to_vectorfield(outpath, fmt='ENVI', mode='md')
self.assertTrue(os.path.isfile(outpath))
self.TPG.to_vectorfield(outpath, fmt='ENVI', mode='uv')
self.assertTrue(os.path.isfile(outpath))
@unittest.SkipTest
def test_to_Raster_using_Kriging(self):
# TODO requires to delete output later
self.TPG.to_Raster_using_Kriging(attrName='X_SHIFT_MAP')
if util.find_spec('pykrige.ok'):
with tempfile.TemporaryDirectory() as tmpdir:
outpath = os.path.join(tmpdir, 'X_SHIFT_M__interpolated.bsq')
self.TPG.to_Raster_using_Kriging(attrName='X_SHIFT_M', fName_out=outpath)
self.assertTrue(os.path.isfile(outpath))
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