def get_time_invariant_urban_mask(dsets, var, idx=0, arr_name="mask"):
    """This is a function for creating a time invariant urban mask.
    If we use 2006-01-01, given the that is not available, we should use 1 for the idx.
    We are interested in lat and lon only, e.g., 
    ["time", "lat", "lon"] if time is considered.

    Parameters
    ----------
    dsets : xarray.DataSets
        _description_
    var : variable that we are interested in
        e.g., TREFMXAV_U for CESM1
    idx : int, optional
        index of other dimensions, by default 0
    arr_name : str, optional
        name of the mask, by default "mask"

    Returns
    -------
    xarray.DataArray
        urban mask
    """
    da = dsets[var]
    for dim in da.dims:
        if dim not in ["lat","lon"]:
            da = da.isel({dim:idx}).squeeze().drop(dim)
            # or da = da.sel({dim:da[dim][idx]}).squeeze().drop(dim)
    return da.rename(arr_name).notnull().load()