def _xarray_with_attrs(xa_, static_covariates, hierarchy, metadata):
    """Return an DataArray instance with static covariates and hierarchy stored in the array's attributes.
    Warning: This is an inplace operation (mutable) and should only be called from within TimeSeries construction
    or to restore static covariates, hierarchy and metadata after operations in which they did not get transferred.
    """
    xa_.attrs[STATIC_COV_TAG] = static_covariates
    xa_.attrs[HIERARCHY_TAG] = hierarchy
    xa_.attrs[METADATA_TAG] = metadata
    return xa_
Return an DataArray instance with static covariates and hierarchy stored in the array's attributes.
    Warning: This is an inplace operation (mutable) and should only be called from within TimeSeries construction
    or to restore static covariates, hierarchy and metadata after operations in which they did not get transferred.
    
darts/timeseries.py