def merge_dimensions(df1, df2, interp_lim=3):
    """
    Merges variables measured at different time intervals. Glider data may be
    sampled at different time intervals, as is the case for primary CTD and
    SciCon data.

    Parameters
    ----------
    df1 : pandas.DataFrame
        A dataframe indexed by datetime64 sampling times. Can have multiple
        columns. The index of this first dataframe will be preserved.
    df2 : pandas.DataFrame
        A dataframe indexed by datetime64 sampling times. Can have multiple
        columns. This second dataframe will be interpolated linearly onto the
        first dataframe.

    Returns
    -------
    merged_df : pandas.DataFrame
        The combined arrays interpolated onto the index of the first axis

    Raises
    ------
    Userwarning
        If either one of the indicies are not datetime64 dtypes

    Example
    -------
    You can use the following code and alter it if you want more control

    >>> df = pd.concat([df1, df2], sort=True, join='outer')  # doctest: +SKIP
    >>> df = (df
              .sort_index()
              .interpolate(limit=interp_lim)
              .bfill(limit=interp_lim)
              .loc[df1.index]
        )
    """
    import xarray as xr
    from .helpers import GliderToolsError
    is_xds = isinstance(df1, xr.Dataset) | isinstance(df2, xr.Dataset)
    if is_xds:
        msg = 'One of your input objects is xr.Dataset, please define '
        raise GliderToolsError(msg)
    same_type = type(df1.index) == type(df2.index)
    if same_type:
        df = df1.join(df2, sort=True, how='outer', rsuffix='_drop')
        df = df.interpolate(limit=interp_lim).bfill(limit=interp_lim)
        return df.loc[df1.index]
    else:
        raise UserWarning('Both dataframe indicies need to be same dtype')
