added ability to control degree of interpolation and whether or not extrapolation is allowed