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

Bugfix

numeric.vector.find_nearest: bugfix

- updated __version__
parent 0e65b721
......@@ -15,7 +15,7 @@ __all__=[#'compatibility',
'similarity',
'GeoArray']
__version__ = '20170123_01'
__version__ = '20170124_01'
__author__='Daniel Scheffler'
# Validate GDAL version
......
......@@ -26,11 +26,11 @@ def find_nearest(array, value, roundAlg='auto', extrapolate=False, exclude_val=F
array.remove(value)
if extrapolate:
increment = array[1] - array[0]
increment = abs(array[1] - array[0])
if value > max(array): # expand array until value
array = np.arange(min(array), value + increment, increment)
if value < min(array): # negatively expand array until value
array = (np.arange(-max(array), value + increment, increment) * -1)[::-1]
array = (np.arange(max(array), value - increment, -increment))[::-1]
elif value < min(array) or value > max(array):
raise ValueError('Value %s is outside of the given array.' % value)
......
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