Skip to content

Commit

Permalink
fix policyCosts reporting after remind2 PR#465
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Mar 7, 2024
1 parent e6d47b6 commit 4a2d421
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/output/comparison/policyCosts.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,21 @@ if (!"3" %in% special_requests) {

tmp_policy_costs <- tmp_policy_costs_magpie %>%
lapply(quitte::as.quitte) %>%
lapply(select, region, period, data, value)
lapply(select, "region", "period", "variable", "value")

# Combine results in single tibble, with names like "Pol_w.r.t_Ref"
policy_costs <- rename(tmp_policy_costs[[1]], !!sym(paste0(pol_names[1], "_w.r.t_",ref_names[1])):=value)
if (length(tmp_policy_costs) > 1) {
for (i in 2:length(tmp_policy_costs)) {
policy_costs <- tmp_policy_costs[[i]] %>%
rename(!!sym(paste0(pol_names[i], "_w.r.t_", ref_names[i])) := value) %>%
left_join(policy_costs, tmp_policy_costs[[i]], by = c("region", "period", "data"))
left_join(policy_costs, tmp_policy_costs[[i]], by = c("region", "period", "variable"))
}
}
# and do some pivotting
policy_costs <- policy_costs %>%
pivot_longer(cols = matches(".*w\\.r\\.t.*"), names_to = "Model Output") %>%
pivot_wider(names_from = data)
pivot_wider(names_from = "variable")

# By default, plots are only created until 2100
if (!"4" %in% special_requests) {
Expand Down

0 comments on commit 4a2d421

Please sign in to comment.