Skip to content

fix(wcf): remove PUE double-counting; feat: error handling, config loaders, output options#231

Open
vinisha231 wants to merge 33 commits into
mlco2:mainfrom
vinisha231:main
Open

fix(wcf): remove PUE double-counting; feat: error handling, config loaders, output options#231
vinisha231 wants to merge 33 commits into
mlco2:mainfrom
vinisha231:main

Conversation

@vinisha231
Copy link
Copy Markdown

Summary

This PR addresses four tracked issues with real fixes and full test coverage.

🐛 fix: remove PUE double-counting in request_usage_wcf (#230)

request_energy already embeds datacenter_pue. The previous formula multiplied by datacenter_pue a second time for the electricity-mix WUE term, inflating water impact by PUE² on that component. WUE is also defined relative to IT energy (pre-PUE), so the datacenter cooling term now divides out PUE before applying datacenter_wue.

Before: request_energy * (datacenter_wue + datacenter_pue * if_electricity_mix_wue)
After: (request_energy / datacenter_pue) * datacenter_wue + request_energy * if_electricity_mix_wue

🚨 feat: actionable error messages for new users (#100)

  • ProviderNotInstalledError — includes pip install ecologits[provider] hint
  • InvalidProviderError — lists all valid providers in the message
  • ConfigurationError — for bad config/init state
  • OpenTelemetryNotInstalledError — replaces silent logger + bare EcoLogitsError

📁 feat: load configuration from file or environment (#98)

  • load_config_from_json(path) / EcoLogits.init_from_config(path)
  • load_config_from_yaml(path) / EcoLogits.init_from_yaml(path) (pyyaml optional)
  • load_config_from_env() / EcoLogits.init_from_env() — reads ECOLOGITS_PROVIDERS, ECOLOGITS_ELECTRICITY_MIX_ZONE, ECOLOGITS_OPENTELEMETRY_ENDPOINT

📊 feat: richer output options for impact results (#118)

  • Impacts.to_dict(), Impacts.to_json(), Impacts.summary(), Impacts.__repr__
  • BaseImpact.to_dict(), BaseImpact.__repr__
  • RangeValue.to_dict(), __repr__, __sub__, __rsub__, __neg__, __abs__
  • impacts_to_csv(impacts) — CSV export with phase/metric/value/unit columns

Other improvements

  • EcoLogits.reset() classmethod for test isolation
  • 4 new warning codes: electricity-mix-not-available, model-arch-deprecated, provider-data-unavailable, impact-estimate-uncertain
  • All impact model classes exported from ecologits.impacts
  • Fixed docstring: gpu_energy gamma coefficient was mislabelled "Beta"

Test plan

  • tests/test_wcf_pue.py — WCF PUE regression tests
  • tests/test_exceptions.py — exception hierarchy and message content
  • tests/test_config.py — JSON, YAML, env config loaders
  • tests/test_ecologits_init.pyinit_from_config, init_from_env integration
  • tests/test_output_options.pyto_dict, to_json, summary, __repr__
  • tests/test_export.pyimpacts_to_csv
  • tests/test_impacts_modeling.py — BaseImpact and Impacts model methods
  • Updated tests/test_range_value.py and tests/test_status_messages.py

🤖 Generated with Claude Code

vinisha231 added 30 commits May 13, 2026 11:30
request_energy already embeds datacenter_pue. The previous formula
multiplied by datacenter_pue a second time for the electricity-mix WUE
term, inflating water impact by a factor of PUE^2 on that component.
WUE is also defined relative to IT energy (pre-PUE), so the datacenter
cooling term now divides out PUE before applying datacenter_wue.
…ng, ProviderDataUnavailableWarning, ImpactEstimateUncertainWarning
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.

1 participant