Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ weo_2024:
weo_2024_raw_path: "weo_2024/WEO2024 extended data"
weo_2024_ext_data_regions_raw_filename: "WEO2024_Extended_Data_Regions.csv"
weo_2024_ext_data_world_raw_filename: "WEO2024_Extended_Data_World.csv"
weo_2024_fig_chptr_3_raw_filename: "WEO2024_Figures_Chapter_03.xlsx"
iea_global_ev_raw_path: "iea_global_ev_2024"
iea_global_ev_raw_filename: "IEA Global EV Data 2024.csv"
weo_2024_fig_chptr_3_raw_full_filepath: 'weo_2024/WEO2024 extended data/WEO2024_Figures_Chapter_03.xlsx'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this config, I strive to always separate paths from filenames, which has organizational impact later on in the scripts

iea_global_ev_raw_filename: "electric-vehicle-sales-by-region-and-scenario-2030-and-2035.xlsx"
mpp_ats_raw_path: "mpp_ats-20240227"
mpp_ats_raw_filename: "2022-08-12 - MPP ATS - RPK and GHG intensity.xlsx"
hybrid_methodology: "hybrid_in_ev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a filename, path, or something else?


2022Q4:
inherits: [geco_2022, isf_2021, weo_2022]
Expand Down
40 changes: 21 additions & 19 deletions process_scenario_weo_2024.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ logger::log_info("WEO 2024: Setting WEO 2024 config.")
weo_2024_raw_path <- config[["weo_2024_raw_path"]]
weo_2024_ext_data_regions_raw_filename <- config[["weo_2024_ext_data_regions_raw_filename"]]
weo_2024_ext_data_world_raw_filename <- config[["weo_2024_ext_data_world_raw_filename"]]
weo_2024_fig_chptr_3_raw_filename <- config[["weo_2024_fig_chptr_3_raw_filename"]]
iea_global_ev_2024_raw_path <- config[["iea_global_ev_raw_path"]]
iea_global_ev_2024_raw_filename <- config[["iea_global_ev_raw_filename"]]
weo_2024_fig_chptr_3_raw_full_filepath <- config[["weo_2024_fig_chptr_3_raw_full_filepath"]]
mpp_ats_raw_path <- config[["mpp_ats_raw_path"]]
mpp_ats_raw_filename <- config[["mpp_ats_raw_filename"]]

hybrid_methodology <- config[["hybrid_methodology"]]

logger::log_info("WEO 2024: Setting WEO 2024 paths.")

weo_2024_raw_full_path <-
Expand All @@ -29,21 +30,9 @@ weo_2024_ext_data_world_raw_full_filepath <-
weo_2024_ext_data_world_raw_filename
)

weo_2024_fig_chptr_3_raw_full_filepath <-
file.path(
weo_2024_raw_full_path,
weo_2024_fig_chptr_3_raw_filename
)

iea_global_ev_2024_raw_full_path <-
file.path(
scenario_preparation_inputs_path,
iea_global_ev_2024_raw_path
)

iea_global_ev_2024_raw_full_filepath <-
file.path(
iea_global_ev_2024_raw_full_path,
weo_2024_raw_full_path,
iea_global_ev_2024_raw_filename
)

Expand Down Expand Up @@ -87,11 +76,21 @@ weo_2024_fig_chptr_3_raw <-
)

iea_global_ev_2024_raw <-
readr::read_csv(
file = iea_global_ev_2024_raw_full_filepath,
show_col_types = FALSE
read_xlsx(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer explicit name spacing, e.g.

Suggested change
read_xlsx(
readxl::read_xlsx(

path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric-vehicle-sales-by-regio"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it intentional that the sheet name ends with "regio" not "region"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sheet name is truncated when uploading data from IEA website, so sheet name title will be electric-vehicle-sales-by-regio

)

iea_sales_share_ev <- read_xlsx(
path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric vehicle share-ev"
)

iea_sales_share_bev_phev <- read_xlsx(
path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric-vehicle-share-bev-phev"
)

Comment on lines +84 to +93
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer explicit name spacing, e.g.

Suggested change
iea_sales_share_ev <- read_xlsx(
path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric vehicle share-ev"
)
iea_sales_share_bev_phev <- read_xlsx(
path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric-vehicle-share-bev-phev"
)
iea_sales_share_ev <- readxl::read_xlsx(
path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric vehicle share-ev"
)
iea_sales_share_bev_phev <- readxl::read_xlsx(
path = iea_global_ev_2024_raw_full_filepath,
sheet = "electric-vehicle-share-bev-phev"
)

mpp_ats_raw <-
tidyxl::xlsx_cells(
path = mpp_ats_raw_full_filepath
Expand All @@ -100,11 +99,14 @@ mpp_ats_raw <-
logger::log_info("WEO 2024: Processing WEO 2024 data.")

weo_2024 <-
pacta.scenario.data.preparation::prepare_weo_2024_scenario(
prepare_weo_2024_scenario(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer explicit name spacing, e.g.

Suggested change
prepare_weo_2024_scenario(
pacta.scenario.data.preparation::prepare_weo_2024_scenario(

weo_2024_ext_data_regions_raw,
weo_2024_ext_data_world_raw,
weo_2024_fig_chptr_3_raw,
iea_global_ev_2024_raw,
iea_sales_share_ev,
iea_sales_share_bev_phev,
hybrid_methodology,
mpp_ats_raw
)

Expand Down
Loading