When sectors in the same scenario file have different forward-looking time frames, target_market_share() errors. This does not seem warranted from a methodological perspective and it restricts the scenario information we can make available to users.
library(tidyverse)
library(r2dii.data)
library(r2dii.match)
library(r2dii.analysis)
abcd <- r2dii.data::abcd_demo %>%
mutate(year = year + 3)
lbk <- r2dii.data::loanbook_demo
region <- r2dii.data::region_isos
scenario_sda <- readr::read_csv("/Users/jkastl/Desktop/git/workflow.scenario.preparation/outputs/2023Q4_20240529_T073706Z/p4b_ei_scenarios_2023.csv")
#> Rows: 303 Columns: 7
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (5): scenario_source, region, scenario, sector, emission_factor_unit
#> dbl (2): year, emission_factor
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
scenario_tms <- readr::read_csv("/Users/jkastl/Desktop/git/workflow.scenario.preparation/outputs/2023Q4_20240529_T073706Z/p4b_scenarios_2023.csv")
#> Rows: 31932 Columns: 8
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (5): scenario_source, region, scenario, sector, technology
#> dbl (3): year, smsp, tmsr
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
matched <- r2dii.match::match_name(
loanbook = lbk,
abcd = abcd,
by_sector = TRUE
) %>%
r2dii.match::prioritize()
out_sda <- r2dii.analysis::target_sda(
data = matched,
abcd = abcd,
co2_intensity_scenario = scenario_sda,
region_isos = region
)
#> Warning: Removing rows in abcd where `emission_factor` is NA
scenario_tms_2030 <- scenario_tms %>%
dplyr::filter(year <= 2030)
scenario_tms %>%
dplyr::summarise(final_year = max(year), .by = "sector")
#> # A tibble: 4 × 2
#> sector final_year
#> <chr> <dbl>
#> 1 coal 2050
#> 2 oil and gas 2050
#> 3 power 2050
#> 4 automotive 2030
scenario_tms_2030 %>%
dplyr::summarise(final_year = max(year), .by = "sector")
#> # A tibble: 4 × 2
#> sector final_year
#> <chr> <dbl>
#> 1 coal 2030
#> 2 oil and gas 2030
#> 3 power 2030
#> 4 automotive 2030
out_tms_2030 <- r2dii.analysis::target_market_share(
data = matched,
abcd = abcd,
scenario = scenario_tms_2030,
region_isos = region
)
out_tms_standard <- r2dii.analysis::target_market_share(
data = matched,
abcd = abcd,
scenario = scenario_tms,
region_isos = region
)
#> Error in `check_no_value_is_missing()`:
#> ! Column `production_target` must not contain any `NA`s.
Created on 2024-05-30 with reprex v2.1.0
AB#11095
When sectors in the same scenario file have different forward-looking time frames, target_market_share() errors. This does not seem warranted from a methodological perspective and it restricts the scenario information we can make available to users.
Created on 2024-05-30 with reprex v2.1.0
AB#11095