Skip to content

A Custom Location can grow along a stored country trajectory - #94

Merged
HughRunyan merged 7 commits into
mainfrom
custom-location-grows-along-stored-country
Oct 20, 2026
Merged

HughRunyan merged 7 commits into
mainfrom
custom-location-grows-along-stored-country

Conversation

@HughRunyan

@HughRunyan HughRunyan commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #91. Merge #91 first; this PR then targets main.

What

City.dst_baseline_blank takes population_series, the same way load_csv_new does since #91: the country's population by year from country_population_trajectory, which WasteMAP's map build stores. A Custom Location's waste, and its scenario's, grow along it instead of along SWEET's own pops_yearly.csv. The tonnage still comes from the population passed in; the two growth rates a person reads (growth_rate_historic / growth_rate_future) are still the country's, as in load_csv_new. Without the argument nothing changes.

As a WasteMAP maintainer, I want the city DST's Custom Location to grow along the same stored country trajectory as everything else, so that a SWEET pin change can't make it grow differently from the build behind it.

Does any number move?

Checked every country SWEET knows (250; a 1,000,000-person Custom Location; baseline emissions and waste by year), SWEET's table vs the stored trajectory (after #91's 67e21ca, which keeps the UN's fractions of a person):

  • 12 places with fallback rates (Antarctica, …): bit-identical.
  • The other 238: within 5.9e-16 (median 3.6e-16). SWEET divides each year's population by the 2022 figure, which can land one unit in the last place away. Growth rates within 2.2e-16.

Acceptance criteria

  • dst_baseline_blank(..., population_series=s) grows the baseline and scenario waste along s / s[2022].
  • The country's own trajectory reproduces the old Custom Location to 1e-14; a fallback-rate country's exactly.
  • The two growth rates stay the country's.
  • No caller that omits the argument changes.

Tests: 3 new in tests/test_population_trajectory.py (fail before the change). Full suite: 572 passed.

Paired WasteMAP PR: RMI/WasteMAP#890. Same change on the ADST branch: #95 (with RMI/WasteMAP#891).

Definition of Done

Acceptance criteria met · tests pass · changelog updated · reviewed & merged.

🤖 Generated with Claude Code

HughRunyan and others added 5 commits October 20, 2026 07:50
…o SWEET

city_population_trajectory and country_population_trajectory give a city's or a
country's population in every model year, with what its shape comes from, and
load_csv_new takes a stored trajectory as population_series. WasteMAP's map build
stores them so its city DST grows a city the way the build did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rounding to whole people bent the curve of the few places WPP interpolates
(Svalbard and Jan Mayen: 2,591.78 people in 2022, the 1975/2022 ratio off by
0.03%), so a Custom Location there would not grow as dst_baseline_blank does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
City.dst_baseline_blank takes population_series, as load_csv_new does: the
country's population by year from country_population_trajectory, which
WasteMAP's map build stores. The Custom Location's waste, and its scenario's,
grow along it instead of along SWEET's own table; the tonnage still comes from
the population given, and the two rates a person reads stay the country's.
Without it nothing changes.

Handed the country's own trajectory, every country's Custom Location comes out
within 5.9e-16 of before, and the 12 with fallback rates exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from population-trajectories to main October 20, 2026 16:29
@HughRunyan
HughRunyan requested a balanced review from Copilot October 20, 2026 16:29

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.

🟢 Approval recommended

The optional override follows existing growth paths, has targeted regression coverage, and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Extends #91’s stored population trajectories to Custom Locations, keeping their waste growth aligned with WasteMAP’s stored build data.

Changes:

  • Adds optional population_series support while preserving population-based tonnage, reported growth rates, and default behavior.
  • Tests baseline growth, fallback equivalence, and scenario growth.
  • Documents the feature in the changelog.
File Description
tests/​test_population_trajectory.py Tests stored trajectories and Custom Location behavior.
SWEET_python/​city_params.py Adds trajectory helpers and optional stored-series growth.
changelog/​2026-10.md Documents trajectory support and numerical compatibility.

Review effort: Balanced

#91/#92 were squash-merged, so the base's own files are taken from origin/main and
only this branch's Custom Location change is kept on top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HughRunyan
HughRunyan merged commit 88ddb56 into main Oct 20, 2026
2 checks passed
@HughRunyan
HughRunyan deleted the custom-location-grows-along-stored-country branch October 20, 2026 18:31
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