-
Notifications
You must be signed in to change notification settings - Fork 16
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
secondary compartment/context assignment #106
Merged
Merged
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
point esupy and stewi feature branches at one another
…ntext_secondary module functions (urban/rural, release height); implementation in NEI and TRI such that secondary compartment labels are concatenated into primary Compartment columns or stored separately for facility dfs (which lack a Compartment col). Quick refactor of other functions to eliminate inplace=True method calls.
…appens via esupy.context_secondary.main() rather than above in StEWI. Concatenation still defined in stewi.globals.
…xt_secondary.main(), plus additional flow control updates. Assign_secondary_context now returns unmodified pd.df's when geospatial dependencies are unavailable. Migrated conda env.yaml file up from esupy.
Explain stewi connection to esupy's optional geospatial installation instructions
bl-young
reviewed
Apr 18, 2022
bl-young
reviewed
Apr 18, 2022
- pip: | ||
- pyarrow==6.0.1 # causes error if installed via conda default channel "OSError: NotImplemented: Support for codec 'snappy' not built" | ||
- requests_ftp==0.3.1 | ||
- "--editable=git+https://github.com/USEPA/standardizedinventories.git@urban_rural_classify#egg=StEWI" |
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.
we'll need to remember to update this to develop or master
… has_geo_pkgs = False. Simplified and improved both assign_secondary_context() and concat_compartment().
ed52ed1
to
05be46d
Compare
…the [if 'cmpt_urb' in tri_facility.columns:] block
…or TRI soil and water primary compartments; refine and rename stewicombo.globals.filter_by_compartment to filter on primary compartment
…rlap handler is updated
@WesIngwersen this is ready to pull in. Slightly revised versions of NEI and TRI 2017 have been added to sharepoint. |
Merged
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.
Assign release height and urban/rural secondary compartments to TRI and NEI facilities and associated flows using esupy's new context_secondary module, handled via a new
stewi.globals
function. Release height relies on simple binning and labeling by facility stack height, and only applies to emissions with a primaryair
compartment. The urban/rural classification uses Census Urban Area and Cluster (UAC) shapefiles to identify whether or not a facility lies within an urban area polygon, and applies to emissions across all primary compartments.The new
stewi.globals.assign_secondary_context
function coordinates this assignment flexibly using*args
string codes to perform one or both assignments. Including the 'concat' string argument can then invokeconcat_compartment
(as inNEI.py
), or it can be called separately (seeTRI.py
).Additionally, safeguards and error handling are included to check for the geospatial dependencies (
GeoPandas
,Shapely
, etc.)—which can be difficult to install on certain platforms—before attempting the urban/rural assignment. The resulting TRI and NEI metadata files reflect whether or not the urban/rural classification was able to proceed and store anUrbanRural
field in the output.