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

Fix emissions reporting #530

Merged
merged 15 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
117 changes: 107 additions & 10 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -1879,8 +1879,45 @@ if (!is.null(vm_plasticsCarbon)) {
- out[, , "Emi|CO2|CDR|BECCS|Industry (Mt CO2/yr)"],
"Emi|CO2|Gross|Energy|+|Demand (Mt CO2/yr)"))

###########################################
## Gross emissions in Energy|Waste sector##
###########################################
# fixme: check that CDR addition makes sense
if (!is.null(vm_plasticsCarbon)){
# calculate gross emissions in energy waste sector
out <- mbind(out,
# total gross energy waste emissions
setNames(out[, , "Emi|CO2|Energy|+|Waste (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|Materials|+|Plastics (Mt CO2/yr)"],
"Emi|CO2|Gross|Energy|+|Waste (Mt CO2/yr)"))
}

###########################
## total gross variables ##
###########################
# if feedstocks are available
if (!is.null(vm_plasticsCarbon)){
out <- mbind(out,
# total gross energy emissions
setNames(out[, , "Emi|CO2|+|Energy (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|Materials|+|Plastics (Mt CO2/yr)"],
Copy link
Contributor

Choose a reason for hiding this comment

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

@strefler are these energy emissions? I would rather treat Emi|CO2|CDR|Materials|+|Plastics the same way as DACCS or EW. So they should probably be neither included in Emi|CO2|+|Energy nor be deduced from the respective Gross variable here. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a general issue we should discuss in the IAMC emissions group with everybody, that is, accounting of long-term CCU. I tend to be in favor of the convention that carbon stored in materials should be deduced from industry / energy emissions because that is how the IPCC emissions accounting defines energy-related emissions (i.e. only emissions from combustion). But I am happy to discuss further.

"Emi|CO2|Gross|Energy (Mt CO2/yr)"),

# total gross energy and industrial process emissions
setNames(out[, , "Emi|CO2|Energy and Industrial Processes (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|Materials|+|Plastics (Mt CO2/yr)"],
"Emi|CO2|Gross|Energy and Industrial Processes (Mt CO2/yr)"),

# total gross variables
# total gross emissions
setNames(out[, , "Emi|CO2 (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR (Mt CO2/yr)"],
"Emi|CO2|Gross (Mt CO2/yr)"))
} else {
# total gross variables if feedstocks are not available
out <- mbind(out,
# total gross energy emissions
setNames(out[, , "Emi|CO2|+|Energy (Mt CO2/yr)"]
Expand All @@ -1898,6 +1935,8 @@ if (!is.null(vm_plasticsCarbon)) {
setNames(out[, , "Emi|CO2 (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR (Mt CO2/yr)"],
"Emi|CO2|Gross (Mt CO2/yr)"))
}


# split into electric and non-electric energy supply emissions
out <- mbind(out,
Expand Down Expand Up @@ -2207,8 +2246,16 @@ if (!is.null(vm_plasticsCarbon)) {
setNames(out[, , "Emi|CO2|Energy|Demand|+|CDR (Mt CO2/yr)"],
"Emi|GHG|Energy|Demand|+|CDR (Mt CO2eq/yr)"))



###############################
## GHG energy waste emissions##
###############################
# note that Emi|GHG|Energy|Waste corresponds to end-of-life emissions of products of the chemicals sector
# and it is different to Emi|GHG|+++|Waste
if (!is.null(vm_plasticsCarbon)){
out <- mbind(out,
setNames(out[, , "Emi|CO2|Energy|+|Waste (Mt CO2/yr)"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not an accounting expert, so I have to ask: The UNFCCC inventories put waste in a separate category, so it is not part of the Energy emissions. But maybe this is the way we agreed on accounting for waste emissions in the Navigate-template/IAMC community. Or is that the emissions of waste used as energy feedstock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a very important point! indeed there's another category where we put non-CO2 emissions from waste management (CH4 emissions). But bringing those 2 together via coupling with waste-to-power capacities is a larger task that I think should not be part of this PR.

"Emi|GHG|Energy|+|Waste (Mt CO2eq/yr)"))
}

## gross GHG variables (ecxl. negative emissions from BECCS and carbon storage of carbon-neutral synthetic fuels)
## note Emi|CO2|CDR|... variables are negative. That's why we substract them to get from net to gross emissions.
Expand Down Expand Up @@ -2241,17 +2288,39 @@ if (!is.null(vm_plasticsCarbon)) {


setNames(out[, , "Emi|GHG|Energy|Demand|+|CDR (Mt CO2eq/yr)"],
"Emi|GHG|Gross|Energy|Demand|+|CDR (Mt CO2eq/yr)"),
"Emi|GHG|Gross|Energy|Demand|+|CDR (Mt CO2eq/yr)")

)

#############################################
## gross GHG variables if feedstocks exist ##
#############################################

##(ecxl. negative emissions from BECCS and carbon storage of carbon-neutral synthetic fuels)
## note Emi|CO2|CDR|... variables are negative. That's why we substract them to get from net to gross emissions.
if (!is.null(vm_plasticsCarbon)){
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to avoid duplicate code from these if-clauses and simply set all plastics related variables to zero if vm_plasticsCarbon doesn't exist but still add them up? Or would that cause problems somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe, but I wouldn't include it in this PR. Just trying to make it work, we can make it nicer later.

out <- mbind(out,

# total gross waste emissions
setNames(out[, , "Emi|GHG|Energy|+|Waste (Mt CO2eq/yr)"]
- out[, , "Emi|CO2|CDR|Materials|+|Plastics (Mt CO2/yr)"],
"Emi|GHG|Gross|Energy|+|Waste (Mt CO2eq/yr)"),

# total gross energy emissions
setNames(out[, , "Emi|GHG|+++|Energy (Mt CO2eq/yr)"]
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS (Mt CO2/yr)"],
- out[, , "Emi|CO2|CDR|BECCS (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|Materials|+|Plastics (Mt CO2/yr)"],
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above. Might not be Energy emissions

"Emi|GHG|Gross|Energy (Mt CO2eq/yr)")


)

} else {
# total gross energy emissions
setNames(out[, , "Emi|GHG|+++|Energy (Mt CO2eq/yr)"]
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS (Mt CO2/yr)"],
"Emi|GHG|Gross|Energy (Mt CO2eq/yr)")
}
## END of gross GHG variables if feedstocks exist ############################

# electric and non-electric supply GHG emissions (needed for total GHG stacked plots with gross emissions)

Expand Down Expand Up @@ -2850,7 +2919,35 @@ if (!is.null(vm_plasticsCarbon)) {
return(tmp)
}

# emissions variables for which we want to calculate cumulative values

# emissions variables for which we want to calculate cumulative values
if (!is.null(vm_plasticsCarbon)) {
vars.cumulate <- c("Emi|GHG (Mt CO2eq/yr)",
"Emi|CO2 (Mt CO2/yr)",
"Emi|CO2|Energy and Industrial Processes (Mt CO2/yr)",
"Emi|CO2|Gross|Energy and Industrial Processes (Mt CO2/yr)",
"Emi|CO2|+|Energy (Mt CO2/yr)",
"Emi|CO2|+|Land-Use Change (Mt CO2/yr)",
"Emi|CO2|+|Industrial Processes (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|Transport (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|Industry (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|Buildings (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|CDR (Mt CO2/yr)",
"Emi|CO2|Energy|+|Waste (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|Demand|+|Industry (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|Supply|Non-electric (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|Supply|+|Electricity (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|+|Waste (Mt CO2/yr)",
"Emi|CO2|CDR (Mt CO2/yr)",
"Emi|CO2|CDR|BECCS (Mt CO2/yr)",
"Emi|CO2|CDR|BECCS|Pe2Se (Mt CO2/yr)",
"Emi|CO2|CDR|BECCS|Industry (Mt CO2/yr)",
"Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)",
"Emi|CO2|CDR|DACCS (Mt CO2/yr)",
"Emi|CO2|CDR|EW (Mt CO2/yr)",
"Emi|CO2|CDR|Land-Use Change (Mt CO2/yr)",
"Emi|CO2|CDR|Materials|+|Plastics (Mt CO2/yr)")
}else{
vars.cumulate <- c("Emi|GHG (Mt CO2eq/yr)",
"Emi|CO2 (Mt CO2/yr)",
"Emi|CO2|Energy and Industrial Processes (Mt CO2/yr)",
Expand All @@ -2873,7 +2970,7 @@ if (!is.null(vm_plasticsCarbon)) {
"Emi|CO2|CDR|DACCS (Mt CO2/yr)",
"Emi|CO2|CDR|EW (Mt CO2/yr)",
"Emi|CO2|CDR|Land-Use Change (Mt CO2/yr)")

}

# variable names for cumulated emissions variables
names.cumul <- vars.cumulate
Expand Down
4 changes: 4 additions & 0 deletions inst/extdata/additional_summation_checks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Emi|CO2;Emi|CO2|CDR|BECCS;1
Emi|CO2;Emi|CO2|CDR|Industry CCS|Synthetic Fuels;1
Emi|CO2;Emi|CO2|CDR|DACCS;1
Emi|CO2;Emi|CO2|CDR|EW;1
Emi|CO2;Emi|CO2|Gross|Energy|+|Waste;1
Emi|CO2;Emi|CO2|CDR|Materials|+|Plastics;1
;;
# total GHG emissions by CO2 sectors and non-CO2 gases;;
Emi|GHG 1;Emi|CO2|+|Energy;1
Expand All @@ -58,10 +60,12 @@ Emi|CO2|Cumulated;Emi|CO2|Cumulated|Energy|Demand|Buildings;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|Energy|Demand|CDR;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|Gross|Energy|Supply|Non-electric;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|Gross|Energy|Supply|Electricity;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|Gross|Energy|Waste;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|CDR|BECCS;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|CDR|Industry CCS|Synthetic Fuels;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|CDR|DACCS;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|CDR|EW;1
Emi|CO2|Cumulated;Emi|CO2|Cumulated|CDR|Materials|Plastics;1
;;
# total CDR;;
Emi|CO2|CDR;Emi|CO2|CDR|Land-Use Change;1
Expand Down
Loading