def _next_non_masked_element(a, idx):
    'Return the next non masked element of a masked array.\n\n    If an array is masked, return the next non-masked element (if the given index is masked).\n    If no other unmasked points are after the given masked point, returns none.\n\n    Parameters\n    ----------\n    a : array-like\n        1-dimensional array of numeric values\n    idx : integer\n        index of requested element\n\n    Returns\n    -------\n        Index of next non-masked element and next non-masked element\n\n    '
    try:
        next_idx = (idx + a[idx:].mask.argmin())
        if ma.is_masked(a[next_idx]):
            return (None, None)
        else:
            return (next_idx, a[next_idx])
    except (AttributeError, TypeError, IndexError):
        return (idx, a[idx])
Return the next non masked element of a masked array.

If an array is masked, return the next non-masked element (if the given index is masked).
If no other unmasked points are after the given masked point, returns none.

Parameters
----------
a : array-like
    1-dimensional array of numeric values
idx : integer
    index of requested element

Returns
-------
    Index of next non-masked element and next non-masked element
def _next_non_masked_element(a, idx):
    'Return the next non masked element of a masked array.\n\n    If an array is masked, return the next non-masked element (if the given index is masked).\n    If no other unmasked points are after the given masked point, returns none.\n\n    Parameters\n    ----------\n    a : array-like\n        1-dimensional array of numeric values\n    idx : integer\n        index of requested element\n\n    Returns\n    -------\n        Index of next non-masked element and next non-masked element\n\n    '
    try:
        next_idx = (idx + a[idx:].mask.argmin())
        if ma.is_masked(a[next_idx]):
            return (None, None)
        else:
            return (next_idx, a[next_idx])
    except (AttributeError, TypeError, IndexError):
        return (idx, a[idx])