singularity-energy / open-grid-emissions

Tools for producing high-quality hourly generation and emissions data for U.S. electric grids
MIT License
67 stars 4 forks source link

Fix circular import of CLEAN_FUELS and add constants #339

Closed grgmiller closed 4 months ago

grgmiller commented 4 months ago

Purpose

Some of the changes implemented in https://github.com/singularity-energy/open-grid-emissions/pull/337 introduced a circular import between the load_data and emissions modules, due to the import of CLEAN_FUELS into the load_data module.

What the code is doing

Moves CLEAN_FUELS (along with some other constants) to a new constants.py module to prevent a circular import.

While in the process of fixing this specific circular import, I also searched the repo for where other constants / assumptions were specified and consolidated them into constants.

In emissions.calculate_electric_allocation_factor() updated the calculation steps and column names to match the process described in the "Adjusting Emissions for CHP" docs (there is no methodological change here, just separating out several steps and renaming some variables to be more clear).

Testing

Tested importing OGE with this new branch in another package, and the circular import error was resolved.

Where to look

All files

Usage Example/Visuals

N/A

Review estimate

5 min

Future work

N/A

Checklist