Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
a6a86d10
Commit
a6a86d10
authored
Jan 24, 2017
by
Daniel Scheffler
Browse files
Bugfix
numeric.vector.find_nearest: bugfix - updated __version__
parent
0e65b721
Changes
2
Hide whitespace changes
Inline
Side-by-side
ptds/__init__.py
View file @
a6a86d10
...
...
@@ -15,7 +15,7 @@ __all__=[#'compatibility',
'similarity'
,
'GeoArray'
]
__version__
=
'2017012
3
_01'
__version__
=
'2017012
4
_01'
__author__
=
'Daniel Scheffler'
# Validate GDAL version
...
...
ptds/numeric/vector.py
View file @
a6a86d10
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment