Skip to content

The city-level advanced DST sends waste no listed landfill takes to other landfills - #90

Merged
HughRunyan merged 4 commits into
am-waste-flowfrom
adst-city-routes-the-rest-to-other-landfills
Oct 20, 2026
Merged

HughRunyan merged 4 commits into
am-waste-flowfrom
adst-city-routes-the-rest-to-other-landfills

Conversation

@HughRunyan

@HughRunyan HughRunyan commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

AdvancedDSTCityRequest gains an optional other_landfills: a landfill spec (OtherLandfillsSpec) with no open or close years and no gate total. When it is given:

  • Other landfills take the rest. Each year they take 1 minus the shares of the listed landfills open that year. A caller can state the sites it knows about and leave the rest, without making the shares add up to 1.
  • A shut site's share goes to other landfills. In the years a listed landfill is shut (not yet open, or closed by its own dates or by a scenario's), its share goes to other landfills instead of being spread over the open ones.
  • Over 1 is scaled down, not refused. A year whose open listed landfills claim more than 1 is scaled down to 1, and other landfills take nothing that year.
  • landfills may be empty. landfill_split_timeline is required only when landfills lists any.

How: run_advanced_dst_city, run_advanced_dst_city_defaults and run_advanced_dst_city_limits each start by rewriting the request with other landfills listed as one more landfill (_with_other_landfills). That landfill opens with the model (1970, or a listed site's earlier opening) and never closes. Nothing downstream changes, so the run is the same, bit for bit, as one that lists that landfill at the leftover share. Other landfills come last in site_emissions, in the mass flow's sites and in the defaults.

Why: in the advanced DST's city mode, users have to make their site shares add up to 100%, or the frontend quietly scales them. WasteMAP's site list is incomplete, so most users can't name every site. With this, the WasteMAP frontend can send the shares users typed and let the model route the rest to "other landfills". The paired WasteMAP PR, RMI/WasteMAP#887, picks each city’s default type for other landfills and does the frontend work. Merge this one first.

User story: as an advanced DST user with data for a city and a few of its landfills, I want the waste I haven't assigned to go to a sensible default landfill, so that each site is modelled at the share I gave it and the city total still covers all of its waste.

Does this change a line marked # decision:?

  • No
  • Yes. A Climate TRACE pull request on the same branch name updates the entry:

Do model numbers change?

  • No. Requests without other_landfills run exactly as before, and SWEET's full fast suite passes locally (596 tests).
  • Yes. The PR is labelled model-output-change, and the changelog entry says how much they move.

Acceptance criteria

  • With other_landfills, listed shares summing to 0.625 leave 0.375 to other landfills.
  • A run with other landfills is bit-identical to one listing that landfill at the leftover share, checked on totals, per-site emissions and the mass flow.
  • A listed site's share goes to other landfills in the years it is shut: before it opens, after it closes, and after a scenario closure in the scenario only.
  • A year over 1 is scaled down, and other landfills take nothing that year.
  • landfills: [] with other_landfills runs. Without other_landfills it is refused.
  • Out-of-range listed shares are still refused. A pre-implement scenario row that the model discards is not.
  • Without other_landfills, shares must still sum to ~1.
  • run_advanced_dst_city_defaults and run_advanced_dst_city_limits take the same request.

Definition of done

  • Acceptance criteria met
  • Tests pass: tests/test_adst_city_other_landfills.py adds 18 tests
  • Changelog updated
  • Reviewed and merged

🤖 Generated with Claude Code

AdvancedDSTCityRequest gains other_landfills: one landfill spec with no
open or close years and no gate total. Each year it takes 1 minus the
shares of the listed landfills open that year, so a caller can state the
sites it knows and leave the rest, without balancing the shares to 1.
A listed landfill's share in years it is shut goes there too, instead of
being spread over the open ones, and a year claiming more than 1 is
scaled down rather than refused. landfills may now be empty.

Every entry point first lists other landfills as one more landfill
(_with_other_landfills), so a run with them is the same run, bit for
bit, as one listing that landfill at the leftover share. Requests
without the field are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HughRunyan HughRunyan added the enhancement New feature or request label Oct 20, 2026
HughRunyan and others added 2 commits October 19, 2026 20:38
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The request rewrite rejects empty scenario timelines instead of preserving the existing baseline fallback.

1 open issue
What changed in this PR

Adds optional “other landfills” to city-level advanced DST, routing unassigned waste without requiring callers to provide a complete landfill list.

Changes:

  • Rewrites requests to include a residual landfill across all three entry points.
  • Adds routing, validation, and equivalence tests.
  • Documents the new behavior in the changelog.
File Description
tests/​test_adst_city_other_landfills.py Tests residual routing and existing behavior compatibility.
SWEET_python/​advanced_dst_city.py Adds the optional landfill specification and request rewrite.
changelog/​2026-10.md Documents the feature and output ordering.

Review effort: Balanced

Comment thread SWEET_python/advanced_dst_city.py Outdated
… landfills

_with_other_landfills read each variant's split through variant_get, which
falls back to the baseline only on None, so scenario: {} raised
"landfill_split_timeline is required" in all three entry points. The run
itself treats an empty scenario split as the baseline's; the rewrite now does
too. Found by Copilot on #90.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HughRunyan
HughRunyan merged commit 7f8e11a into am-waste-flow Oct 20, 2026
2 checks passed
@HughRunyan
HughRunyan deleted the adst-city-routes-the-rest-to-other-landfills branch October 20, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants