diff --git a/defaults/population_weights.tsv b/defaults/population_weights.tsv
index 11a92a55d..a1b3b94ca 100644
--- a/defaults/population_weights.tsv
+++ b/defaults/population_weights.tsv
@@ -1,241 +1,240 @@
# [DO NOT EDIT] This file was generated by scripts/developer_scripts/get_population_weights
# Last updated on 2024-08-06
country weight
-China 1416043270
-India 1409128296
-United States 341963408
-Indonesia 281562465
-Pakistan 252363571
-Nigeria 236747130
-Brazil 220051512
-Bangladesh 168697184
-Russia 140820810
-Mexico 130739927
-Japan 123201945
-Ethiopia 118550298
-Philippines 118277063
-Congo, Democratic Republic of the 115403027
-Egypt 111247248
-Vietnam 105758975
-Iran 88386937
-Turkey (Turkiye) 84119531
-Germany 84119100
-Thailand 69920998
-United Kingdom 68459055
-France 68374591
-Tanzania 67462121
-Italy 60964931
-South Africa 60442647
-Kenya 58246378
-Myanmar 57527139
-South Korea 52081799
-Sudan 50467278
-Colombia 49588357
-Uganda 49283041
-Spain 47280433
-Algeria 47022473
-Argentina 46994384
-Iraq 42083436
-Afghanistan 40121552
-Canada 38794813
-Poland 38746310
-Morocco 37387585
-Angola 37202061
-Saudi Arabia 36544431
-Uzbekistan 36520593
-Ukraine 35661826
-Ghana 34589092
-Malaysia 34564810
-Mozambique 33350954
-Peru 32600249
-Yemen 32140443
-Venezuela 31250306
-Nepal 31122387
-Cameroon 30966105
-Cote d'Ivoire 29981758
-Madagascar 29452714
-Australia 26768598
-Niger 26342784
-Korea, North 26298666
-Syria 23865423
-Taiwan 23595274
-Burkina Faso 23042199
-Mali 21990607
-Sri Lanka 21982608
-Malawi 21763309
-Zambia 20799116
-Kazakhstan 20260006
-Chad 19093595
-Senegal 18847519
-Chile 18664652
-Ecuador 18309984
-Guatemala 18255216
-Romania 18148155
-Netherlands 17772378
-Zimbabwe 17150352
-Cambodia 17063669
-Benin 14697052
-Guinea 13986179
-Rwanda 13623302
-Burundi 13590102
-Somalia 13017273
-South Sudan 12703714
-Bolivia 12311974
-Tunisia 12048847
-Belgium 11977634
-Haiti 11753943
-Jordan 11174024
-Cuba 10966038
-Czechia 10837890
-Dominican Republic 10815857
-Azerbaijan 10650239
-Sweden 10589835
-Greece 10461091
-Tajikistan 10394063
-Portugal 10207177
-Papua New Guinea 10046233
-United Arab Emirates 10032213
-Hungary 9855745
-Honduras 9529188
-Belarus 9501451
-Israel 9402617
-Sierra Leone 9121049
-Austria 8967982
-Togo 8917994
-Switzerland 8860574
-Laos 7953556
-Paraguay 7522549
-Libya 7361263
-Hong Kong 7297821
-Bulgaria 6782659
-Nicaragua 6676948
-Serbia 6652212
-El Salvador 6628702
-Eritrea 6343956
-Kyrgyzstan 6172101
-Congo, Republic of the 6097665
-Singapore 6028459
-Denmark 5973136
-Turkmenistan 5744151
-Central African Republic 5650957
-Finland 5626414
-Slovakia 5563649
-Norway 5509733
-Liberia 5437249
-Lebanon 5364482
-Costa Rica 5265575
-Ireland 5233461
-New Zealand 5161211
-Georgia 4900961
-Panama 4470241
-Mauritania 4328040
-Croatia 4150116
-Oman 3901992
-Bosnia and Herzegovina 3798671
-Moldova 3599528
-Uruguay 3425330
-Mongolia 3281676
-West Bank 3243369
-Kuwait 3138355
-Albania 3107100
-Puerto Rico 3019450
-Armenia 2976765
-Jamaica 2823713
-Namibia 2803660
-Lithuania 2628186
-Qatar 2552088
-Gambia, The 2523327
-Gabon 2455105
-Botswana 2450668
-Lesotho 2227548
-Gaza Strip 2141643
-North Macedonia 2135622
-Guinea-Bissau 2132325
-Slovenia 2097893
-Kosovo 1977093
-Latvia 1801246
-Equatorial Guinea 1795834
-Bahrain 1566888
-Timor-Leste 1506909
-Trinidad and Tobago 1408966
-Cyprus 1320525
-Mauritius 1310504
-Estonia 1193791
-Eswatini 1138089
-Djibouti 994974
-Fiji 951611
-Comoros 900141
-Bhutan 884546
-Guyana 794099
-Solomon Islands 726799
-Luxembourg 671254
-Suriname 646758
-Macao 644426
-Cabo Verde 611014
-Montenegro 599849
-Brunei 491900
-Malta 469730
-Belize 415789
-Bahamas, The 410862
-Maldives 388858
-Iceland 364036
-Vanuatu 318007
-New Caledonia 304167
-Barbados 304139
-French Polynesia 303540
-Sao Tome and Principe 223561
-Samoa 208853
-Guam 169532
-Saint Lucia 168038
-Curacao 153289
-Aruba 125063
-Kiribati 116545
-Grenada 114621
-Tonga 104889
-Virgin Islands 104377
-Jersey 103387
-Antigua and Barbuda 102634
-Saint Vincent and the Grenadines 100647
-Micronesia, Federated States of 99603
-Seychelles 98187
-Isle of Man 92269
-Andorra 85370
-Marshall Islands 82011
-Dominica 74661
-Bermuda 72800
-Guernsey 67787
-Cayman Islands 66653
-Turks and Caicos Islands 60439
-Greenland 57751
-Saint Kitts and Nevis 55133
-Faroe Islands 52933
-Northern Mariana Islands 51118
-Sint Maarten 46215
-American Samoa 43895
-Liechtenstein 40272
-British Virgin Islands 40102
-San Marino 35095
-Saint Martin 32996
-Monaco 31813
-Gibraltar 29683
-Palau 21864
-Anguilla 19416
-Wallis and Futuna 15964
-Tuvalu 11733
-Nauru 9892
-Saint Helena, Ascension, and Tristan da Cunha 7943
-Cook Islands 7761
-Saint Barthelemy 7086
-Montserrat 5468
-Saint Pierre and Miquelon 5132
-Falkland Islands (Islas Malvinas) 3662
-Svalbard 2926
-Niue 2000
-Norfolk Island 1748
-Christmas Island 1692
-Tokelau 1647
-Paracel Islands 1440
-Holy See (Vatican City) 1000
-Cocos (Keeling) Islands 593
-Pitcairn Islands 50
-Palestine 5385012
+Burundi 13689
+Union of the Comoros 850
+Djibouti 1152
+Eritrea 3470
+Ethiopia 128691
+Kenya 55339
+Madagascar 31195
+Malawi 21104
+Mauritius 1273
+Mayotte 316
+Mozambique 33635
+Réunion 874
+Rwanda 13954
+Seychelles 127
+Somalia 18358
+South Sudan 11483
+Uganda 48656
+Tanzania 66617
+Zambia 20723
+Zimbabwe 16340
+Angola 36749
+Cameroon 28372
+Central African Republic 5152
+Chad 19319
+Republic of the Congo 6182
+Democratic Republic of the Congo 105789
+Equatorial Guinea 1847
+Gabon 2484
+Sao Tome and Principe 230
+Algeria 46164
+Egypt 114535
+Libya 7305
+Morocco 37712
+Sudan 50042
+Tunisia 12200
+Western Sahara 579
+Botswana 2480
+Eswatini 1230
+Lesotho 2311
+Namibia 2963
+South Africa 63212
+Benin 14111
+Burkina Faso 23025
+Cabo Verde 522
+Côte d'Ivoire 31165
+Gambia 2697
+Ghana 33787
+Guinea 14405
+Guinea-Bissau 2153
+Liberia 5493
+Mali 23769
+Mauritania 5022
+Niger 26159
+Nigeria 227882
+Saint Helena 5
+Senegal 18077
+Sierra Leone 8460
+Togo 9304
+Kazakhstan 20330
+Kyrgyzstan 7073
+Tajikistan 10389
+Turkmenistan 7364
+Uzbekistan 35652
+China 1422584
+Hong Kong 7442
+Macao 713
+Taiwan 23317
+Dem. People's Republic of Korea 26418
+Japan 124370
+Mongolia 3431
+South Korea 51748
+Afghanistan 41454
+Bangladesh 171466
+Bhutan 786
+India 1438069
+Iran 90608
+Maldives 525
+Nepal 29694
+Pakistan 247504
+Sri Lanka 22971
+Brunei 458
+Cambodia 17423
+Indonesia 281190
+Laos 7664
+Malaysia 35126
+Myanmar 54133
+Philippines 114891
+Singapore 5789
+Thailand 71702
+Timor-Leste 1384
+Vietnam 100352
+Armenia 2943
+Azerbaijan 10318
+Bahrain 1569
+Cyprus 1344
+Georgia 3807
+Iraq 45074
+Israel 9256
+Jordan 11439
+Kuwait 4838
+Lebanon 5773
+Oman 5049
+Qatar 2979
+Saudi Arabia 33264
+Palestine 5409
+Syria 23594
+Turkey 87270
+United Arab Emirates 10642
+Yemen 39390
+Belarus 9115
+Bulgaria 6795
+Czech Republic 10809
+Hungary 9686
+Poland 38762
+Moldova 3067
+Romania 19118
+Russia 145440
+Slovakia 5518
+Ukraine 37732
+Denmark 5948
+Estonia 1367
+Faroe Islands 54
+Finland 5601
+Guernsey 64
+Iceland 387
+Ireland 5196
+Isle of Man 84
+Jersey 103
+Latvia 1882
+Lithuania 2854
+Norway 5519
+Sweden 10551
+United Kingdom 68682
+Albania 2811
+Andorra 80
+Bosnia and Herzegovina 3185
+Croatia 3896
+Gibraltar 38
+Greece 10242
+Holy See 0
+Italy 59499
+Kosovo 1700
+Malta 532
+Montenegro 633
+North Macedonia 1831
+Portugal 10430
+San Marino 33
+Serbia 6773
+Slovenia 2118
+Spain 47911
+Austria 9130
+Belgium 11712
+France 66438
+Germany 84548
+Liechtenstein 39
+Luxembourg 665
+Monaco 38
+Netherlands 18092
+Switzerland 8870
+Anguilla 14
+Antigua and Barbuda 93
+Aruba 107
+Bahamas 399
+Barbados 282
+Bonaire 29
+British Virgin Islands 38
+Cayman Islands 73
+Cuba 11019
+Curacao 185
+Dominica 66
+Dominican Republic 11331
+Grenada 117
+Guadeloupe 376
+Haiti 11637
+Jamaica 2839
+Martinique 346
+Montserrat 4
+Puerto Rico 3242
+Saint Barthélemy 11
+Saint Kitts and Nevis 46
+Saint Lucia 179
+Saint Martin 27
+Saint Vincent and the Grenadines 101
+Sint Maarten 42
+Trinidad and Tobago 1502
+Turks and Caicos Islands 46
+United States Virgin Islands 85
+Belize 411
+Costa Rica 5105
+El Salvador 6309
+Guatemala 18124
+Honduras 10644
+Mexico 129739
+Nicaragua 6823
+Panama 4458
+Argentina 45538
+Bolivia 12244
+Brazil 211140
+Chile 19658
+Colombia 52321
+Ecuador 17980
+Falkland Islands (Malvinas) 3
+French Guiana 303
+Guyana 826
+Paraguay 6844
+Peru 33845
+Suriname 628
+Uruguay 3388
+Venezuela 28300
+Bermuda 64
+Canada 39299
+Greenland 55
+Saint Pierre and Miquelon 5
+USA 343477
+Australia 26451
+New Zealand 5172
+Fiji 924
+New Caledonia 289
+Papua New Guinea 10389
+Solomon Islands 800
+Vanuatu 320
+Guam 166
+Kiribati 132
+Marshall Islands 38
+Micronesia 112
+Nauru 11
+Northern Mariana Islands 45
+Palau 17
+American Samoa 47
+Cook Islands 14
+French Polynesia 281
+Niue 1
+Samoa 216
+Tokelau 2
+Tonga 104
+Tuvalu 9
+Wallis and Futuna Islands 11
diff --git a/scripts/developer_scripts/data/WPP2024_TotalPopulationBySex.csv.gz b/scripts/developer_scripts/data/WPP2024_TotalPopulationBySex.csv.gz
new file mode 100644
index 000000000..7a45be0d9
Binary files /dev/null and b/scripts/developer_scripts/data/WPP2024_TotalPopulationBySex.csv.gz differ
diff --git a/scripts/developer_scripts/data/world_factbook_population_sizes.csv b/scripts/developer_scripts/data/world_factbook_population_sizes.csv
deleted file mode 100644
index 763ef20f0..000000000
--- a/scripts/developer_scripts/data/world_factbook_population_sizes.csv
+++ /dev/null
@@ -1,238 +0,0 @@
-name,slug,value,date_of_information,ranking,region
-"China","china","1,416,043,270","",1,"East and Southeast Asia"
-"India","india","1,409,128,296","",2,"South Asia"
-"United States","united-states","341,963,408","",3,"North America"
-"Indonesia","indonesia","281,562,465","",4,"East and Southeast Asia"
-"Pakistan","pakistan","252,363,571","",5,"South Asia"
-"Nigeria","nigeria","236,747,130","",6,"Africa"
-"Brazil","brazil","220,051,512","",7,"South America"
-"Bangladesh","bangladesh","168,697,184","",8,"South Asia"
-"Russia","russia","140,820,810","",9,"Central Asia"
-"Mexico","mexico","130,739,927","",10,"North America"
-"Japan","japan","123,201,945","",11,"East and Southeast Asia"
-"Ethiopia","ethiopia","118,550,298","",12,"Africa"
-"Philippines","philippines","118,277,063","",13,"East and Southeast Asia"
-"Congo, Democratic Republic of the","congo-democratic-republic-of-the","115,403,027","",14,"Africa"
-"Egypt","egypt","111,247,248","",15,"Africa"
-"Vietnam","vietnam","105,758,975","",16,"East and Southeast Asia"
-"Iran","iran","88,386,937","",17,"Middle East"
-"Turkey (Turkiye)","turkey-turkiye","84,119,531","",18,"Middle East"
-"Germany","germany","84,119,100","",19,"Europe"
-"Thailand","thailand","69,920,998","",20,"East and Southeast Asia"
-"United Kingdom","united-kingdom","68,459,055","",21,"Europe"
-"France","france","68,374,591","",22,"Europe"
-"Tanzania","tanzania","67,462,121","",23,"Africa"
-"Italy","italy","60,964,931","",24,"Europe"
-"South Africa","south-africa","60,442,647","",25,"Africa"
-"Kenya","kenya","58,246,378","",26,"Africa"
-"Burma","burma","57,527,139","",27,"East and Southeast Asia"
-"Korea, South","korea-south","52,081,799","",28,"East and Southeast Asia"
-"Sudan","sudan","50,467,278","",29,"Africa"
-"Colombia","colombia","49,588,357","",30,"South America"
-"Uganda","uganda","49,283,041","",31,"Africa"
-"Spain","spain","47,280,433","",32,"Europe"
-"Algeria","algeria","47,022,473","",33,"Africa"
-"Argentina","argentina","46,994,384","",34,"South America"
-"Iraq","iraq","42,083,436","",35,"Middle East"
-"Afghanistan","afghanistan","40,121,552","",36,"South Asia"
-"Canada","canada","38,794,813","",37,"North America"
-"Poland","poland","38,746,310","",38,"Europe"
-"Morocco","morocco","37,387,585","",39,"Africa"
-"Angola","angola","37,202,061","",40,"Africa"
-"Saudi Arabia","saudi-arabia","36,544,431","",41,"Middle East"
-"Uzbekistan","uzbekistan","36,520,593","",42,"Central Asia"
-"Ukraine","ukraine","35,661,826","",43,"Europe"
-"Ghana","ghana","34,589,092","",44,"Africa"
-"Malaysia","malaysia","34,564,810","",45,"East and Southeast Asia"
-"Mozambique","mozambique","33,350,954","",46,"Africa"
-"Peru","peru","32,600,249","",47,"South America"
-"Yemen","yemen","32,140,443","",48,"Middle East"
-"Venezuela","venezuela","31,250,306","",49,"South America"
-"Nepal","nepal","31,122,387","",50,"South Asia"
-"Cameroon","cameroon","30,966,105","",51,"Africa"
-"Cote d'Ivoire","cote-divoire","29,981,758","",52,"Africa"
-"Madagascar","madagascar","29,452,714","",53,"Africa"
-"Australia","australia","26,768,598","",54,"Australia and Oceania"
-"Niger","niger","26,342,784","",55,"Africa"
-"Korea, North","korea-north","26,298,666","",56,"East and Southeast Asia"
-"Syria","syria","23,865,423","",57,"Middle East"
-"Taiwan","taiwan","23,595,274","",58,"East and Southeast Asia"
-"Burkina Faso","burkina-faso","23,042,199","",59,"Africa"
-"Mali","mali","21,990,607","",60,"Africa"
-"Sri Lanka","sri-lanka","21,982,608","",61,"South Asia"
-"Malawi","malawi","21,763,309","",62,"Africa"
-"Zambia","zambia","20,799,116","",63,"Africa"
-"Kazakhstan","kazakhstan","20,260,006","",64,"Central Asia"
-"Chad","chad","19,093,595","",65,"Africa"
-"Senegal","senegal","18,847,519","",66,"Africa"
-"Chile","chile","18,664,652","",67,"South America"
-"Ecuador","ecuador","18,309,984","",68,"South America"
-"Guatemala","guatemala","18,255,216","",69,"Central America and the Caribbean"
-"Romania","romania","18,148,155","",70,"Europe"
-"Netherlands","netherlands","17,772,378","",71,"Europe"
-"Zimbabwe","zimbabwe","17,150,352","",72,"Africa"
-"Cambodia","cambodia","17,063,669","",73,"East and Southeast Asia"
-"Benin","benin","14,697,052","",74,"Africa"
-"Guinea","guinea","13,986,179","",75,"Africa"
-"Rwanda","rwanda","13,623,302","",76,"Africa"
-"Burundi","burundi","13,590,102","",77,"Africa"
-"Somalia","somalia","13,017,273","",78,"Africa"
-"South Sudan","south-sudan","12,703,714","",79,"Africa"
-"Bolivia","bolivia","12,311,974","",80,"South America"
-"Tunisia","tunisia","12,048,847","",81,"Africa"
-"Belgium","belgium","11,977,634","",82,"Europe"
-"Haiti","haiti","11,753,943","",83,"Central America and the Caribbean"
-"Jordan","jordan","11,174,024","",84,"Middle East"
-"Cuba","cuba","10,966,038","",85,"Central America and the Caribbean"
-"Czechia","czechia","10,837,890","",86,"Europe"
-"Dominican Republic","dominican-republic","10,815,857","",87,"Central America and the Caribbean"
-"Azerbaijan","azerbaijan","10,650,239","",88,"Middle East"
-"Sweden","sweden","10,589,835","",89,"Europe"
-"Greece","greece","10,461,091","",90,"Europe"
-"Tajikistan","tajikistan","10,394,063","",91,"Central Asia"
-"Portugal","portugal","10,207,177","",92,"Europe"
-"Papua New Guinea","papua-new-guinea","10,046,233","",93,"East and Southeast Asia"
-"United Arab Emirates","united-arab-emirates","10,032,213","",94,"Middle East"
-"Hungary","hungary","9,855,745","",95,"Europe"
-"Honduras","honduras","9,529,188","",96,"Central America and the Caribbean"
-"Belarus","belarus","9,501,451","",97,"Europe"
-"Israel","israel","9,402,617","",98,"Middle East"
-"Sierra Leone","sierra-leone","9,121,049","",99,"Africa"
-"Austria","austria","8,967,982","",100,"Europe"
-"Togo","togo","8,917,994","",101,"Africa"
-"Switzerland","switzerland","8,860,574","",102,"Europe"
-"Laos","laos","7,953,556","",103,"East and Southeast Asia"
-"Paraguay","paraguay","7,522,549","",104,"South America"
-"Libya","libya","7,361,263","",105,"Africa"
-"Hong Kong","hong-kong","7,297,821","",106,"East and Southeast Asia"
-"Bulgaria","bulgaria","6,782,659","",107,"Europe"
-"Nicaragua","nicaragua","6,676,948","",108,"Central America and the Caribbean"
-"Serbia","serbia","6,652,212","",109,"Europe"
-"El Salvador","el-salvador","6,628,702","",110,"Central America and the Caribbean"
-"Eritrea","eritrea","6,343,956","",111,"Africa"
-"Kyrgyzstan","kyrgyzstan","6,172,101","",112,"Central Asia"
-"Congo, Republic of the","congo-republic-of-the","6,097,665","",113,"Africa"
-"Singapore","singapore","6,028,459","",114,"East and Southeast Asia"
-"Denmark","denmark","5,973,136","",115,"Europe"
-"Turkmenistan","turkmenistan","5,744,151","",116,"Central Asia"
-"Central African Republic","central-african-republic","5,650,957","",117,"Africa"
-"Finland","finland","5,626,414","",118,"Europe"
-"Slovakia","slovakia","5,563,649","",119,"Europe"
-"Norway","norway","5,509,733","",120,"Europe"
-"Liberia","liberia","5,437,249","",121,"Africa"
-"Lebanon","lebanon","5,364,482","",122,"Middle East"
-"Costa Rica","costa-rica","5,265,575","",123,"Central America and the Caribbean"
-"Ireland","ireland","5,233,461","",124,"Europe"
-"New Zealand","new-zealand","5,161,211","",125,"Australia and Oceania"
-"Georgia","georgia","4,900,961","",126,"Middle East"
-"Panama","panama","4,470,241","",127,"Central America and the Caribbean"
-"Mauritania","mauritania","4,328,040","",128,"Africa"
-"Croatia","croatia","4,150,116","",129,"Europe"
-"Oman","oman","3,901,992","",130,"Middle East"
-"Bosnia and Herzegovina","bosnia-and-herzegovina","3,798,671","",131,"Europe"
-"Moldova","moldova","3,599,528","",132,"Europe"
-"Uruguay","uruguay","3,425,330","",133,"South America"
-"Mongolia","mongolia","3,281,676","",134,"East and Southeast Asia"
-"West Bank","west-bank","3,243,369","",135,"Middle East"
-"Kuwait","kuwait","3,138,355","",136,"Middle East"
-"Albania","albania","3,107,100","",137,"Europe"
-"Puerto Rico","puerto-rico","3,019,450","",138,"Central America and the Caribbean"
-"Armenia","armenia","2,976,765","",139,"Middle East"
-"Jamaica","jamaica","2,823,713","",140,"Central America and the Caribbean"
-"Namibia","namibia","2,803,660","",141,"Africa"
-"Lithuania","lithuania","2,628,186","",142,"Europe"
-"Qatar","qatar","2,552,088","",143,"Middle East"
-"Gambia, The","gambia-the","2,523,327","",144,"Africa"
-"Gabon","gabon","2,455,105","",145,"Africa"
-"Botswana","botswana","2,450,668","",146,"Africa"
-"Lesotho","lesotho","2,227,548","",147,"Africa"
-"Gaza Strip","gaza-strip","2,141,643","",148,"Middle East"
-"North Macedonia","north-macedonia","2,135,622","",149,"Europe"
-"Guinea-Bissau","guinea-bissau","2,132,325","",150,"Africa"
-"Slovenia","slovenia","2,097,893","",151,"Europe"
-"Kosovo","kosovo","1,977,093","",152,"Europe"
-"Latvia","latvia","1,801,246","",153,"Europe"
-"Equatorial Guinea","equatorial-guinea","1,795,834","",154,"Africa"
-"Bahrain","bahrain","1,566,888","",155,"Middle East"
-"Timor-Leste","timor-leste","1,506,909","",156,"East and Southeast Asia"
-"Trinidad and Tobago","trinidad-and-tobago","1,408,966","",157,"Central America and the Caribbean"
-"Cyprus","cyprus","1,320,525","",158,"Europe"
-"Mauritius","mauritius","1,310,504","",159,"Africa"
-"Estonia","estonia","1,193,791","",160,"Europe"
-"Eswatini","eswatini","1,138,089","",161,"Africa"
-"Djibouti","djibouti","994,974","",162,"Africa"
-"Fiji","fiji","951,611","",163,"Australia and Oceania"
-"Comoros","comoros","900,141","",164,"Africa"
-"Bhutan","bhutan","884,546","",165,"South Asia"
-"Guyana","guyana","794,099","",166,"South America"
-"Solomon Islands","solomon-islands","726,799","",167,"Australia and Oceania"
-"Luxembourg","luxembourg","671,254","",168,"Europe"
-"Suriname","suriname","646,758","",169,"South America"
-"Macau","macau","644,426","",170,"East and Southeast Asia"
-"Cabo Verde","cabo-verde","611,014","",171,"Africa"
-"Montenegro","montenegro","599,849","",172,"Europe"
-"Brunei","brunei","491,900","",173,"East and Southeast Asia"
-"Malta","malta","469,730","",174,"Europe"
-"Belize","belize","415,789","",175,"Central America and the Caribbean"
-"Bahamas, The","bahamas-the","410,862","",176,"Central America and the Caribbean"
-"Maldives","maldives","388,858","",177,"South Asia"
-"Iceland","iceland","364,036","",178,"Europe"
-"Vanuatu","vanuatu","318,007","",179,"Australia and Oceania"
-"New Caledonia","new-caledonia","304,167","",180,"Australia and Oceania"
-"Barbados","barbados","304,139","",181,"Central America and the Caribbean"
-"French Polynesia","french-polynesia","303,540","",182,"Australia and Oceania"
-"Sao Tome and Principe","sao-tome-and-principe","223,561","",183,"Africa"
-"Samoa","samoa","208,853","",184,"Australia and Oceania"
-"Guam","guam","169,532","",185,"Australia and Oceania"
-"Saint Lucia","saint-lucia","168,038","",186,"Central America and the Caribbean"
-"Curacao","curacao","153,289","",187,"Central America and the Caribbean"
-"Aruba","aruba","125,063","",188,"Central America and the Caribbean"
-"Kiribati","kiribati","116,545","",189,"Australia and Oceania"
-"Grenada","grenada","114,621","",190,"Central America and the Caribbean"
-"Tonga","tonga","104,889","",191,"Australia and Oceania"
-"Virgin Islands","virgin-islands","104,377","",192,"Central America and the Caribbean"
-"Jersey","jersey","103,387","",193,"Europe"
-"Antigua and Barbuda","antigua-and-barbuda","102,634","",194,"Central America and the Caribbean"
-"Saint Vincent and the Grenadines","saint-vincent-and-the-grenadines","100,647","",195,"Central America and the Caribbean"
-"Micronesia, Federated States of","micronesia-federated-states-of","99,603","",196,"Australia and Oceania"
-"Seychelles","seychelles","98,187","",197,"Africa"
-"Isle of Man","isle-of-man","92,269","",198,"Europe"
-"Andorra","andorra","85,370","",199,"Europe"
-"Marshall Islands","marshall-islands","82,011","",200,"Australia and Oceania"
-"Dominica","dominica","74,661","",201,"Central America and the Caribbean"
-"Bermuda","bermuda","72,800","",202,"North America"
-"Guernsey","guernsey","67,787","",203,"Europe"
-"Cayman Islands","cayman-islands","66,653","",204,"Central America and the Caribbean"
-"Turks and Caicos Islands","turks-and-caicos-islands","60,439","",205,"Central America and the Caribbean"
-"Greenland","greenland","57,751","",206,"North America"
-"Saint Kitts and Nevis","saint-kitts-and-nevis","55,133","",207,"Central America and the Caribbean"
-"Faroe Islands","faroe-islands","52,933","",208,"Europe"
-"Northern Mariana Islands","northern-mariana-islands","51,118","",209,"Australia and Oceania"
-"Sint Maarten","sint-maarten","46,215","",210,"Central America and the Caribbean"
-"American Samoa","american-samoa","43,895","",211,"Australia and Oceania"
-"Liechtenstein","liechtenstein","40,272","",212,"Europe"
-"British Virgin Islands","british-virgin-islands","40,102","",213,"Central America and the Caribbean"
-"San Marino","san-marino","35,095","",214,"Europe"
-"Saint Martin","saint-martin","32,996","",215,"Central America and the Caribbean"
-"Monaco","monaco","31,813","",216,"Europe"
-"Gibraltar","gibraltar","29,683","",217,"Europe"
-"Palau","palau","21,864","",218,"Australia and Oceania"
-"Anguilla","anguilla","19,416","",219,"Central America and the Caribbean"
-"Wallis and Futuna","wallis-and-futuna","15,964","",220,"Australia and Oceania"
-"Tuvalu","tuvalu","11,733","",221,"Australia and Oceania"
-"Nauru","nauru","9,892","",222,"Australia and Oceania"
-"Saint Helena, Ascension, and Tristan da Cunha","saint-helena-ascension-and-tristan-da-cunha","7,943","",223,"Africa"
-"Cook Islands","cook-islands","7,761","",224,"Australia and Oceania"
-"Saint Barthelemy","saint-barthelemy","7,086","",225,"Central America and the Caribbean"
-"Montserrat","montserrat","5,468","",226,"Central America and the Caribbean"
-"Saint Pierre and Miquelon","saint-pierre-and-miquelon","5,132","",227,"North America"
-"Falkland Islands (Islas Malvinas)","falkland-islands-islas-malvinas","3,662","2021",228,"South America"
-"Svalbard","svalbard","2,926","2021",229,"Europe"
-"Niue","niue","2,000","2022",230,"Australia and Oceania"
-"Norfolk Island","norfolk-island","1,748","2016",231,"Australia and Oceania"
-"Christmas Island","christmas-island","1,692","",232,"Australia and Oceania"
-"Tokelau","tokelau","1,647","2019",233,"Australia and Oceania"
-"Paracel Islands","paracel-islands","1,440","July 2014",234,"East and Southeast Asia"
-"Holy See (Vatican City)","holy-see-vatican-city","1,000","2022",235,"Europe"
-"Cocos (Keeling) Islands","cocos-keeling-islands","593","",236,"Australia and Oceania"
-"Pitcairn Islands","pitcairn-islands","50","2021",237,"Australia and Oceania"
\ No newline at end of file
diff --git a/scripts/developer_scripts/get_population_weights b/scripts/developer_scripts/get_population_weights
index 037313532..8a20ea461 100755
--- a/scripts/developer_scripts/get_population_weights
+++ b/scripts/developer_scripts/get_population_weights
@@ -9,20 +9,30 @@ from pathlib import Path
import pandas as pd
-def export_world_factbook(output):
- # Retrieve this file by going to ,
- # and selecting "DOWNLOAD DATA" (no filters).
- # Ideally, this would be an automated web request. But "DOWNLOAD DATA" calls
- # a JavaScript function to generate the download contents instead of serving
- # the contents directly via an API.
- csv = Path(os.path.dirname(__file__)) / "data/world_factbook_population_sizes.csv"
-
- df = pd.read_csv(csv, thousands=',')
+def export_population_weights(output):
+ # This file has been manually downloaded from the link for "1950-2100, all
+ # scenarios"¹ on the UN population CSV download page². Ideally, this would
+ # be an automated web request, but the URL does not work with pandas's
+ # underlying urllib request³.
+ #
+ # ¹
+ # ²
+ # ³
+ #
+ csv = Path(os.path.dirname(__file__)) / "data/WPP2024_TotalPopulationBySex.csv.gz"
+
+ df = pd.read_csv(csv, usecols=['Location', 'LocTypeName', 'Time', 'PopTotal'], dtype='str')
+
+ # Drop rows that represent aggregate regions/subregions/etc.
+ df = df[df['LocTypeName'] == 'Country/Area']
+
+ # Use data from the latest non-forecast year
+ df = df[df['Time'] == '2023']
# Rename columns to match names in metadata
column_name_map = {
- 'name': 'country',
- 'value': 'weight',
+ 'Location': 'country',
+ 'PopTotal': 'weight',
}
df = df.rename(columns=column_name_map)
@@ -33,21 +43,38 @@ def export_world_factbook(output):
df = df.set_index('country')
# Rename countries to match values in metadata
- # NOTE: This has only been checked for countries in Asia. If population
- # weights are used for other regions, it's likely that this will need to be
- # updated.
country_name_map = {
- "Burma": "Myanmar",
- "Korea, South": "South Korea",
- "Macau": "Macao",
+ "Bolivia (Plurinational State of)": "Bolivia",
+ "Bonaire, Sint Eustatius and Saba": "Bonaire",
+ "Brunei Darussalam": "Brunei",
+ "China, Hong Kong SAR": "Hong Kong",
+ "China, Macao SAR": "Macao",
+ "China, Taiwan Province of China": "Taiwan",
+ "Comoros": "Union of the Comoros",
+ "Congo": "Republic of the Congo",
+ "Curaçao": "Curacao",
+ "Czechia": "Czech Republic",
+ "Iran (Islamic Republic of)": "Iran",
+ "Kosovo (under UNSC res. 1244)": "Kosovo",
+ "Lao People's Democratic Republic": "Laos",
+ "Micronesia (Fed. States of)": "Micronesia",
+ "Republic of Korea": "South Korea",
+ "Republic of Moldova": "Moldova",
+ "Russian Federation": "Russia",
+ "Saint Martin (French part)": "Saint Martin",
+ "Sint Maarten (Dutch part)": "Sint Maarten",
+ "State of Palestine": "Palestine",
+ "Syrian Arab Republic": "Syria",
+ "Türkiye": "Turkey",
+ "United Republic of Tanzania": "Tanzania",
+ "United States of America": "USA",
+ "Venezuela (Bolivarian Republic of)": "Venezuela",
+ "Viet Nam": "Vietnam",
}
df = df.rename(index=country_name_map)
- # Add missing countries
- df.loc['Palestine', 'weight'] = df.loc['West Bank', 'weight'] + df.loc['Gaza Strip', 'weight']
-
# Ensure int weights are written without decimals
- df['weight'] = df['weight'].astype('Int64')
+ df['weight'] = pd.to_numeric(df['weight']).astype(int)
# Delete output file if it already exists
if os.path.exists(output):
@@ -71,4 +98,4 @@ if __name__ == '__main__':
)
args = parser.parse_args()
- export_world_factbook(args.output)
+ export_population_weights(args.output)