forked from pik-piam/mrremind
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
read max secondary steel share from file
- Loading branch information
1 parent
b1eac09
commit fa991cc
Showing
2 changed files
with
50 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#' Calculate Maximum Secondary Steel Production Share | ||
#' | ||
#' Reads ExpertGuess/industry_max_secondary_steel_share and expands to all | ||
#' `scenarios`/`regions` using default data. See [`tool_expand_tibble()`] for | ||
#' details. | ||
#' | ||
#' @param scenarios A character vector of scenarios to expand data to. | ||
#' @param regions A character vector of regions to expand data to. | ||
#' | ||
#' @return A list with a [`magpie`][magclass::magclass] object `x`. | ||
|
||
#' @export | ||
calcindustry_max_secondary_steel_share <- function(scenarios = NULL, | ||
regions = NULL) { | ||
if (is.null(scenarios)) { | ||
stop('Scenario definitions missing.') | ||
} | ||
|
||
if (is.null(regions)) { | ||
stop('Region definitions missing.') | ||
} | ||
|
||
. <- NULL | ||
|
||
return(list( | ||
x = readSource(type = 'ExpertGuess', | ||
subtype = 'industry_max_secondary_steel_share', | ||
convert = FALSE) %>% | ||
madrat_mule() %>% | ||
tool_expand_tibble(scenarios, regions) %>% | ||
pivot_longer( | ||
!all_of(names(which('character' == unlist(lapply(., typeof)))))) %>% | ||
as.magpie(spatial = 0, temporal = 0, data = ncol(.)), | ||
weight = NULL, unit = '', description = '')) | ||
} |