-
Notifications
You must be signed in to change notification settings - Fork 1
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
126 rebuild wastewater emissions #154
Merged
pawilfahrt
merged 25 commits into
dev-2005-baseline
from
126-rebuild-wastewater-emissions
Jan 23, 2025
Merged
126 rebuild wastewater emissions #154
pawilfahrt
merged 25 commits into
dev-2005-baseline
from
126-rebuild-wastewater-emissions
Jan 23, 2025
Conversation
This file contains 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
…ased off the EPA State Inventory Tool - Wastewater module This script hard codes annual rates of protein consumption by humans (see Inventory of U.S. Greenhouse Gas Emissions and Sinks (U.S. EPA 2023))
…EPA State Inventory Tool. This routine runs all subroutines and exports rds files by county, year, and emission source (e.g. municipal wastewater CH4, municipal wastewater n20 direct and effluent)
…ng. Found in Table 7-34 of the EPA's Greenhouse Gas Emissions and Sinks 2023 report.
…tewater methane emissions.
…s oxide emissions from municipal wastewater.
…ous oxide emissions from municipal wastewater.
…T Wastewater Module.
…ssions and Sinks)
…s_Table 7-34_Annual_protein_consumption.csv Signed-off-by: Peter Wilfahrt <[email protected]>
pawilfahrt
reviewed
Jan 23, 2025
pawilfahrt
reviewed
Jan 23, 2025
…/Metropolitan-Council/ghg-cprg into 126-rebuild-wastewater-emissions
pawilfahrt
approved these changes
Jan 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely coded. Big improvement over the previous iteration. Note a few comments I made and resolved. We do need to rerun the 00_compile script with CTU data as well. I'll add an issue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist
Please complete this checklist as a courtesy to the PR reviewer.
Code and styling
setwd()
file.path(here::here(), "file_name"))
to source any scripts or read in datarenv::install()
styler::style_dir(".", recursive = TRUE, filetype = c("R", "qmd"))
source = "chunk-name"
inplot_ly()
councilR::plotly_layout()
?out.width: "95%"
. If a specific height is needed, use pixels. and/orout.height: "500px"
Document editing
render_for_publication.R
GitHub and project management
Follows a similar organizational convention to the agriculture sector scripts. In short, the relevant scripts live in _waste/data-raw/wastewater/, exported RDS files go to _waste/data/.
Start by opening the script "00_compile_wastewater_emissions.R".
This sources 5 other scripts, each with a 01, 02, or 03 prefix. These must be run sequentially. The good thing is that you can just source down the entire "00_compile_wastewater_emissions.R" script and it should execute everything in the correct order.
The two "01" scripts return lookup tables from the EPA State Inventory Tool Wastewater Module (as well as annual protein consumption per capita estimates).
The remaining scripts are built so that when you source them, a wrapper function gets added to the environment. Each wrapper function is unique but fundamentally does the same thing: scales ghg emissions per unit person. So for example, the script "02_compile_ww_municipal_ch4.R" returns a function "calculate_mww_ch4_emissions()" which estimates methane emissions from municipal wastewater on a per capita basis.
Running all 3 functions will give a complete inventory of ghg emissions from n2o and ch4 across various wastewater subsectors.
Ancillary data that is absolutely essential here is contained within the "~/_waste/data-raw/wastewater/epa/" directory. Make sure you don't delete the "epa" folder.
Finally, there's a little plotting code at the end of the "00_compile_wastewater_emissions.R" script, just to check how everything looks.