forked from pik-piam/mrremind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalcPotentialWeathering.R
36 lines (32 loc) · 1.05 KB
/
calcPotentialWeathering.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#' Calculate hydro potential
#'
#' Provides weathering potential data
#'
#'
#' @return weathering potential data and corresonding weights as a list of
#' two MAgPIE objects
#' @author Lavinia Baumstark
#' @seealso \code{\link{calcOutput}}
#' @examples
#'
#' \dontrun{
#' calcOutput("PotentialWeathering")
#'
#' }
#'
calcPotentialWeathering <- function() {
# read weathering data
pot <- readSource("Strefler", subtype = "weathering_graderegi")
# change the unit: 10^6 km^2 -> kg/m^2 = Gt / 10^6 km^2
pot <- pot * 15
# delete total
pot <- pot[,,"total",invert=TRUE]
# allocate "warm" and "temperate" to the right grades
getNames(pot) <- gsub("warm", "1",getNames(pot))
getNames(pot) <- gsub("temperate","2",getNames(pot))
return(list(x=pot,
weight=NULL,
unit="Gt of ground stone/a",
description="This file includes max. potential for enhanced weathering in Gt of ground stone/a for different regions and warm (1) and temperate (2) grades. (=maxprod)"
))
}