Closed Tilmon closed 1 year ago
@AnneSchoenauer copying my answer from Slack here as well:
@Anne Schoenauer the reason is that sometimes we have for the same combination of weo_sector
, weo_subsector
, ipr_sector
, ipr_subsector
multiple rows of tilt_sector
and tilt_subsector
.
Check out the current tilt-scenario-mapper here: https://docs.google.com/spreadsheets/d/1ER0vFyyLan6OB3kG6r40-oJq1SUotk5-cvtVksnzwT4/edit#gid=1431070032
The reason for that is that weo, ipr, and tilt has different levels of granularity.
This clearly shows that we need to re-calibrate the sector mappers for the next version. After this learning we might want to optimize it in a way that tilt sector are less granular than weo and ipr so that a weo-ipr combination never leads more than 1 tilt sector.
For this version, the following info is important to know: Even though the input shown in the ticket above has multiple sectors, the results are the same for each sector, because the underlying scenario sectors are the same. I.e., we can either
leave it as it is
aggregate tilt_sector
and tilt_subsectors
into one row for these cases
What do you think?
@maurolepore I used the following piece of code for a similar problem where I basically "summarized" and "pasted" rows into one row. Don't have the time to modify parameteres, but maybe still useful:
ptr_products_raw_avg <- ptr_products_raw_avg |>
group_by(country, main_activity, clustered) |>
summarise(across(everything(), ~ paste0(na.omit(unique(.)), collapse = "; "))) |>
mutate(co2_eq_kg_ipcc2021_gwp100 = if_else(multi_match == TRUE, avg_co2_footprint, co2_eq_kg_ipcc2021_gwp100)) |>
select(-avg_co2_footprint) |>
ungroup() |>
distinct()
Update: Issue resolved in new input data I provided to @maurolepore and @kalashsinghal. Therefore, I close this issue as done.
Hi @AnneSchoenauer ,
I want you to confirm one thing: In contrast to the PSTR results, the ISTR results actually show multiple sectors for the same input in separate rows. This leads to the result that the same input can have e.g. 12 rows, because it has 2
scenarios
x 2years
x 3tilt_sectors
. This is I think a consequence of 1-to-many relationships in the sector mappers.Do we agree, that we can keep it that way for now and look into this again for v2?
See reprex below for example data at the end of one input with 12 rows.
UPDATE
Created on 2023-06-05 with reprex v2.0.2
cc @kalashsinghal @maurolepore