Skip to content

City DST uses each city's reported gas-capture efficiency (not a hardcoded 60%)#31

Open
HughRunyan wants to merge 2 commits into
mainfrom
use-measured-gas-capture-efficiency
Open

City DST uses each city's reported gas-capture efficiency (not a hardcoded 60%)#31
HughRunyan wants to merge 2 commits into
mainfrom
use-measured-gas-capture-efficiency

Conversation

@HughRunyan

Copy link
Copy Markdown
Collaborator

Output

The city Decision Support Tool now uses a city's reported gas-capture efficiency where the source data has one, instead of assuming a flat 60% for every city.

User story

As an analyst using the city DST, I want the model to use my city's reported gas-capture efficiency (where we have it) rather than a blanket 60% assumption, so that landfill-methane estimates reflect the real data we hold.

What changed

City.load_andre_params (the builder the WasteMAP map-data pipeline uses for each city) previously hardcoded the with-capture landfill's gas-capture efficiency to 0.6 for every city — discarding the gas_capture_efficiency_percent value the pipeline already selects from the database. It now:

  • reads that source value via a new _normalize_gas_capture_efficiency helper — percentage form (500.50), a value already ≤ 1 treated as a fraction, and missing / NaN / non-numeric → the 0.6 model default;
  • lets it flow through _calculate_divs into the with-capture landfill and out to cities_for_map_*.csv's Methane Capture Efficiency (%) column (previously a flat 60).

⚠️ Model-output change

This changes model output values for cities whose source reports a real efficiency. In the current database that's a small number of rows — most gas_capture_efficiency_percent values are null; one city currently reports 50%. It is not a breaking change: no API or data-contract changes.

Acceptance criteria

  • Cities with a non-null source gas_capture_efficiency_percent use that value (as a fraction) for the with-capture landfill.
  • Cities with a null/missing value keep the 0.6 model default (no regression).
  • Percentage (50) and fraction (0.5) inputs both normalize to 0.50; non-numeric / NaN → default.
  • cities_for_map_*.csv's Methane Capture Efficiency (%) reflects the per-city value.

Definition of done

  • Change implemented
  • DB-free regression tests added (tests/test_gas_capture_efficiency.py, 13 cases, passing)
  • Changelog updated (changelog/2026-07.md)
  • Reviewed by a non-submitter & merged

Related

Companion tooling PR on the same-named branch in RMI/WasteMAP (local-only pipeline mode — how this change was verified locally without writing to Azure).

🤖 Generated with Claude Code

HughRunyan and others added 2 commits July 6, 2026 13:50
The simple city path built the with-capture landfill without a
gas_capture_efficiency, so the engine always filled the 0.6 model default and a
city's measured "Methane Capture Efficiency (%)" was silently ignored.

- load_csv_new now normalizes that column robustly: null -> None (falls back to
  the model default), a value > 1 is read as a percentage (60 -> 0.60), and a
  value <= 1 as a fraction (0.25 -> 0.25) — correct whether the source stores 25
  or 0.25. Negative/non-numeric -> None.
- _calculate_divs passes the measured efficiency (or None) to the with-capture
  landfill; None still falls back to Landfill's default.

model-output-change: cities whose record carries a real capture efficiency other
than 60% will now produce different baseline emissions. Almost all rows are null,
so most cities are unaffected. Not a breaking change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
load_andre_params (the map-data pipeline's city builder) hardcoded the
with-capture landfill's gas-capture efficiency to 0.6 for every city, discarding
the gas_capture_efficiency_percent the pipeline already selects from the DB. It
now reads that source value (percentage form, e.g. 50 -> 0.50) via a new
_normalize_gas_capture_efficiency helper, falling back to the 0.6 model default
when the source is null / NaN / non-numeric. The value flows through
_calculate_divs into the with-capture landfill and out to cities_for_map's
"Methane Capture Efficiency (%)" column (previously a flat 60).

model-output-change: cities whose source reports a real efficiency (currently
few — most rows are null) shift accordingly. Not a breaking change; downstream
contracts unchanged.

Adds DB-free regression tests (tests/test_gas_capture_efficiency.py, 13 cases)
and a July changelog entry.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@HughRunyan HughRunyan added enhancement New feature or request model-output-change Changes model OUTPUT values (expected progress, not breaking); results differ from prior runs labels Jul 7, 2026
@HughRunyan

Copy link
Copy Markdown
Collaborator Author

Companion tooling PR (how this was verified locally without writing to Azure): RMI/WasteMAP#714

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request model-output-change Changes model OUTPUT values (expected progress, not breaking); results differ from prior runs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant