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

secondary compartment/context assignment #106

Merged
merged 21 commits into from
May 9, 2022
Merged

Conversation

a-w-beck
Copy link
Contributor

@a-w-beck a-w-beck commented Apr 15, 2022

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 primary air 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 invoke concat_compartment (as in NEI.py), or it can be called separately (see TRI.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 an UrbanRural field in the output.

a-w-beck and others added 12 commits February 24, 2022 10:42
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
setup.py Outdated Show resolved Hide resolved
- 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"
Copy link
Collaborator

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().
…the [if 'cmpt_urb' in tri_facility.columns:] block
@bl-young bl-young linked an issue Apr 19, 2022 that may be closed by this pull request
@a-w-beck a-w-beck marked this pull request as draft May 4, 2022 15:45
@a-w-beck a-w-beck marked this pull request as ready for review May 4, 2022 15:46
@bl-young bl-young requested a review from WesIngwersen May 4, 2022 18:14
@bl-young
Copy link
Collaborator

bl-young commented May 4, 2022

@WesIngwersen this is ready to pull in. Slightly revised versions of NEI and TRI 2017 have been added to sharepoint.

@bl-young bl-young merged commit 7e229be into develop May 9, 2022
@bl-young bl-young mentioned this pull request Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust compartment in NEI based on reported stack height
2 participants