def scale(xobj, *scaling):
    """Scales an xarray object created using rioxarray

    Parameters
    ----------
    xobj: xarray.DataArray or xarray.Dataset
        the xarray object to scale
    scaling: float or list of floats
        scaling factors. If two are provided, the order is width, height.
        Values less than one downsample (shrink) the object, values greater
        than one upsample (stretch) the object.

    Returns
    -------
    xarray.DataArray or xarray.Dataset
        the scaled xarray object
    """
    width = xobj.sizes["x"]
    height = xobj.sizes["y"]

    if len(scaling) == 1:
        scaling = (scaling[0], scaling[0])
    if len(scaling) != 2:
        raise ValueError("Must provide 1-2 values for scaling")

    width = int(width * scaling[0])
    height = int(height * scaling[1])

    return xobj.rio.reproject(xobj.rio.crs, shape=(width, height))