R/calcBiomassPrices.R

Defines functions calcBiomassPrices

#' read biomass supply curves from Magpie emulator
#' @return Magpie object with two parameters determining linear biomass supply curve
#' @importFrom magclass dimReduce

calcBiomassPrices <- function(){
  
  x <- readSource("MAgPIE", subtype = "supplyCurve_magpie_40")

  # rename the rcp-scenarios
  getNames(x) <- gsub("NDC-PkBudg900","rcp20",getNames(x))
  getNames(x) <- gsub("NDC-PkBudg1300","rcp26",getNames(x))
  getNames(x) <- gsub("NDC-NDC","rcp45",getNames(x))
  getNames(x) <- gsub("NPI-Base","none",getNames(x))
  
  # Introduce new SSP/SDP dimension by replacing "-" with "."
  getNames(x) <- gsub("(SSP[0-9]|SDP)-","\\1.",getNames(x))
  
  # if fit coefficients of a country are NA for all years (there is no supplycurve at all for this country)
  # generate artificial supplycurve with VERY high prices
  x[,,"a"][is.na(x[,,"a"])] <- 1
  x[,,"b"][is.na(x[,,"b"])] <- 0.1
    

  return(list(x           = x,
              weight      = NULL,
              unit        = "none",
              description = "coefficients for the bioenergy supplycurve",
              aggregationFunction=toolBiomassSupplyAggregate))
}
pik-piam/moinput documentation built on June 9, 2020, 12:23 p.m.