def fillgaps_time(ds, method='cubic', max_gap=None):
    """
    Fill gaps (nan values) across time using the specified method

    Parameters
    ----------
    ds : xarray.Dataset
      The adcp dataset to clean
    method : string
      Interpolation method to use
    max_gap : numeric
      Max number of consective NaN's to interpolate across

    Returns
    -------
    ds : xarray.Dataset
      The adcp dataset with gaps in velocity interpolated across time

    See Also
    --------
    xarray.DataArray.interpolate_na()

    """
    ds['vel'] = ds.vel.interpolate_na(dim='time', method=method,
                                      use_coordinate=True,
                                      max_gap=max_gap)
    if hasattr(ds, 'vel_b5'):
        ds['vel_b5'] = ds.vel.interpolate_na(dim='time', method=method,
                                             use_coordinate=True,
                                             max_gap=max_gap)
    return ds