A package for calculating electricity-related emissions and costs for optimization problem formulation and other computational analyses.
Useful Commands
pip install -e .
This will install your package in editable mode.
pytest electric_emission_cost/tests --cov=electric_emission_cost --cov-report=html
Produces an HTML test coverage report for the entire project which can be found at htmlcov/index.html.
docs/make html
This will generate an HTML version of the documentation which can be found at _build/html/index.html.
flake8 electric_emission_cost --count --verbose --show-source --statistics
This will lint the code and share all the style errors it finds.
black electric_emission_cost
This will reformat the code according to strict style guidelines.
Documentation
The documentation for this package is hosted on GitHub Pages.
Legal Documents
This work was supported by the following grants and programs:
National Alliance for Water Innovation (NAWI) (grant number UBJQH - MSM)
Department of Energy, the Office of Energy Efficiency and Renewable Energy, Advanced Manufacturing Office (grant number DE-EE0009499)
California Energy Commission (CEC) (grant number GFO-23-316)
Equitable, Affordable & Resilient Nationwide Energy System Transition (EARNEST) Consortium
Stanford Woods Institute Realizing Environmental Innovation Program (REIP)
Stanford Woods Institute Mentoring Undergraduate in Interdisciplinary Research (MUIR) Program
The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights.
Attribution
If you found this package useful, we encourage you to cite the following papers depending on which portion of the code you use:
Citing costs.py
The development of costs.py was the culmination of two papers from the WE3Lab.
The convex formulation of tariff costs for optimizing flexible loads was originally developed for a case study of flexible wastewater treatment plant operation published in Environmental Science & Technology:
Bolorinos, J., Mauter, M. S., & Rajagopal, R. Integrated energy flexibility management at wastewater treatment facilities. Environ. Sci. Technol. 57, 18362-18371. (2023). DOI: 10.1021/acs.est.3c00365
In BibTeX format:
@article{bolorinos2023integrated,
title={Integrated energy flexibility management at wastewater treatment facilities},
author={Bolorinos, Jose and Mauter, Meagan S and Rajagopal, Ram},
journal={Environmental Science \& Technology},
volume={57},
number={46},
pages={18362--18371},
year={2023},
publisher={ACS Publications},
url={https://doi.org/10.1021/acs.est.3c00365}
}
The tariff data format was published in the following data descriptor in Nature Scientific Data:
Chapin, F.T., Bolorinos, J. & Mauter, M.S. Electricity and natural gas tariffs at United States wastewater treatment plants. Sci Data 11, 113 (2024). DOI: 10.1038/s41597-023-02886-6
In BibTeX format:
@Article{Chapin2024,
author={Chapin, Fletcher T and Bolorinos, Jose and Mauter, Meagan S.},
title={Electricity and natural gas tariffs at United States wastewater treatment plants},
journal={Scientific Data},
year={2024},
month={Jan},
day={23},
volume={11},
number={1},
pages={113},
issn={2052-4463},
doi={10.1038/s41597-023-02886-6},
url={https://doi.org/10.1038/s41597-023-02886-6}
}
Citing emissions.py
The emissions optimization code was originally developed for co-optimizing costs and emissions at a wastewater treatment plant and published in Environmental Science & Technology:
Chapin, F.T., Wettermark, D., Bolorinos, J. & Mauter, M.S. Load-shifting strategies for cost-effective emission reductions at wastewater facilities Environ. Sci. Technol. 59, 2285-2294 (2025). DOI: 10.1021/acs.est.4c09773
In BibTeX format:
@article{chapin2025load,
title={Load-Shifting Strategies for Cost-Effective Emission Reductions at Wastewater Facilities},
author={Chapin, Fletcher T and Wettermark, Daly and Bolorinos, Jose and Mauter, Meagan S},
journal={Environmental Science \& Technology},
volume={59},
number={4},
pages={2285--2294},
year={2025},
publisher={ACS Publications},
url={https://pubs.acs.org/doi/10.1021/acs.est.4c09773}
}
Citing metrics.py
The flexibility metrics come from the following Nature Water paper:
Rao, A. K., Bolorinos, J., Musabandesu, E., Chapin, F. T., & Mauter, M. S. Valuing energy flexibility from water systems. Nat. Water 2, 1028-1037 (2024). DOI: 10.1038/s44221-024-00316-4
In BibTeX format:
@article{rao2024valuing,
title={Valuing energy flexibility from water systems},
author={Rao, Akshay K and Bolorinos, Jose and Musabandesu, Erin and Chapin, Fletcher T and Mauter, Meagan S},
journal={Nature Water},
volume={2},
number={10},
pages={1028--1037},
year={2024},
publisher={Nature Publishing Group UK London},
url={https://doi.org/10.1038/s44221-024-00316-4}
}
Metadata
Release files for electric-emission-cost 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| electric_emission_cost-0.0.5.tar.gz | 1.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| electric_emission_cost-0.0.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 1.6 MB
Release files / electric_emission_cost-0.0.5.tar.gz
| Download URL | electric_emission_cost-0.0.5.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33dc524bc3757331357f6afdd836828dfd61cb7cd22f268e091b25bc47df52de
|
|
BLAKE2b-256 checksum How to use checksums |
6305d9e4d9ad11c614c36d1f25634409b92e0cf51553297627c5eeabd2f948c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency logRelease files / electric_emission_cost-0.0.5-py2.py3-none-any.whl
| Download URL | electric_emission_cost-0.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 49.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
714e135fe00f3fbb5cb7899ee1bd7b0927f2e425eb5c8e61ccb178380ae83bd9
|
|
BLAKE2b-256 checksum How to use checksums |
67f5d1a4bbc2163795dd8fd74f69a2f2cc94bc9e028cc27a5da1520518de2a49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency log