def _check_numbers(n, numbers, level=1, datatype='reach'):
    txt = ''
    num_range = np.arange(1, n + 1)
    if not np.array_equal(num_range, numbers):
        txt += 'Invalid {} numbering\n'.format(datatype)
        if level == 1:
            non_consecutive = np.append(np.diff(numbers) != 1, False)  # consistent dimmension for boolean array
            gaps = num_range[non_consecutive] + 1
            if len(gaps) > 0:
                gapstr = ' '.join(map(str, gaps))
                txt += 'Gaps in numbering at positions {}\n'.format(gapstr)
    return txt
Check that a sequence of numbers is consecutive
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfsfr2.py/_check_numbers