-
Notifications
You must be signed in to change notification settings - Fork 0
Weo 2024 antoine v2 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dc3c6f7
just the beginning
cjyetman de0ff7f
FEAT: add automotive to WEO2024
Antoine-Lalechere 3dce217
change path name
Antoine-Lalechere 0ee66fa
update config
Antoine-Lalechere b342a3f
add _ecb in name file
Antoine-Lalechere 690f0bf
remove useless file
Antoine-Lalechere 46ba8e6
clear spacing
Antoine-Lalechere 0c3ef7e
adapt function name
Antoine-Lalechere 8670cf0
remove parameter in the function
Antoine-Lalechere e78352d
change name file
Antoine-Lalechere a474057
Merge branch 'main' into weo_2024_antoine_v2
cjyetman 175ba5e
replace _ecb by _hybrid_in_ev in process_scenario_weo
Antoine-Lalechere 220e7a7
update config file
Antoine-Lalechere 710dcc2
remove empty line
Antoine-Lalechere a37034f
Update process_scenario_weo_2024_hybrid_in_ev.R
jacobvjk 59eef12
Update process_scenario_weo_2024_hybrid_in_ev.R
Antoine-Lalechere 037c33c
Update process_scenario_weo_2024_hybrid_in_ev.R
Antoine-Lalechere 451f00a
Update config.yml
Antoine-Lalechere 1c8dce5
remove useless file
Antoine-Lalechere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| 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"]] | ||
| iea_global_ev_2024_raw_filename <- config[["iea_global_ev_raw_filename"]] | ||
| weo_2024_fig_chptr_3_raw_full_filename <- config[["weo_2024_fig_chptr_3_raw_full_filename"]] | ||
Antoine-Lalechere marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| mpp_ats_raw_path <- config[["mpp_ats_raw_path"]] | ||
| mpp_ats_raw_filename <- config[["mpp_ats_raw_filename"]] | ||
|
|
||
| logger::log_info("WEO 2024: Setting WEO 2024 paths.") | ||
|
|
||
| weo_2024_raw_full_path <- | ||
| file.path( | ||
| scenario_preparation_inputs_path, | ||
| weo_2024_raw_path | ||
| ) | ||
|
|
||
| weo_2024_ext_data_regions_raw_full_filepath <- | ||
| file.path( | ||
| weo_2024_raw_full_path, | ||
| weo_2024_ext_data_regions_raw_filename | ||
| ) | ||
|
|
||
| weo_2024_ext_data_world_raw_full_filepath <- | ||
| file.path( | ||
| weo_2024_raw_full_path, | ||
| weo_2024_ext_data_world_raw_filename | ||
| ) | ||
|
|
||
| iea_global_ev_2024_raw_full_filepath <- | ||
| file.path( | ||
| weo_2024_raw_full_path, | ||
| iea_global_ev_2024_raw_filename | ||
| ) | ||
|
|
||
| weo_2024_fig_chptr_3_raw_full_filepath <- | ||
| file.path( | ||
| weo_2024_raw_full_path, | ||
| weo_2024_fig_chptr_3_raw_full_filename | ||
Antoine-Lalechere marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| mpp_ats_raw_full_path <- | ||
| file.path( | ||
| scenario_preparation_inputs_path, | ||
| mpp_ats_raw_path | ||
| ) | ||
|
|
||
| mpp_ats_raw_full_filepath <- | ||
| file.path( | ||
| mpp_ats_raw_full_path, | ||
| mpp_ats_raw_filename | ||
| ) | ||
|
|
||
| logger::log_info("WEO 2024: Checking that WEO 2024 filepaths exist.") | ||
|
|
||
| stopifnot(fs::file_exists(weo_2024_ext_data_regions_raw_full_filepath)) | ||
| stopifnot(fs::file_exists(weo_2024_ext_data_world_raw_full_filepath)) | ||
| stopifnot(fs::file_exists(weo_2024_fig_chptr_3_raw_full_filepath)) | ||
| stopifnot(fs::file_exists(iea_global_ev_2024_raw_full_filepath)) | ||
| stopifnot(fs::file_exists(mpp_ats_raw_full_filepath)) | ||
|
|
||
| logger::log_info("WEO 2024: Loading WEO 2024 raw data.") | ||
|
|
||
| weo_2024_ext_data_regions_raw <- | ||
| readr::read_csv( | ||
| file = weo_2024_ext_data_regions_raw_full_filepath, | ||
| show_col_types = FALSE | ||
| ) | ||
|
|
||
| weo_2024_ext_data_world_raw <- | ||
| readr::read_csv( | ||
| file = weo_2024_ext_data_world_raw_full_filepath, | ||
| show_col_types = FALSE | ||
| ) | ||
|
|
||
| weo_2024_fig_chptr_3_raw <- | ||
| tidyxl::xlsx_cells( | ||
| path = weo_2024_fig_chptr_3_raw_full_filepath | ||
| ) | ||
|
|
||
| iea_global_ev_2024_raw <- | ||
| readxl::read_xlsx( | ||
| path = iea_global_ev_2024_raw_full_filepath, | ||
| sheet = "electric-vehicle-sales-by-regio" | ||
| ) | ||
|
|
||
| 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" | ||
| ) | ||
cjyetman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| mpp_ats_raw <- | ||
| tidyxl::xlsx_cells( | ||
| path = mpp_ats_raw_full_filepath | ||
| ) | ||
|
|
||
| logger::log_info("WEO 2024: Processing WEO 2024 data.") | ||
|
|
||
| weo_2024 <- | ||
| pacta.scenario.data.preparation::prepare_weo_2024_hybrid_in_ev_scenario( | ||
| weo_2024_ext_data_regions_raw = weo_2024_ext_data_regions_raw, | ||
| weo_2024_ext_data_world_raw = weo_2024_ext_data_world_raw, | ||
| weo_2024_fig_chptr_3_raw = weo_2024_fig_chptr_3_raw, | ||
| iea_global_ev_2024_raw = iea_global_ev_2024_raw, | ||
| iea_sales_share_ev = iea_sales_share_ev, | ||
| mpp_ats_raw = mpp_ats_raw | ||
| ) | ||
|
|
||
| if (pacta.data.validation::validate_intermediate_scenario_output(weo_2024)) { | ||
| logger::log_info("WEO 2024: WEO 2024 data is valid.") | ||
|
|
||
| output_path <- fs::path(scenario_preparation_outputs_path, "weo_2024_hybrid_in_ev.csv") | ||
|
|
||
| readr::write_csv( | ||
| x = weo_2024, | ||
| file = output_path | ||
| ) | ||
|
|
||
| logger::log_info("WEO 2024: WEO 2024 data saved to {output_path}.") | ||
|
|
||
| } else { | ||
| logger::log_error("WEO 2024 data is not valid.") | ||
| stop() | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.