def build_valid_time(time, step):
    """
    Return dimensions and data of the valid_time corresponding to the given ``time`` and ``step``.
    The data is seconds from the same epoch as ``time`` and may have one or two dimensions.

    :param time: given in seconds from an epoch, as returned by ``from_grib_date_time``
    :param step: given in hours, as returned by ``from_grib_step``
    """
    step_s = step * 3600
    if len(time.shape) == 0 and len(step.shape) == 0:
        data = time + step_s
        dims = ()
    elif len(time.shape) > 0 and len(step.shape) == 0:
        data = time + step_s
        dims = 'time',
    elif len(time.shape) == 0 and len(step.shape) > 0:
        data = time + step_s
        dims = 'step',
    else:
        data = time[:, (None)] + step_s[(None), :]
        dims = 'time', 'step'
    return dims, data
