def channel_is_superelevated(z, riv, behind, channel_depth, super_ratio,
    sea_level):
    """Check if a channel location is super-elevated.

    Parameters
    ----------
    z : ndarray
        2D-array of elevations.
    sub : tuple of int
        Row-column subscripts into *z*.
    channel_depth : float
        The depth of the channel.
    super_ratio : float
        Ratio of bankfull elevation to out-of-channel elevation for
        channel to be super-elevated.

    Returns
    -------
    boolean
        `True` if channel is super-elevated. Otherwise, `False`.
    """
    superelev = 0
    z_bankfull = z[riv] + channel_depth
    if behind[0] + 1 == riv[0]:
        if riv[1] == 0:
            adj1 = z[riv[0], riv[1] + 1]
            adj2 = z[riv[0], riv[1] + 1]
        elif riv[1] == z.shape[1] - 1:
            adj1 = z[riv[0], riv[1] - 1]
            adj2 = z[riv[0], riv[1] - 1]
        else:
            adj1, adj2 = z[riv[0], riv[1] - 1], z[riv[0], riv[1] + 1]
    if behind[0] == riv[0]:
        if riv[0] == z.shape[0] - 1:
            adj1 = z[riv[0] + 1, riv[1]]
            adj2 = z[riv[0] + 1, riv[1]]
        else:
            adj1, adj2 = z[riv[0] + 1, riv[1]], z[riv[0] - 1, riv[1]]
    threshold = super_ratio * channel_depth
    if adj1 < sea_level and adj2 < sea_level:
        superelev = 0
    elif adj1 < sea_level:
        if z_bankfull - adj2 >= threshold:
            superelev = 1
    elif adj2 < sea_level:
        if z_bankfull - adj1 >= threshold:
            superelev = 1
    elif (z_bankfull - adj2 or z_bankfull - adj1) >= threshold:
        superelev = 1
    return superelev
