Skip to content

Commit

Permalink
Merge branch 'main' of github.com:pik-piam/mrindustry
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Nov 22, 2024
2 parents 61ae1c5 + 2169899 commit e290ed8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '1002400'
ValidationKey: '1002450'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ message: If you use this software, please cite it using the metadata from this f
type: software
title: 'mrindustry: input data generation for the REMIND industry module'
version: 0.5.0
date-released: '2024-11-21'
date-released: '2024-11-22'
abstract: The mrindustry packages contains data preprocessing for the REMIND model.
authors:
- family-names: Benke
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Package
Package: mrindustry
Title: input data generation for the REMIND industry module
Version: 0.5.0
Date: 2024-11-21
Date: 2024-11-22
Authors@R: c(
person(given = "Falk", family = "Benke", email = "[email protected]",
role = c("aut", "cre")),
Expand Down
44 changes: 44 additions & 0 deletions R/calcFeDemandIndustry.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' Calculates FE demand in industry as REMIND variables
#'
#' @md
#' @param use_ODYM_RECC per-capita pathways for `SDP_xx` scenarios? (Defaults
#' to `FALSE`.)
#' @param last_empirical_year Last year for which empirical data is available.
Expand Down Expand Up @@ -1049,6 +1050,49 @@ calcFeDemandIndustry <- function(use_ODYM_RECC = FALSE,
ungroup() %>%
select(-"value")

### modify subsector FE share targets ----
# Default data with no modification will reduce the solids share of other
# industry in the Non-OECD region by ten percentage points, and increase the
# electricity share by as much. The changes are phased in over the time
# horizon of IEA ETP data (2025–60).
IEA_ETP_Ind_FE_shares_delta <- tribble(
~region, ~subsector, ~fety, ~share.delta,
'Non-OECD', 'otherInd', 'feel', 0.1,
'Non-OECD', 'otherInd', 'feso', -0.1)

# verify modification sums
IEA_ETP_Ind_FE_shares_delta %>%
group_by(.data$region, .data$subsector) %>%
summarise(share.delta.sum = sum(.data$share.delta), .groups = 'drop') %>%
verify(0 == .data$share.delta.sum) %>%
invisible()

IEA_ETP_Ind_FE_shares <- IEA_ETP_Ind_FE_shares %>%
left_join(
# expand modifications to phase in from 0 to full over the time horizon of
# IEA_ETP_Ind_FE_shares
IEA_ETP_Ind_FE_shares_delta %>%
left_join(
IEA_ETP_Ind_FE_shares %>%
select(-'share') %>%
filter(.data$year %in% range(.data$year)),

c('region', 'subsector', 'fety')
) %>%
mutate(share.delta = ifelse(min(.data$year) == .data$year,
0,
.data$share.delta)) %>%
interpolate_missing_periods(year = unique(IEA_ETP_Ind_FE_shares$year),
value = 'share.delta'),

c('region', 'subsector', 'fety', 'year'),

) %>%
replace_na(list(share.delta = 0)) %>%
# add share modifications
mutate(share = .data$share + .data$share.delta) %>%
select(-'share.delta')

### split feel shares and extend to SSP scenarios ----
IEA_ETP_Ind_FE_shares <- bind_rows(
# all pf that don't need splitting
Expand Down
4 changes: 2 additions & 2 deletions man/calcFeDemandIndustry.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e290ed8

Please sign in to comment.