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

target_* should output units of production #258

Open
jdhoffa opened this issue Jan 4, 2021 · 0 comments
Open

target_* should output units of production #258

jdhoffa opened this issue Jan 4, 2021 · 0 comments
Labels
ADO Maintenance Day! feature a feature request or enhancement good first issue ❤️ good issue for first-time contributors medium Likely finished in under a week

Comments

@jdhoffa
Copy link
Member

jdhoffa commented Jan 4, 2021

We should:

  • Check that the input ald has a column production_unit and ald_emission_factor_unit
  • Check that each value for unit is identical by sector (all units within a sector should be comparable)
  • Output said unit next to the production column, or emission_factor column of the target_* functions

Thanks @jacobvjk

library(r2dii.data)
library(r2dii.match)
library(r2dii.analysis)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

production_units_by_sec <- ald_demo %>% 
  distinct(sector, production_unit)

# each sector should have one production unit account for the whole sector
production_units_by_sec
#> # A tibble: 8 x 2
#>   sector      production_unit
#>   <chr>       <chr>          
#> 1 power       MW             
#> 2 cement      tonnes per year
#> 3 oil and gas GJ per day     
#> 4 shipping    active ships   
#> 5 aviation    active planes  
#> 6 coal        tonnes per year
#> 7 automotive  cars produced  
#> 8 steel       tonnes per year

matched <- match_name(
  loanbook_demo,
  ald_demo
) %>% 
  prioritize()

# curently output has no `unit` column
out <- target_market_share(
  matched, 
  ald_demo, 
  scenario_demo_2020,
  region_isos_demo
)

# My proposed output would look something like this (though not using a join)
out %>% 
  left_join(production_units_by_sec) %>% 
  select(sector, technology, production, production_unit)
#> Joining, by = "sector"
#> # A tibble: 3,492 x 4
#>    sector     technology production production_unit
#>    <chr>      <chr>           <dbl> <chr>          
#>  1 automotive electric      324592. cars produced  
#>  2 automotive electric      324592. cars produced  
#>  3 automotive electric      324592. cars produced  
#>  4 automotive electric      324592. cars produced  
#>  5 automotive electric      339656. cars produced  
#>  6 automotive electric      329191. cars produced  
#>  7 automotive electric      352505. cars produced  
#>  8 automotive electric      330435. cars produced  
#>  9 automotive electric      354720. cars produced  
#> 10 automotive electric      333693. cars produced  
#> # … with 3,482 more rows

Created on 2021-01-04 by the reprex package (v0.3.0)

AB#9898

@jdhoffa jdhoffa added good first issue medium Likely finished in under a week labels Jun 8, 2021
@jdhoffa jdhoffa added feature a feature request or enhancement good first issue ❤️ good issue for first-time contributors and removed enhancement labels Apr 14, 2023
@jdhoffa jdhoffa self-assigned this Feb 6, 2024
@jdhoffa jdhoffa added the ADO Maintenance Day! label Feb 6, 2024
@jdhoffa jdhoffa added ADO Maintenance Day! and removed ADO Maintenance Day! labels Feb 19, 2024
@jdhoffa jdhoffa removed their assignment Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO Maintenance Day! feature a feature request or enhancement good first issue ❤️ good issue for first-time contributors medium Likely finished in under a week
Projects
None yet
Development

No branches or pull requests

1 participant