interp1 Interface

public interface interp1

Generic interface to interp1 function

The interp function interpolates given table of values to given query points. The generic interface is

yi = interp1(x, y, xi, method, extrap)

where

  • x is rank 1 array of sample points in ascending order
  • y is rank 1 or 2 array of values, for rank 2 array with elements y(i,j) the index i corresponds to vector component and j is the index of sample point, i.e. size(x) == size(y,2)
  • xi is scalar or rank 1 array of query points
  • method is an optional specification of interpolation method. It can be either ‘linear’, or ‘pchip’ (same as ‘cubic’), default is ‘linear’
    • ‘linear’ does piecewise linear interpolation
    • ‘pchip’ does smooth piecewise cubic interpolation
  • extrap is an optional parameter specifying the handling of query points outside of sample point range. The parameter accepts
    • ‘NaN’ values beyond the endpoints are set to NaN (default)
    • ‘extrap’ values beyond the endpoints are extrapolated

The result yi is either

  • single interpolated value if rank(y) == 1 and xi is scalar
  • rank 1 array of interpolated values if rank(y) == 1 and rank(xi) == 1, in that case size(yi) == size(xi)
  • rank 1 array of interpolated values if rank(y) == 2 and xi is scalar in that case size(yi) == size(y,1)
  • rank 2 array of interpolated values if rank(y) == 2 and rank(xi) == 1, in that case size(yi,1) == size(y,1) and size(yi,2) == size(xi)

Contents


Module Procedures

private pure function interp1_rank00(x, y, xi, method, extrap) result(yi)

Arguments

TypeIntentOptionalAttributesName
real(kind=rkind), intent(in) :: x(:)
real(kind=rkind), intent(in) :: y(size(x))
real(kind=rkind), intent(in) :: xi
character(len=*), intent(in), optional :: method
character(len=*), intent(in), optional :: extrap

Return Value real(kind=rkind)

private pure function interp1_rank01(x, y, xi, method, extrap) result(yi)

Arguments

TypeIntentOptionalAttributesName
real(kind=rkind), intent(in) :: x(:)
real(kind=rkind), intent(in) :: y(size(x))
real(kind=rkind), intent(in) :: xi(:)
character(len=*), intent(in), optional :: method
character(len=*), intent(in), optional :: extrap

Return Value real(kind=rkind)(size(xi))

private pure function interp1_rank10(x, y, xi, method, extrap) result(yi)

Arguments

TypeIntentOptionalAttributesName
real(kind=rkind), intent(in) :: x(:)
real(kind=rkind), intent(in) :: y(:,:)
real(kind=rkind), intent(in) :: xi
character(len=*), intent(in), optional :: method
character(len=*), intent(in), optional :: extrap

Return Value real(kind=rkind)(size(y,1))

private pure function interp1_rank11(x, y, xi, method, extrap) result(yi)

Arguments

TypeIntentOptionalAttributesName
real(kind=rkind), intent(in) :: x(:)
real(kind=rkind), intent(in) :: y(:,:)
real(kind=rkind), intent(in) :: xi(:)
character(len=*), intent(in), optional :: method
character(len=*), intent(in), optional :: extrap

Return Value real(kind=rkind)(size(y,1),size(xi))