Modeled landfills use measured site oxidation when available#34
Open
HughRunyan wants to merge 4 commits into
Open
Modeled landfills use measured site oxidation when available#34HughRunyan wants to merge 4 commits into
HughRunyan wants to merge 4 commits into
Conversation
Previously every modeled landfill got a type/gas-capture default oxidation (sanitary 0.10 no-capture / 0.22 with capture; controlled dump 0.05/0.10; dumpsite 0). The pipeline input query carries a per-site `oxidation` column (populated for ~19% of rows from the standardized source table, NULL for the GPW/OSM area-matched branch) that was never read. site_only_estimate_trace and citysite_estimate_trace now prefer that input value over the default via a new _build_oxidation_series helper: - site-wide mean of non-null input values as the full-series baseline, then a per-year overwrite (mean of conflicting same-year rows) keyed by reported_emissions_year where present -- mirrors the existing gas_collection_efficiency handling; - no input -> the prior type/gas-capture default, broadcast across all years; - values used as-is (no clamping); the dead 0.25 biocover clamp does not apply. model-output-change: emissions shift for the ~19% of sites with a measured oxidation. Not a breaking change (schemas/contracts unchanged). Paired with RMI_Climate_TRACE_Waste_Methane ers-update. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The modeled baseline previously left each landfill's `flaring` unset, so it fell to model_v2's internal default (0.98 in the monthly path used by TRACE). There is no per-site flaring-efficiency source column (the source has only flared volumes and a has_flaring boolean), so no per-site value can be read. site_only_estimate_trace and citysite_estimate_trace now set flaring explicitly to dst_common.DEFAULT_FLARE_EFFICIENCY (0.98) on every TRACE landfill, so the value no longer depends on model internals. A function-local import is used because dst_common imports city_params (a top-level import would be circular). No TRACE output change: baseline flaring was already effectively 0.98 via the monthly default, so this is numerically identical. Mitigation still raises it to 0.98/0.99 for the few improve-GCCS strategies via _gccs_flaring's floor (max/clip). Deliberately NOT touched: model_v2's default handling. The annual estimate_emissions2 defaults unset flaring to 1.0 vs the monthly estimate_emissions_monthly's 0.98 -- a real inconsistency, but TRACE/mitigation only use the monthly path, and changing the annual default would shift WasteMAP/DST output. Left as a separate, optional cleanup. Paired with RMI_Climate_TRACE_Waste_Methane ers-update. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request updates the Climate TRACE modeled-landfill path to (1) prefer per-site input oxidation factors when provided by the input query and (2) explicitly set baseline flaring destruction efficiency to the project’s canonical default, avoiding reliance on model_v2 internal defaults.
Changes:
- Introduces
_build_oxidation_series(...)to construct a per-year oxidation factor series from input data (with fallback to the existing type/gas-capture defaults). - Wires the resulting oxidation series into
site_only_estimate_traceandcitysite_estimate_trace. - Sets
flaringexplicitly todst_common.DEFAULT_FLARE_EFFICIENCYfor TRACE-modeled landfills.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…_series The default-broadcast fallback when the input frame lacks a per-year 'oxidation' column is deliberate: it supports older callers (city DST / make_cities_table) that predate per-year oxidation. The Climate TRACE sites and cities pipelines both SELECT oxidation into their frames, so measured oxidation is used there. Comment only; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot #34: the docstring says time_series_rows is a Series for single-row sites, but the branch chain skipped it and fell to canonical_row. Add the Series branch so a single-row site's own time_series_rows oxidation is used (matches the documented contract). Harmless in the Climate TRACE pipelines (multi-row DataFrame path, or canonical_row carries the same value), but removes the code/docstring mismatch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
andre-scheinwald
approved these changes
Jul 13, 2026
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.
Summary
Modeled landfills previously always received a type/gas-capture default oxidation factor (sanitary 0.10 no-capture / 0.22 with capture; controlled dump 0.05/0.10; dumpsite 0). The Climate TRACE waste-methane pipeline's input query carries a per-site
oxidationcolumn (populated for ~19% of sites from the standardized source table; NULL for the GPW/OSM area-matched branch) that was never read. This wires it in.What changed
site_only_estimate_traceandcitysite_estimate_tracenow prefer the input oxidation over the default, via a new_build_oxidation_series(default, canonical_row, time_series_rows, years_range)helper:reported_emissions_yearwhere present — mirrors the existinggas_collection_efficiencyhandling one block below.doing_fancy_oxis hardcodedFalse) and does not apply here.The legacy WasteMAP builders (
site_only_estimate,sinar_city_and_site) are intentionally left on defaults — they use a different row schema and are not on the Climate TRACE modeled-site path.Model-output change (not breaking)
Emissions shift for the ~19% of sites with a measured oxidation; higher oxidation destroys more CH₄, so those sites model lower emissions. No API/schema/contract change.
Testing
RMI_Climate_TRACE_Waste_Methane/tests/manual/test_input_oxidation.py: helper logic (mean baseline, per-year overwrite, conflicting-same-year averaging, unclipped 0.35, out-of-range years, no-input fallback) + end-to-end baseline (default 0.10 / 0.22, input 0.35 propagates, higher oxidation lowers emissions).Definition of done
Paired PR
Consumed by RMI/RMI_Climate_TRACE_Waste_Methane#74 (same
ers-updatebranch), which carries the value through to the mitigation stage and addsmax(existing, new)oxidation semantics to the ERS strategies.Flaring baseline (added — explicit default)
Also sets each modeled landfill's flaring destruction efficiency explicitly to
dst_common.DEFAULT_FLARE_EFFICIENCY(0.98) insite_only_estimate_trace/citysite_estimate_trace, instead of leaving it unset and relying onmodel_v2's internal default. There is no per-site flaring-efficiency source (only flared volumes + ahas_flaringboolean), so 0.98 is the canonical default; mitigation raises it to 0.98/0.99 for the few improve-GCCS strategies via_gccs_flaring's floor (max/clip). No TRACE output change — numerically identical to the prior monthly default.model_v2's annual-vs-monthly default inconsistency (1.0 vs 0.98) was left untouched (TRACE never uses the annual path; changing it would shift WasteMAP output).🤖 Generated with Claude Code
Review responses (Copilot / andre)
_build_oxidation_seriesis intentional, and now documented (de1ef58). It serves callers whose input frame carries no per-yearoxidationcolumn — the older city DST /make_cities_tablepath, which predates per-year oxidation and supplies a single baseline value. The Climate TRACE sites and cities pipelines bothSELECT oxidationinto their multi-row frames, so measured oxidation is used there; this only defaults when the column is genuinely absent. (This "time-series for sites / single value for cities" switch is the reason severalisinstance(..., Series/DataFrame)branches exist here.)time_series_rows(aSeries) is now honored (7e7d1ef): the branch chain previously skipped it and fell tocanonical_row. Added theSeriesbranch so a single-row site's owntime_series_rowsoxidation is used, matching the docstring. Harmless in the TRACE pipelines (multi-rowDataFramepath, orcanonical_rowcarries the same value), but removes the code/docstring mismatch Copilot flagged.Merge note
Deploy pairs with RMI/RMI_Climate_TRACE_Waste_Methane#74 by branch name (
ers-update). Merge/land the two together.