City DST uses each city's reported gas-capture efficiency (not a hardcoded 60%)#31
Open
HughRunyan wants to merge 2 commits into
Open
City DST uses each city's reported gas-capture efficiency (not a hardcoded 60%)#31HughRunyan wants to merge 2 commits into
HughRunyan wants to merge 2 commits into
Conversation
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]>
Collaborator
Author
|
Companion tooling PR (how this was verified locally without writing to Azure): RMI/WasteMAP#714 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 to0.6for every city — discarding thegas_capture_efficiency_percentvalue the pipeline already selects from the database. It now:_normalize_gas_capture_efficiencyhelper — percentage form (50→0.50), a value already≤ 1treated as a fraction, and missing / NaN / non-numeric → the0.6model default;_calculate_divsinto the with-capture landfill and out tocities_for_map_*.csv'sMethane Capture Efficiency (%)column (previously a flat60).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_percentvalues are null; one city currently reports50%. It is not a breaking change: no API or data-contract changes.Acceptance criteria
gas_capture_efficiency_percentuse that value (as a fraction) for the with-capture landfill.0.6model default (no regression).50) and fraction (0.5) inputs both normalize to0.50; non-numeric / NaN → default.cities_for_map_*.csv'sMethane Capture Efficiency (%)reflects the per-city value.Definition of done
tests/test_gas_capture_efficiency.py, 13 cases, passing)changelog/2026-07.md)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