Skip to content

Commit

Permalink
Merge branch 'pw/feature/hydrogen_det_ind' into pw/feature/hydrogen_usa
Browse files Browse the repository at this point in the history
  • Loading branch information
pkyle committed Apr 26, 2022
2 parents 0b368f7 + ae27b64 commit f0ea4a0
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 5,066 deletions.
47 changes: 26 additions & 21 deletions input/gcamdata/R/zchunk_L254.transportation_UCD.R
Original file line number Diff line number Diff line change
Expand Up @@ -459,25 +459,26 @@ module_energy_L254.transportation_UCD <- function(command, ...) {
L254.GlobalTranTechShrwt_CORE # OUTPUT


A54.globaltranTech_shrwt %>%
filter(sce=="highEV") %>%
select(-sce) %>%
gather_years %>%
# Expand table to include all model years
complete(year = c(year, MODEL_YEARS), nesting(supplysector, tranSubsector, tranTechnology)) %>%
# Extrapolate to fill out values for all years
# Rule 2 is used so years that may be outside of min-max range are assigned values from closest data, as opposed to NAs
group_by(supplysector, tranSubsector, tranTechnology) %>%
mutate(share.weight = approx_fun(year, value, rule = 2),
share.weight = round(share.weight, energy.DIGITS_SHRWT)) %>%
ungroup() %>%
filter(year %in% MODEL_YEARS) %>%
mutate(sce= paste0("highEV")) %>%
rename(sector.name = supplysector, subsector.name = tranSubsector) %>%
select(LEVEL2_DATA_NAMES[["GlobalTranTechShrwt"]],sce) ->
L254.GlobalTranTechShrwt_highEV # OUTPUT

L254.GlobalTranTechShrwt <- bind_rows(L254.GlobalTranTechShrwt_highEV,L254.GlobalTranTechShrwt_CORE)
# A54.globaltranTech_shrwt %>%
# filter(sce=="highEV") %>%
# select(-sce) %>%
# gather_years %>%
# # Expand table to include all model years
# complete(year = c(year, MODEL_YEARS), nesting(supplysector, tranSubsector, tranTechnology)) %>%
# # Extrapolate to fill out values for all years
# # Rule 2 is used so years that may be outside of min-max range are assigned values from closest data, as opposed to NAs
# group_by(supplysector, tranSubsector, tranTechnology) %>%
# mutate(share.weight = approx_fun(year, value, rule = 2),
# share.weight = round(share.weight, energy.DIGITS_SHRWT)) %>%
# ungroup() %>%
# filter(year %in% MODEL_YEARS) %>%
# mutate(sce= paste0("highEV")) %>%
# rename(sector.name = supplysector, subsector.name = tranSubsector) %>%
# select(LEVEL2_DATA_NAMES[["GlobalTranTechShrwt"]],sce) ->
# L254.GlobalTranTechShrwt_highEV # OUTPUT

#L254.GlobalTranTechShrwt <- bind_rows(L254.GlobalTranTechShrwt_highEV,L254.GlobalTranTechShrwt_CORE)
L254.GlobalTranTechShrwt <- L254.GlobalTranTechShrwt_CORE

# L254.GlobalTranTechSCurve and L254.GlobalTranTechProfitShutdown: Retirement of global tranTechnologies
# A54.globaltranTech_retire reports transportation technology retirement parameters. Only applies to vintaged technologies
Expand Down Expand Up @@ -526,11 +527,15 @@ module_energy_L254.transportation_UCD <- function(command, ...) {
L254.StubTranTechCalInput_basetable

#kbn 2020-02-06 Energy intensity are not separated by SSPs. So, just copying information from CORE to all SSPs.
# L254.StubTranTechCalInput_basetable<- bind_rows(L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("CORE")),
# L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP1")),
# L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP3")),
# L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP5")),
# L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("highEV")))
L254.StubTranTechCalInput_basetable<- bind_rows(L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("CORE")),
L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP1")),
L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP3")),
L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP5")),
L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("highEV")))
L254.StubTranTechCalInput_basetable %>% mutate(sce= paste0("SSP5")))

# Aggregate to set subsector share weights according to region, supplysector, tranSubsector, year combination
# kbn 2020-02-06 Add sce below (See description of changes using search string kbn 2020-06-02 Making changes to generate xmls for SSPs flexibly)
Expand Down
60 changes: 40 additions & 20 deletions input/gcamdata/R/zchunk_L254.transportation_USA.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,46 @@ module_gcamusa_L254.transportation_USA <- function(command, ...) {
A54.sector <- get_data(all_data, "energy/A54.sector",strip_attributes = TRUE)
states_subregions <- get_data(all_data, "gcam-usa/states_subregions",strip_attributes = TRUE)
#kbn 2020-02-27 Making changes to select the CORE scenario for transportation in GCAM USA
L254.Supplysector_trn <- get_data(all_data, "L254.Supplysector_trn",strip_attributes = TRUE) %>% filter(sce %in% c("highEV","CORE"))
L254.FinalEnergyKeyword_trn <- get_data(all_data, "L254.FinalEnergyKeyword_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorLogit <- get_data(all_data, "L254.tranSubsectorLogit",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorShrwtFllt <- get_data(all_data, "L254.tranSubsectorShrwtFllt",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorInterp <- get_data(all_data, "L254.tranSubsectorInterp",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorSpeed <- get_data(all_data, "L254.tranSubsectorSpeed",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorSpeed_passthru <- get_data(all_data, "L254.tranSubsectorSpeed_passthru",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorSpeed_noVOTT <- get_data(all_data, "L254.tranSubsectorSpeed_noVOTT",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorSpeed_nonmotor <- get_data(all_data, "L254.tranSubsectorSpeed_nonmotor",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorVOTT <- get_data(all_data, "L254.tranSubsectorVOTT",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.tranSubsectorFuelPref <- get_data(all_data, "L254.tranSubsectorFuelPref",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.StubTranTech <- get_data(all_data, "L254.StubTranTech",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.StubTech_passthru <- get_data(all_data, "L254.StubTech_passthru",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.StubTech_nonmotor <- get_data(all_data, "L254.StubTech_nonmotor",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.StubTranTechLoadFactor <- get_data(all_data, "L254.StubTranTechLoadFactor",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.StubTranTechCost <- get_data(all_data, "L254.StubTranTechCost",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.StubTranTechCoef <- get_data(all_data, "L254.StubTranTechCoef",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.PerCapitaBased_trn <- get_data(all_data, "L254.PerCapitaBased_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.PriceElasticity_trn <- get_data(all_data, "L254.PriceElasticity_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.IncomeElasticity_trn <- get_data(all_data, "L254.IncomeElasticity_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.Supplysector_trn <- get_data(all_data, "L254.Supplysector_trn",strip_attributes = TRUE) %>% filter(sce %in% c("highEV","CORE"))
# L254.FinalEnergyKeyword_trn <- get_data(all_data, "L254.FinalEnergyKeyword_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorLogit <- get_data(all_data, "L254.tranSubsectorLogit",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorShrwtFllt <- get_data(all_data, "L254.tranSubsectorShrwtFllt",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorInterp <- get_data(all_data, "L254.tranSubsectorInterp",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorSpeed <- get_data(all_data, "L254.tranSubsectorSpeed",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorSpeed_passthru <- get_data(all_data, "L254.tranSubsectorSpeed_passthru",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorSpeed_noVOTT <- get_data(all_data, "L254.tranSubsectorSpeed_noVOTT",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorSpeed_nonmotor <- get_data(all_data, "L254.tranSubsectorSpeed_nonmotor",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorVOTT <- get_data(all_data, "L254.tranSubsectorVOTT",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.tranSubsectorFuelPref <- get_data(all_data, "L254.tranSubsectorFuelPref",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.StubTranTech <- get_data(all_data, "L254.StubTranTech",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.StubTech_passthru <- get_data(all_data, "L254.StubTech_passthru",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.StubTech_nonmotor <- get_data(all_data, "L254.StubTech_nonmotor",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.StubTranTechLoadFactor <- get_data(all_data, "L254.StubTranTechLoadFactor",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.StubTranTechCost <- get_data(all_data, "L254.StubTranTechCost",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.StubTranTechCoef <- get_data(all_data, "L254.StubTranTechCoef",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.PerCapitaBased_trn <- get_data(all_data, "L254.PerCapitaBased_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.PriceElasticity_trn <- get_data(all_data, "L254.PriceElasticity_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
# L254.IncomeElasticity_trn <- get_data(all_data, "L254.IncomeElasticity_trn",strip_attributes = TRUE)%>% filter(sce %in% c("highEV","CORE"))
L254.Supplysector_trn <- get_data(all_data, "L254.Supplysector_trn",strip_attributes = TRUE) %>% filter(sce %in% c("CORE"))
L254.FinalEnergyKeyword_trn <- get_data(all_data, "L254.FinalEnergyKeyword_trn",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorLogit <- get_data(all_data, "L254.tranSubsectorLogit",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorShrwtFllt <- get_data(all_data, "L254.tranSubsectorShrwtFllt",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorInterp <- get_data(all_data, "L254.tranSubsectorInterp",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorSpeed <- get_data(all_data, "L254.tranSubsectorSpeed",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorSpeed_passthru <- get_data(all_data, "L254.tranSubsectorSpeed_passthru",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorSpeed_noVOTT <- get_data(all_data, "L254.tranSubsectorSpeed_noVOTT",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorSpeed_nonmotor <- get_data(all_data, "L254.tranSubsectorSpeed_nonmotor",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorVOTT <- get_data(all_data, "L254.tranSubsectorVOTT",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.tranSubsectorFuelPref <- get_data(all_data, "L254.tranSubsectorFuelPref",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.StubTranTech <- get_data(all_data, "L254.StubTranTech",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.StubTech_passthru <- get_data(all_data, "L254.StubTech_passthru",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.StubTech_nonmotor <- get_data(all_data, "L254.StubTech_nonmotor",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.StubTranTechLoadFactor <- get_data(all_data, "L254.StubTranTechLoadFactor",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.StubTranTechCost <- get_data(all_data, "L254.StubTranTechCost",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.StubTranTechCoef <- get_data(all_data, "L254.StubTranTechCoef",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.PerCapitaBased_trn <- get_data(all_data, "L254.PerCapitaBased_trn",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.PriceElasticity_trn <- get_data(all_data, "L254.PriceElasticity_trn",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L254.IncomeElasticity_trn <- get_data(all_data, "L254.IncomeElasticity_trn",strip_attributes = TRUE)%>% filter(sce %in% c("CORE"))
L154.in_EJ_state_trn_m_sz_tech_F <- get_data(all_data, "L154.in_EJ_state_trn_m_sz_tech_F",strip_attributes = TRUE)
L154.out_mpkm_state_trn_nonmotor_Yh <- get_data(all_data, "L154.out_mpkm_state_trn_nonmotor_Yh",strip_attributes = TRUE)

Expand Down
Loading

0 comments on commit f0ea4a0

Please sign in to comment.