Skip to content
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

parameters for PA2024CH #242

Merged
merged 12 commits into from
Feb 29, 2024
Merged

parameters for PA2024CH #242

merged 12 commits into from
Feb 29, 2024

Conversation

cjyetman
Copy link
Member

@cjyetman cjyetman commented Feb 25, 2024

closes #238

  • check currency_exchange_value equals exchange rate in official currencies.rds
  • check sectors
  • check technologies
  • check scenarios
  • check default selected scenarios
  • check scenario geographies
  • check equity markets

@cjyetman cjyetman marked this pull request as draft February 25, 2024 16:23
Copy link

github-actions bot commented Feb 25, 2024

Docker image from this PR (3e04af4) created

docker pull ghcr.io/rmi-pacta/workflow.transition.monitor:pr242

@AlexAxthelm
Copy link
Collaborator

@cjyetman which of these need to be finalized in order to run the audit process? (web_tool_script_1.R)

@cjyetman
Copy link
Member Author

That's a tough question. Never really thought of things in that way. But probably at least...

data_location_ext: ../pacta-data/2023Q4/
has_revenue: FALSE
has_credit: FALSE
inc_emissionfactors: TRUE

@cjyetman
Copy link
Member Author

maybe only...

default:

    paths:
        data_location_ext: ../pacta-data/2023Q4/

since has_revenue, has_credit, has_map, and inc_emissionfactors will get a default setting set to them (with warning)

── web_tool_script_1.R ────────────────────────────────────────────────────────────────────────────────────────────────────
Warning messages:                                                                                                        
1: In set_project_parameters(file.path(working_location, "parameter_files",  :
  Warning: has_map set to standard value (TRUE) as it is not defined in the parameter file
2: In set_project_parameters(file.path(working_location, "parameter_files",  :
  Warning: has_credit set to standard value (FALSE) as it is not defined in the parameter file
3: In set_project_parameters(file.path(working_location, "parameter_files",  :
  Warning: has_revenue set to standard value (FALSE) as it is not defined in the parameter file
4: In set_project_parameters(file.path(working_location, "parameter_files",  :
  Warning: inc_emission_factors set to standard value (FALSE) as it is not defined in the parameter file

@cjyetman
Copy link
Member Author

cjyetman commented Feb 26, 2024

What I did with workflow.pacta is get the params down to the minimal set, so what's in https://github.com/RMI-PACTA/workflow.pacta/blob/main/input_dir/default_config.json is the minimal set for both web_tool_script 1 & 2

(though I did make some name changes and added the input and output directories)

@AlexAxthelm
Copy link
Collaborator

That's a tough question. Never really thought of things in that way. But probably at least...

data_location_ext: ../pacta-data/2023Q4/
has_revenue: FALSE
has_credit: FALSE
inc_emissionfactors: TRUE

Who are the right people to get signoff on those parameters? Are these pretty safe to inherit from default (cc @hodie )

@cjyetman
Copy link
Member Author

cjyetman commented Feb 26, 2024

has_revenue is archaic, and the code basically assumes FALSE

has_revenue_data = FALSE,

inc_emissionfactors should presumably always be true as long as we have emissions data, which we do, e.g.

if (inc_emission_factors) {
entity_emission_intensities <- readRDS(
file.path(analysis_inputs_path, "iss_entity_emission_intensities.rds")
)

has_credit I'm pretty sure even pre-dates this repo and is no longer used (there was a time where we had data for this, but it was long ago)

data_location_ext is mostly up to us and how we name the data directory

has_map is not used in the audit process, but it will throw a warning during the audit process if it's not there. It should almost definitely be TRUE, otherwise it won't produce the data needed for the map in the interactive report.

@AlexAxthelm
Copy link
Collaborator

Awesome. Sounds like those are pretty clear. I think we can start testing the audit process then.

AlexAxthelm added a commit that referenced this pull request Feb 27, 2024
@AlexAxthelm AlexAxthelm mentioned this pull request Feb 27, 2024
remove `financial_timestamp` and `dataprep_timestamp`
@cjyetman
Copy link
Member Author

sector/technology pairs in recent data.prep outputs

library(tidyverse)

root_dir <- "~/Downloads"
timestamp_dir <- "2023Q4_20240228T144514Z"

equity_abcd_scenario <- readRDS(file.path(root_dir, timestamp_dir, "equity_abcd_scenario.rds"))
bonds_abcd_scenario <- readRDS(file.path(root_dir, timestamp_dir, "bonds_abcd_scenario.rds"))

equity_abcd_scenario %>% 
  select(ald_sector, technology) %>% 
  distinct() %>% 
  arrange(ald_sector, technology)
#> # A tibble: 17 × 2
#>    ald_sector technology          
#>    <chr>      <chr>               
#>  1 Automotive FuelCell            
#>  2 Automotive ICE                 
#>  3 Aviation   Freight             
#>  4 Aviation   Passenger           
#>  5 Cement     Integrated facility 
#>  6 Coal       Coal                
#>  7 Oil&Gas    Gas                 
#>  8 Oil&Gas    Oil                 
#>  9 Power      CoalCap             
#> 10 Power      GasCap              
#> 11 Power      HydroCap            
#> 12 Power      NuclearCap          
#> 13 Power      OilCap              
#> 14 Power      RenewablesCap       
#> 15 Steel      Basic Oxygen Furnace
#> 16 Steel      Electric Arc Furnace
#> 17 Steel      Open Hearth Furnace

bonds_abcd_scenario %>% 
  select(ald_sector, technology) %>% 
  distinct() %>% 
  arrange(ald_sector, technology)
#> # A tibble: 17 × 2
#>    ald_sector technology          
#>    <chr>      <chr>               
#>  1 Automotive FuelCell            
#>  2 Automotive ICE                 
#>  3 Aviation   Freight             
#>  4 Aviation   Passenger           
#>  5 Cement     Integrated facility 
#>  6 Coal       Coal                
#>  7 Oil&Gas    Gas                 
#>  8 Oil&Gas    Oil                 
#>  9 Power      CoalCap             
#> 10 Power      GasCap              
#> 11 Power      HydroCap            
#> 12 Power      NuclearCap          
#> 13 Power      OilCap              
#> 14 Power      RenewablesCap       
#> 15 Steel      Basic Oxygen Furnace
#> 16 Steel      Electric Arc Furnace
#> 17 Steel      Open Hearth Furnace

sector/technology pairs available in raw asset data

library(tidyverse)

masterdata_own_path <- "~/Documents/Data/Asset Impact/2024-02-15_AI_RMI_2023Q4/2024-02-14_AI_RMI Bespoke_Company Data Products_masterdata_ownership_2023Q4.csv"
masterdata_debt_path <- "~/Documents/Data/Asset Impact/2024-02-15_AI_RMI_2023Q4/2024-02-14_AI_RMI Bespoke_Company Data Products_masterdata_debt_2023Q4.csv"

masterdata_own <- pacta.data.preparation::import_ar_masterdata(masterdata_own_path)
masterdata_debt <- pacta.data.preparation::import_ar_masterdata(masterdata_debt_path)

masterdata_own %>% 
  select(sector, technology) %>% 
  distinct() %>% 
  arrange(sector, technology) %>% 
  print(n = 50)
#> # A tibble: 40 × 2
#>    sector   technology              
#>    <chr>    <chr>                   
#>  1 Aviation Freight                 
#>  2 Aviation Passenger               
#>  3 Cement   Integrated facility     
#>  4 Coal     Anthracite Metallurgical
#>  5 Coal     Anthracite Thermal      
#>  6 Coal     Bituminous Metallurgical
#>  7 Coal     Bituminous Thermal      
#>  8 Coal     Lignite Thermal         
#>  9 Coal     Sub-Bituminous Thermal  
#> 10 HDV      Electric                
#> 11 HDV      Fuel Cell               
#> 12 HDV      Hybrid No-Plug          
#> 13 HDV      ICE CNG                 
#> 14 HDV      ICE Diesel              
#> 15 HDV      ICE Gasoline            
#> 16 HDV      ICE Hydrogen            
#> 17 HDV      ICE Propane             
#> 18 LDV      Electric                
#> 19 LDV      Fuel Cell               
#> 20 LDV      Hybrid No-Plug          
#> 21 LDV      Hybrid Plug-In          
#> 22 LDV      ICE CNG                 
#> 23 LDV      ICE Diesel              
#> 24 LDV      ICE E85+                
#> 25 LDV      ICE Gasoline            
#> 26 LDV      ICE Propane             
#> 27 Oil&Gas  Gas                     
#> 28 Oil&Gas  Natural Gas Liquids     
#> 29 Oil&Gas  Oil and Condensate      
#> 30 Power    CoalCap                 
#> 31 Power    GasCap                  
#> 32 Power    HydroCap                
#> 33 Power    NuclearCap              
#> 34 Power    OilCap                  
#> 35 Power    RenewablesCap           
#> 36 Shipping Freight                 
#> 37 Shipping Passenger               
#> 38 Steel    Basic Oxygen Furnace    
#> 39 Steel    Electric Arc Furnace    
#> 40 Steel    Open Hearth Furnace

masterdata_debt %>% 
  select(sector, technology) %>% 
  distinct() %>% 
  arrange(sector, technology) %>% 
  print(n = 50)
#> # A tibble: 40 × 2
#>    sector   technology              
#>    <chr>    <chr>                   
#>  1 Aviation Freight                 
#>  2 Aviation Passenger               
#>  3 Cement   Integrated facility     
#>  4 Coal     Anthracite Metallurgical
#>  5 Coal     Anthracite Thermal      
#>  6 Coal     Bituminous Metallurgical
#>  7 Coal     Bituminous Thermal      
#>  8 Coal     Lignite Thermal         
#>  9 Coal     Sub-Bituminous Thermal  
#> 10 HDV      Electric                
#> 11 HDV      Fuel Cell               
#> 12 HDV      Hybrid No-Plug          
#> 13 HDV      ICE CNG                 
#> 14 HDV      ICE Diesel              
#> 15 HDV      ICE Gasoline            
#> 16 HDV      ICE Hydrogen            
#> 17 HDV      ICE Propane             
#> 18 LDV      Electric                
#> 19 LDV      Fuel Cell               
#> 20 LDV      Hybrid No-Plug          
#> 21 LDV      Hybrid Plug-In          
#> 22 LDV      ICE CNG                 
#> 23 LDV      ICE Diesel              
#> 24 LDV      ICE E85+                
#> 25 LDV      ICE Gasoline            
#> 26 LDV      ICE Propane             
#> 27 Oil&Gas  Gas                     
#> 28 Oil&Gas  Natural Gas Liquids     
#> 29 Oil&Gas  Oil and Condensate      
#> 30 Power    CoalCap                 
#> 31 Power    GasCap                  
#> 32 Power    HydroCap                
#> 33 Power    NuclearCap              
#> 34 Power    OilCap                  
#> 35 Power    RenewablesCap           
#> 36 Shipping Freight                 
#> 37 Shipping Passenger               
#> 38 Steel    Basic Oxygen Furnace    
#> 39 Steel    Electric Arc Furnace    
#> 40 Steel    Open Hearth Furnace


ai_data_path <- "~/Documents/Data/Asset Impact/2024-02-15_AI_RMI_2023Q4/2024-02-14_AI_2023Q4_RMI-Company-Indicators.xlsx"
ai_data <- pacta.data.preparation::import_ar_advanced_company_indicators(ai_data_path)

ai_data %>% 
  select(`Asset Sector`, `Asset Technology`) %>% 
  distinct() %>% 
  arrange(`Asset Sector`, `Asset Technology`) %>% 
  print(n = 50)
#> # A tibble: 40 × 2
#>    `Asset Sector` `Asset Technology`      
#>    <fct>          <fct>                   
#>  1 Aviation       Freight                 
#>  2 Aviation       Passenger               
#>  3 Cement         Integrated facility     
#>  4 Coal           Anthracite Metallurgical
#>  5 Coal           Anthracite Thermal      
#>  6 Coal           Bituminous Metallurgical
#>  7 Coal           Bituminous Thermal      
#>  8 Coal           Lignite Thermal         
#>  9 Coal           Sub-Bituminous Thermal  
#> 10 HDV            Electric                
#> 11 HDV            Fuel Cell               
#> 12 HDV            Hybrid No-Plug          
#> 13 HDV            ICE CNG                 
#> 14 HDV            ICE Diesel              
#> 15 HDV            ICE Gasoline            
#> 16 HDV            ICE Hydrogen            
#> 17 HDV            ICE Propane             
#> 18 LDV            Electric                
#> 19 LDV            Fuel Cell               
#> 20 LDV            Hybrid No-Plug          
#> 21 LDV            Hybrid Plug-In          
#> 22 LDV            ICE CNG                 
#> 23 LDV            ICE Diesel              
#> 24 LDV            ICE E85+                
#> 25 LDV            ICE Gasoline            
#> 26 LDV            ICE Propane             
#> 27 Oil&Gas        Gas                     
#> 28 Oil&Gas        Natural Gas Liquids     
#> 29 Oil&Gas        Oil and Condensate      
#> 30 Power          CoalCap                 
#> 31 Power          GasCap                  
#> 32 Power          HydroCap                
#> 33 Power          NuclearCap              
#> 34 Power          OilCap                  
#> 35 Power          RenewablesCap           
#> 36 Shipping       Freight                 
#> 37 Shipping       Passenger               
#> 38 Steel          Basic Oxygen Furnace    
#> 39 Steel          Electric Arc Furnace    
#> 40 Steel          Open Hearth Furnace

@jdhoffa
Copy link
Member

jdhoffa commented Feb 29, 2024

For automotive, sector technology pairs should be fixed here: https://github.com/RMI-PACTA/pacta.scenario.preparation/pull/139

Note: I am not sure what to do (or if we need to do anything?) about the SDA sectors (Cement, Steel and Aviation). The "technology" for all of those is NA, is that going to cause problems?

We do not have any technology level pathways for those sectors... (as is always the case)

@cjyetman
Copy link
Member Author

Note: I am not sure what to do (or if we need to do anything?) about the SDA sectors (Cement, Steel and Aviation). The "technology" for all of those is NA, is that going to cause problems?

We do not have any technology level pathways for those sectors... (as is always the case)

data.prep outputs include the technology, based on the AI data I suppose

@cjyetman
Copy link
Member Author

re-rerunning data.prep with scenario.prep fix https://github.com/RMI-PACTA/pacta.scenario.preparation/pull/139 we get Automotive sector and technologies Electric, FuelCell, Hybrid, and ICE, so sectors and technologies look good now

library(tidyverse)

root_dir <- "~/Desktop/dataprep23Q4_docker/outputs"
timestamp_dir <- "2023Q4_20240229T102948Z"

equity_abcd_scenario <- readRDS(file.path(root_dir, timestamp_dir, "equity_abcd_scenario.rds"))

equity_abcd_scenario %>% 
  select(ald_sector, technology) %>% 
  distinct() %>% 
  arrange(ald_sector, technology)
#> # A tibble: 19 × 2
#>    ald_sector technology          
#>    <chr>      <chr>               
#>  1 Automotive Electric            
#>  2 Automotive FuelCell            
#>  3 Automotive Hybrid              
#>  4 Automotive ICE                 
#>  5 Aviation   Freight             
#>  6 Aviation   Passenger           
#>  7 Cement     Integrated facility 
#>  8 Coal       Coal                
#>  9 Oil&Gas    Gas                 
#> 10 Oil&Gas    Oil                 
#> 11 Power      CoalCap             
#> 12 Power      GasCap              
#> 13 Power      HydroCap            
#> 14 Power      NuclearCap          
#> 15 Power      OilCap              
#> 16 Power      RenewablesCap       
#> 17 Steel      Basic Oxygen Furnace
#> 18 Steel      Electric Arc Furnace
#> 19 Steel      Open Hearth Furnace

@cjyetman cjyetman marked this pull request as ready for review February 29, 2024 12:13
@cjyetman
Copy link
Member Author

I've validated this as much as I can, so I think it's good to go now. @jdhoffa @AlexAxthelm

jdhoffa
jdhoffa previously approved these changes Feb 29, 2024
Copy link
Member

@jdhoffa jdhoffa left a comment

Choose a reason for hiding this comment

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

Just questions for my own understanding, nothing blocking

parameter_files/ProjectParameters_PA2024CH.yml Outdated Show resolved Hide resolved
Copy link
Member

@jdhoffa jdhoffa left a comment

Choose a reason for hiding this comment

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

lgtm

@cjyetman cjyetman merged commit cc49276 into main Feb 29, 2024
2 checks passed
@cjyetman cjyetman deleted the PA2024CH-parameters branch February 29, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Parameters file for PA2024CH
4 participants