USEPA / standardizedinventories

Standardized Release and Waste Inventories
MIT License
25 stars 16 forks source link

secondary compartment/context assignment #106

Closed a-w-beck closed 2 years ago

a-w-beck commented 2 years ago

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.

bl-young commented 2 years ago

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