def cast_type(var, var_type):
    """
    Type cast a variable into a var type.

    Parameters
    ----------
    var: xarray.core.dataarray.DataArray
        The dataarray to be type casted.
    var_type: string
        New type the variable will be type casted to.
    Returns
    -------
    xarray.core.dataarray.DataArray
        The newly type casted variable.
    """

    return var.astype(var_type)