0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_utils::locate Interface Reference

Find closest values in a monotonic series, returns the indexes. More...

Public Member Functions

integer(i4) function locate_0d_dp (x, y)
 
integer(i4) function locate_0d_sp (x, y)
 
integer(i4) function, dimension(:), allocatable locate_1d_dp (x, y)
 
integer(i4) function, dimension(:), allocatable locate_1d_sp (x, y)
 

Detailed Description

Find closest values in a monotonic series, returns the indexes.

Given an array x(1:n), and given a value y, returns a value j such that y is between x(j) and x(j+1).
x must be monotonically increasing.
j=0 or j=N is returned to indicate that x is out of range.

Example

Returns ii = (/1, 5/)

x = (/ 1., 2., 3., -999., 5., 6. /)
y = (/ 1.1, 5.6 /)
ii = locate(x, y)

Returns ii = 1

y = 1.1
ii = locate(x, y)
Parameters
[in]real(dp/sp) :: x(:)Sorted array
[in]real(dp/sp) :: y[(:)]Value(s) of which the closest match in x(:) is wanted
Return values
integer(i4) :: index[(:)]Index(es) of x so that y is between x(index) and x(index+1)
Note
x must be monotonically increasing.
Author
Matthias Cuntz
Date
May 2014

Definition at line 403 of file mo_utils.F90.

Member Function/Subroutine Documentation

◆ locate_0d_dp()

integer(i4) function mo_utils::locate::locate_0d_dp ( real(dp), dimension(:), intent(in)  x,
real(dp), intent(in)  y 
)

Definition at line 1171 of file mo_utils.F90.

◆ locate_0d_sp()

integer(i4) function mo_utils::locate::locate_0d_sp ( real(sp), dimension(:), intent(in)  x,
real(sp), intent(in)  y 
)

Definition at line 1188 of file mo_utils.F90.

◆ locate_1d_dp()

integer(i4) function, dimension(:), allocatable mo_utils::locate::locate_1d_dp ( real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(in)  y 
)

Definition at line 1205 of file mo_utils.F90.

◆ locate_1d_sp()

integer(i4) function, dimension(:), allocatable mo_utils::locate::locate_1d_sp ( real(sp), dimension(:), intent(in)  x,
real(sp), dimension(:), intent(in)  y 
)

Definition at line 1229 of file mo_utils.F90.


The documentation for this interface was generated from the following file: