R/reportCosts.R

Defines functions reportCosts

Documented in reportCosts

#' @title reportCosts
#' @description reports MAgPIE costs
#' 
#' @export
#' 
#' @param gdx GDX file
#' @return consumption value as MAgPIE object Unit: see names
#' @author Florian Humpenoeder
#' @examples
#' 
#'   \dontrun{
#'     x <- reportCosts(gdx)
#'   }
#' 

reportCosts<-function(gdx){

  a <- costs(gdx,level = "regglo",sum = FALSE)
  getNames(a) <- paste0("Costs|",getNames(a))
  
  x <- NULL
  x <- mbind(x,setNames(dimSums(a,dim=3),"Costs"))
  x <- mbind(x,a)
  x <- mbind(x,setNames(dimSums(a[,,c("Costs|GHG Emissions","Costs|Reward for Afforestation"),invert=TRUE],dim=3),"Costs|MainSolve w/o GHG Emissions"))
  
  getNames(x) <- paste0(getNames(x)," (million US$05/yr)")
  
  return(x)
}
pik-piam/magpie4 documentation built on May 2, 2024, 5:29 p.m.