def reduce_dimensions(data):
    """Reduce dimensions of length equal to 1."""
    sel = {k: data.coords[k].data[0]
           for k, v in data.dims.items() if v==1}

    data = data.sel(**sel)
    return data