Skip to content

Commit

Permalink
only run the global aggregate when appropriate scenario data is avail…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
CJ Yetman - RMI authored and CJ Yetman - RMI committed May 2, 2024
1 parent f326cb8 commit 9475f42
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions R/dataprep_abcd_scen_connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,25 @@ dataprep_abcd_scen_connection <- function(abcd_data,
index_regions
)

abcd_scenario_global_aggregate <- dataprep_connect_abcd_with_scenario(
abcd_data,
scenario_data,
global_aggregate = TRUE,
reference_year = reference_year,
relevant_years = relevant_years,
tech_exclude = tech_exclude,
scenario_geographies_list = scenario_geographies_list,
sector_list = sector_list,
other_sector_list = other_sector_list,
global_aggregate_scenario_sources_list = global_aggregate_scenario_sources_list,
global_aggregate_sector_list = global_aggregate_sector_list,
scenario_regions,
index_regions
)
if (any(unique(scenario_data$scenario_source) %in% global_aggregate_scenario_sources_list)) {
abcd_scenario_global_aggregate <- dataprep_connect_abcd_with_scenario(
abcd_data,
scenario_data,
global_aggregate = TRUE,
reference_year = reference_year,
relevant_years = relevant_years,
tech_exclude = tech_exclude,
scenario_geographies_list = scenario_geographies_list,
sector_list = sector_list,
other_sector_list = other_sector_list,
global_aggregate_scenario_sources_list = global_aggregate_scenario_sources_list,
global_aggregate_sector_list = global_aggregate_sector_list,
scenario_regions,
index_regions
)
} else {
abcd_scenario_global_aggregate <- data.frame()
}


# Combine Global aggregate dataset with regional dataset:
Expand Down

0 comments on commit 9475f42

Please sign in to comment.