def time_std(xr_da, time_name="time"):
    """
    Calculate standard deviation along the time axis of an `xarray.DataArray`.

    Parameters
    ----------
    xr_da: xarray.DataArray
        Data array with a time coordinate.
    time_name: str, optional
        Name of t-coordinate

    Returns
    -------
    xarray.DataArray
        Array collapsed over the time dimension.
    """
    xr_da_mean = xr_da.std(dim=time_name)
    xr_da_mean.attrs.update(xr_da.attrs)
    return xr_da_mean