-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
groundwater accounting bugfix and introduction of calcWateruseActuall…
…yCommittedAg
- Loading branch information
1 parent
013fcc9
commit 11f94c8
Showing
8 changed files
with
167 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#' @title calcWaterUseActuallyCommittedAg | ||
#' @description This function calculates committed agricultural water uses that | ||
#' are used in the river routing algorithm for distributing | ||
#' available water across the basin | ||
#' | ||
#' @param selectyears Years to be returned | ||
#' @param iniyear Year of initialization for cropland area | ||
#' @param lpjml LPJmL version required for respective inputs: natveg or crop | ||
#' @param climatetype Switch between different climate scenarios or | ||
#' historical baseline "GSWP3-W5E5:historical" | ||
#' @param efrMethod EFR method used including selected strictness of EFRs (e.g. Smakhtin:good, VMF:fair) | ||
#' @param fossilGW If TRUE: non-renewable groundwater can be used. | ||
#' If FALSE: non-renewable groundwater cannot be used. | ||
#' @param multicropping Multicropping activated (TRUE) or not (FALSE) and | ||
#' Multiple Cropping Suitability mask selected | ||
#' (mask can be: | ||
#' "none": no mask applied (only for development purposes) | ||
#' "actual:total": currently multicropped areas calculated from total harvested areas | ||
#' and total physical areas per cell from readLanduseToolbox | ||
#' "actual:crop" (crop-specific), "actual:irrigation" (irrigation-specific), | ||
#' "actual:irrig_crop" (crop- and irrigation-specific) "total" | ||
#' "potential:endogenous": potentially multicropped areas given | ||
#' temperature and productivity limits | ||
#' "potential:exogenous": potentially multicropped areas given | ||
#' GAEZ suitability classification) | ||
#' (e.g. TRUE:actual:total; TRUE:none; FALSE) | ||
#' @param transDist Water transport distance allowed to fulfill locally | ||
#' unfulfilled water demand by surrounding cell water availability | ||
#' | ||
#' @importFrom stringr str_split | ||
#' @importFrom madrat calcOutput | ||
#' | ||
#' @return magpie object in cellular resolution | ||
#' @author Felicitas Beier | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' calcOutput("WaterUseActuallyCommittedAg", aggregate = FALSE) | ||
#' } | ||
#' | ||
calcWaterUseActuallyCommittedAg <- function(lpjml, climatetype, | ||
selectyears, iniyear, | ||
multicropping, efrMethod, | ||
fossilGW, transDist) { | ||
|
||
# Irrigation water requirements per cell per crop given irrigation | ||
# system initialization (in m^3 per hectare per year) | ||
irrigReq <- calcOutput("ActualIrrigWatRequirements", | ||
irrigationsystem = "initialization", | ||
selectyears = selectyears, iniyear = iniyear, | ||
lpjml = lpjml, climatetype = climatetype, | ||
multicropping = multicropping, aggregate = FALSE) | ||
|
||
# Read in cropland area (by crop) from crop area initialization (in mio. ha) | ||
grownCrops <- calcOutput("IrrigAreaActuallyCommitted", iteration = "committed_agriculture", | ||
selectyears = selectyears, iniyear = iniyear, | ||
lpjml = lpjml, climatetype = climatetype, | ||
efrMethod = efrMethod, multicropping = multicropping, | ||
transDist = transDist, fossilGW = fossilGW, | ||
aggregate = FALSE) | ||
|
||
# Committed agricultural uses (in mio. m^3 per year) | ||
comAg <- irrigReq * grownCrops | ||
|
||
return(list(x = comAg, | ||
weight = NULL, | ||
unit = "mio. m^3 per year", | ||
description = paste0("water use actually committed to agriculture ", | ||
"per crop given currently irrigated area and ", | ||
"(renewable and non-renewable) water availability"), | ||
isocountries = FALSE)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.