WasteMAP's tools grow waste with the country's UN population, year by year - #71
Merged
Merged
Conversation
… year Climate TRACE's pipeline grows each site by P(year) / P(anchor year) from the UN's WPP2024. WasteMAP's paths compounded two flat rates: the site tool's form value, the cities table's columns, and one constant for every Custom Location. SWEET now ships pops_yearly.csv (Climate TRACE's table, extended back to 1950) and grows by it: - site tool: growth_rate_override=None means the country's population; a passed rate is compounded as before - city tool and the map's city emissions: a city under 300,000 grows with its country, because its table rates are the nearest big city's; a bigger city keeps its own UN city rates unless one is implausible (-2% to +7% a year) - Custom Location, and the city scenario's waste and diversions Climate TRACE's paths are unchanged; they pass their own pop_data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…blish Review fixes for #71: - Countries are found by exact code or name before the fuzzy search, which turned "MUS" into Turkey (province Mus) and "Niger" into Nigeria. That now mattered, because the code picks the population series. - CityParameters keeps the city's own two rates as the loader read them (city_growth_rate_*). WasteMAP's map build republishes those, so the city tool re-running _city_growth on the table reaches the same choice. - A custom site's prefill starts the rate from the country's population projection, not the 2019 default table. - The growth constructors call growth_factors_for_years once each instead of keeping parallel series/scalar branches (bit-identical on 1,584 cases); DivsDF.create_simple computes the factors once, not per stream. - constants.py names both copies of the population table. - The changelog bullet links its PRs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What this changes
WasteMAP's tools grow waste with the country's UN population, year by year, the way Climate TRACE's model already does: P(year) / P(anchor year), from the UN's World Population Prospects 2024.
Before, WasteMAP compounded flat rates:
Paired with RMI/WasteMAP#839, on the same branch name so WasteMAP CI installs this branch.
Why
As a WasteMAP modeler, I want the site and city tools to grow waste the way Climate TRACE's model does, so the tools and the published Climate TRACE numbers agree.
The city columns come from the UN's list of cities over 300,000 (World Urbanization Prospects 2018), matched to the nearest listed city. A smaller city therefore had another city's rates, and for many Brazilian towns those were wrong:
The bug
/v1/city_emissions/*,/v1/site_emissions/sdst_v1_5) and the map-data build (make_cities_table.py).load_csv_neworload_andre_params, e.g. Serra da Saudade (BRA, 781 people), fromcities_for_map_20260930T135753Z. Its "Population Growth Rate" columns are −8.56% / +83.03%, and SWEET compounds them. For Custom Location, calldst_baseline_blankfor any country: the growth rates are the same constants everywhere.Changes
SWEET_python/pops_yearly.csv: Climate TRACE'sstatic_data/pops_yearly.csv(1970–2050) unchanged, plus 1950–1969 from the same UN file, because the site tool models from a landfill's real opening year.pops.csv.SWEET_python/population.py:country_population_series(iso3)andaverage_growth_rates(series, anchor_year). The averages are the one-number rates a person reads, which the city tool shows.cityparams_obj_for_blank_siteandsdst_v1_5takegrowth_rate_override=Noneto mean the country's population. A passed rate is compounded exactly as before.load_csv_new,load_andre_params): a city under 300,000 grows with its country.dst_baseline_blank) grows with its country. The constant was 2.5% a year to 2020, then 1.4%, everywhere.implement_dst_changes_simple_v1_5) grows its waste and diversions the same way as its baseline.WasteGeneratedDF.create_advanced,create_advanced_2andDivsDF.create_simpletakepopulation_series. Without it they compute exactly what they did.Climate TRACE's pipeline calls none of the changed functions; it passes its own
pop_data. Its outputs do not move.Effect (city tool baseline, this branch vs main,
cities_for_map_20260930T135753Z)Review fixes
CityParameters.city_growth_rate_*keeps a city's own rates as read. WasteMAP's map build republishes those, so the city tool re-running_city_growthon the table makes the same choice. Publishing the applied averages had turned 13 big cities, e.g. Bangkok and Manila City, back into flat rates.growth_factors_for_yearsonce each: bit-identical on 1,584 cases.constants.pynames both copies of the population table.Tests
tests/test_population_growth.py(18 tests), which checks:Acceptance criteria
Definition of done
Acceptance criteria met · tests and checks pass · changelog updated · reviewed and merged, together with the WasteMAP PR.
🤖 Generated with Claude Code