The fortran routine maxloc(array) returns the indices at which the maximum value in array occurs. However the return must be a vector quantity of the same size as the array has dimensions. This can be slightly clunky if array is of dimension 1 - ie, a 1-dimensional vector. The function maxLoc1d allows one to obtain the index of the maximum value of the 1-D argument in a scalar return value. This can save some lines of code.
interface maxLoc1d function maxLoc1dSingle(vector, mask) real(single), intent(in) :: vector(:) logical(bool), intent(in), optional :: mask(:) integer :: maxLoc1dSingle end function function maxLoc1dDouble(vector, mask) real(double), intent(in) :: vector(:) logical(bool), intent(in), optional :: mask(:) integer :: maxLoc1dSingle end function end interface