When use map_coordinates
, you need transpose the array or change you coordinates to (y, x) format, because the shape of the array is (height, width)
.
from scipy.ndimage.interpolation import map_coordinates
from mpl_toolkits.basemap import interp
import numpy
in_data = numpy.array([[ 25.89125824, 25.88840675],[ 25.90930748, 25.90640068]], dtype=numpy.float32)
print map_coordinates(in_data.T, [[0.0],[0.125]], order=1, mode='nearest')
print interp(in_data, numpy.array([0,1]), numpy.array([0,1]), numpy.array([0.0]), numpy.array([0.125]), order=1)
This will output:
[ 25.89351463]
[ 25.89351439]