def check_order(df, topcol, basecol, raise_error=True):
    """
    Check that all rows are either depth ordered or elevation_ordered.
    Returns 'elevation' or 'depth'.
    """
    assert basecol in df.columns, f'`basecol` {basecol} not present in {df.columns}'

    if (df[topcol] > df[basecol]).all():
        return 'elevation'
    elif (df[topcol] < df[basecol]).all():
        return 'depth'
    elif raise_error:
        raise ValueError('Dataframe has inconsistent top/base conventions')
    else:
        return None