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

Merge branch 'bugfix/fix_float_coord_issue' into 'enhancement/minor_fixes'

Added tolerances to the window position validation to avoid float precision...

See merge request !7
parents 58dc8f49 a4acc938
Pipeline #11766 passed with stage
in 4 minutes and 39 seconds
......@@ -13,7 +13,7 @@ test_arosics:
script:
- source /root/miniconda3/bin/activate ci_env
- pip install "py_tools_ds>=0.14.28" # FIXME remove as soon as docker runner has been updated
- pip install "geoarray>=0.8.29" # FIXME remove as soon as docker runner has been updated
- pip install "geoarray>=0.8.30" # FIXME remove as soon as docker runner has been updated
# run tests
- make nosetests
......
......@@ -648,7 +648,7 @@ class COREG(object):
wp = (wp[0] if wp[0] else overlap_center_pos_x[0]), (wp[1] if wp[1] else overlap_center_pos_y[0])
# validate window position
if not self.overlap_poly.contains(Point(wp)):
if not self.overlap_poly.buffer(1e-5).contains(Point(wp)):
# in case the centroid point is not within overlap area
if not self.q:
warnings.warn("The centroid point of the two input images could not be used as matching window "
......@@ -660,11 +660,11 @@ class COREG(object):
overlap_center_pos_x, overlap_center_pos_y = self.overlap_poly.representative_point().coords.xy
wp = overlap_center_pos_x[0], overlap_center_pos_y[0]
assert self.overlap_poly.contains(Point(wp))
assert self.overlap_poly.buffer(1e-5).contains(Point(wp))
else:
# validate window position
if not self.overlap_poly.contains(Point(wp)):
if not self.overlap_poly.buffer(1e-5).contains(Point(wp)):
self._handle_error(ValueError('The provided window position %s/%s is outside of the overlap '
'area of the two input images. Check the coordinates.' % wp))
......@@ -767,7 +767,9 @@ class COREG(object):
if self.success is not False:
# check result -> ProgrammingError if not fulfilled
def within_equal(inner, outer): return inner.within(outer) or inner.equals(outer)
def within_equal(inner, outer):
return inner.within(outer.buffer(1e-5)) or inner.equals(outer)
assert within_equal(matchBox.mapPoly, otherBox.mapPoly)
assert within_equal(otherBox.mapPoly, overlapWin.mapPoly)
......
......@@ -40,7 +40,7 @@ with open("arosics/version.py") as version_file:
exec(version_file.read(), version)
requirements = ['numpy', 'gdal', 'shapely', 'scikit-image', 'matplotlib', 'geopandas', 'pandas',
'geoarray>=0.8.17', 'py_tools_ds>=0.14.28', 'plotly', 'cmocean', 'six', 'folium>=0.6.0', 'geojson'
'geoarray>=0.8.30', 'py_tools_ds>=0.14.28', 'plotly', 'cmocean', 'six', 'folium>=0.6.0', 'geojson'
# 'pykrige' # conda install --yes -c conda-forge pykrige
# 'pyfftw', # conda install --yes -c conda-forge pyfftw=0.10.4 ; \
# 'basemap', # conda install --yes -c conda-forge basemap; \
......
......@@ -45,5 +45,5 @@ dependencies:
- coverage
- rednose
- plotly
- geoarray>=0.8.17
- geoarray>=0.8.30
- py_tools_ds>=0.14.28
......@@ -106,15 +106,18 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
ref = GeoArray(self.ref_path)
ref.to_mem()
ref.filePath = None
ref.gt = [330000.19999996503, 0.6, 0.0, 5862000.7999997628, 0.0, -0.6]
# ref.gt = [330000.1, 10.1, 0.0, 5862000.1, 0.0, -10.1]
tgt = GeoArray(self.tgt_path)
tgt.to_mem()
tgt.filePath = None
tgt.gt = [330000.19999996503, 0.6, 0.0, 5862000.7999997628, 0.0, -0.6]
ref.gt = [330000.19999996503, 10.00000001, 0.0, 5862000.7999997628, 0.0, -10.00000001]
# ref.gt = [330000.1, 10.1, 0.0, 5862000.1, 0.0, -10.1]
tgt.gt = [335440.19999996503, 10.00000001, 0.0, 5866490.7999997628, 0.0, -10.00000001]
# tgt.gt = [330000.1, 10.1, 0.0, 5862000.1, 0.0, -10.1]
# get instance of COREG_LOCAL object
CRL = COREG_LOCAL(ref, tgt, **dict(**self.coreg_kwargs))
CRL = COREG_LOCAL(ref, tgt, **dict(CPUs=32,
**self.coreg_kwargs))
# use the getter of the CoRegPoints_table to calculate tie point grid
# noinspection PyStatementEffect
......
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