The function interpolate()
|
def interpolate(x_query, x_lower, x_upper, y_lower, y_upper): |
does not check bounds for the query parameter, and so it also extrapolates.
While extrapolating can be useful and intended in some cases, the current implementation makes it hard to spot mistakes, as there are cases where one only wants to interpolate (e.g. cyclic signals, such as tide correction). A bug resulting in querying outside the bounds would go unnoticed with the current implementation, leading to wrong results
Suggestion: add a parameter allow_extrapolation with a default False and set it to true in the function calls that need extrapolation
The function
interpolate()oplab_pipeline/src/auv_nav/tools/interpolate.py
Line 18 in 289075c
does not check bounds for the query parameter, and so it also extrapolates.
While extrapolating can be useful and intended in some cases, the current implementation makes it hard to spot mistakes, as there are cases where one only wants to interpolate (e.g. cyclic signals, such as tide correction). A bug resulting in querying outside the bounds would go unnoticed with the current implementation, leading to wrong results
Suggestion: add a parameter
allow_extrapolationwith a defaultFalseand set it totruein the function calls that need extrapolation