-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added labor-capital-share validation and renamed feed conversion indi…
…cator
- Loading branch information
Debbora Leip
committed
Feb 26, 2024
1 parent
7a67f9e
commit 83ddde0
Showing
9 changed files
with
93 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: mrvalidation | ||
Title: madrat data preparation for validation purposes | ||
Version: 2.56.2 | ||
Version: 2.56.3 | ||
Date: 2024-02-26 | ||
Authors@R: c( | ||
person("Benjamin Leon", "Bodirsky", , "[email protected]", role = c("aut", "cre")), | ||
|
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,42 @@ | ||
#' @title calcValidFactorReqShares | ||
#' | ||
#' @description calculates the validation data for labor and capital requirement shares in agriculture | ||
#' (currently the same shares for crop and livestock production based on USDA data) | ||
#' @param subtype for which to report requirement shares, either "crop" or "livestock" | ||
#' | ||
#' @return List of magpie objects with results on country level, weight on country level, unit and description. | ||
#' @author Debbora Leip | ||
#' @examples | ||
#' | ||
#' \dontrun{ | ||
#' calcOutput("ValidFactorReqShares") | ||
#' } | ||
#' | ||
|
||
calcValidFactorReqShares <- function(subtype = "crop") { | ||
|
||
if (!(subtype %in% c("crop", "livestock"))) stop("subtype must be either 'crop' or 'livestock'") | ||
|
||
out <- setNames(calcOutput("AgCapLabourShare", aggregate = FALSE), | ||
paste0("Factor requirement shares|", stringr::str_to_title(subtype), | ||
" products|+|Capital requirement share (%)")) | ||
out <- mbind(out, setNames(1 - out, paste0("Factor requirement shares|", stringr::str_to_title(subtype), | ||
" products|+|Labor requirement share (%)"))) | ||
|
||
out <- add_dimension(out, dim = 3.1, add = "scenario", nm = "historical") | ||
out <- add_dimension(out, dim = 3.2, add = "model", nm = "USDA") | ||
|
||
|
||
# production as weight (0 weight to countries with unexpectedly high capital shares) | ||
weight <- dimSums(collapseDim(calcOutput("Production", aggregate = FALSE)[, , "dm"]), dim = 3.1) | ||
weight[c("BLZ", "CRI", "DOM", "HND", "JAM", "MEX", "NIC", "PAN", "SLV"), , ] <- 0 | ||
weight <- weight[, getItems(out, dim = 2), ] | ||
weight[out[, , "Capital", pmatch = TRUE] == 0] <- 0 | ||
|
||
|
||
return(list(x = out, | ||
weight = weight, | ||
unit = "%", | ||
description = "Factor requirement shares based on USDA data") | ||
) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.