def cross_from_above(x, threshold):
    """
    return the indices into *x* where *x* crosses some threshold from
    below, eg the i's where::

      x[i-1]>threshold and x[i]<=threshold

    .. seealso::

        :func:`cross_from_below` and :func:`contiguous_regions`

    """
    x = np.asarray(x)
    ind = np.nonzero( (x[:-1]>=threshold) & (x[1:]<threshold))[0]
    if len(ind): return ind+1
    else: return ind