oasislmf.pytools.gul.utils

This file contains general-purpose utilities used in gulpy.

Functions

binary_search(value, array, n)

Assuming array is a sorted array (increasing order), find the bin

Module Contents

Assuming array is a sorted array (increasing order), find the bin where where array gets larger than value.

Parameters:
  • value (float,int) – the value to be searched

  • array (float, int) – the array where value is to be searched.

  • n (int) – number of elements of array where value is to be searched, starting from the beginning of array.

Returns:

the first index of array where array is larger than value.

Returns -1 if this condition never occurs.

Return type:

int