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
[x] Update the documentation to reflect changes made in this PR
[x] Format all updated python files using ruff
[x] Clear outputs from all notebooks modified
[x] Add docstrings and type hints to any new functions created
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
andemissions
modules, due to the import ofCLEAN_FUELS
into theload_data
module.What the code is doing
Moves
CLEAN_FUELS
(along with some other constants) to a newconstants.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
ruff