R/calcNitrogenFixationRateNatural.R

Defines functions calcNitrogenFixationRateNatural

#' @title calcNitrogenFixationRateNatural
#' @description calculates fixation rates from natural ecosystems based on evapostranspiration
#' @return List of magpie objects with results on global level, empty weight, unit and description.
#' @author Benjamin Leon Bodirsky
#' @seealso
#' \code{\link{calcNitrogenFixationPast}}
#' \code{\link{readHerridge}} 
#' @examples
#' 
#' \dontrun{ 
#' calcOutput("NitrogenFixationRateNatural")
#' }
#' 
#' @importFrom magclass getRegionList<-
#' @importFrom magclass getRegionList
#' @importFrom magpiesets findset

calcNitrogenFixationRateNatural<-function(){
  
  years <- findset("past")
  
  e_rate <- readSource(type = "LPJmL", subtype="LPJmL4:CRU_4.evaporation", convert="onlycorrect")[,years,]
  t_rate <- readSource(type = "LPJmL", subtype="LPJmL4:CRU_4.transpiration", convert="onlycorrect")[,years,]
  et_rate= dimSums(e_rate+t_rate,dim=3)
  start_year="y1965"
  
  land <- dimSums(setYears(calcOutput("LanduseInitialisation",aggregate = FALSE,cellular=TRUE)[,start_year,],NULL),dim=3)
  et=et_rate*land
  
  # calibration to global total of 58 Tg from Vitousek et al 2013,
  # assuming linear relation to evapotranspiration from Cleveland et al 1999
  bnf=58/dimSums(setYears(et[,start_year,],NULL),dim=c(1,3))*et
  bnf_rate=bnf/land
  bnf_rate[is.na(bnf_rate)]=0
  
  # in case we also have ET for pasture, we could also first calibrate with natveg and the apply to ET rates of pastures. however pasture productivtiy very uncertain
  
  return(list(x=bnf_rate,
              weight=dimSums(land,dim=3),
              unit="Mt Nr / Mha",
              description="Nitrogen fixation  freeliving bacteria",
              isocountries=FALSE)
         )
}
pik-piam/moinput documentation built on June 9, 2020, 12:23 p.m.