From 1ea212612a8f36b3ea799876fd59473c71b641f3 Mon Sep 17 00:00:00 2001 From: Deborah Servili Date: Thu, 26 Sep 2019 13:27:31 +0200 Subject: [PATCH] add script used to create region galaxy (Not optimised or anything) --- tools/UN M49/UNSD.csv | 250 ++++++++++++++++++++++++++++++++++ tools/UN M49/region_galaxy.py | 186 +++++++++++++++++++++++++ 2 files changed, 436 insertions(+) create mode 100644 tools/UN M49/UNSD.csv create mode 100644 tools/UN M49/region_galaxy.py diff --git a/tools/UN M49/UNSD.csv b/tools/UN M49/UNSD.csv new file mode 100644 index 0000000..254f0fb --- /dev/null +++ b/tools/UN M49/UNSD.csv @@ -0,0 +1,250 @@ +Global Code,Global Name,Region Code,Region Name,Sub-region Code,Sub-region Name,Intermediate Region Code,Intermediate Region Name,M49 Code,Country or Area,ISO-alpha3 Code,Least Developed Countries (LDC),Land Locked Developing Countries (LLDC),Small Island Developing States (SIDS),Developed / Developing Countries +001,World,002,Africa,015,Northern Africa,,,012,Algeria,DZA,,,,Developing +001,World,002,Africa,015,Northern Africa,,,818,Egypt,EGY,,,,Developing +001,World,002,Africa,015,Northern Africa,,,434,Libya,LBY,,,,Developing +001,World,002,Africa,015,Northern Africa,,,504,Morocco,MAR,,,,Developing +001,World,002,Africa,015,Northern Africa,,,729,Sudan,SDN,x,,,Developing +001,World,002,Africa,015,Northern Africa,,,788,Tunisia,TUN,,,,Developing +001,World,002,Africa,015,Northern Africa,,,732,Western Sahara,ESH,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,086,British Indian Ocean Territory,IOT,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,108,Burundi,BDI,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,174,Comoros,COM,x,,x,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,262,Djibouti,DJI,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,232,Eritrea,ERI,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,231,Ethiopia,ETH,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,260,French Southern Territories,ATF,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,404,Kenya,KEN,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,450,Madagascar,MDG,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,454,Malawi,MWI,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,480,Mauritius,MUS,,,x,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,175,Mayotte,MYT,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,508,Mozambique,MOZ,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,638,Réunion,REU,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,646,Rwanda,RWA,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,690,Seychelles,SYC,,,x,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,706,Somalia,SOM,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,728,South Sudan,SSD,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,800,Uganda,UGA,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,834,United Republic of Tanzania,TZA,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,894,Zambia,ZMB,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,014,Eastern Africa,716,Zimbabwe,ZWE,,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,024,Angola,AGO,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,120,Cameroon,CMR,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,140,Central African Republic,CAF,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,148,Chad,TCD,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,178,Congo,COG,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,180,Democratic Republic of the Congo,COD,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,226,Equatorial Guinea,GNQ,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,266,Gabon,GAB,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,017,Middle Africa,678,Sao Tome and Principe,STP,x,,x,Developing +001,World,002,Africa,202,Sub-Saharan Africa,018,Southern Africa,072,Botswana,BWA,,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,018,Southern Africa,748,Eswatini,SWZ,,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,018,Southern Africa,426,Lesotho,LSO,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,018,Southern Africa,516,Namibia,NAM,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,018,Southern Africa,710,South Africa,ZAF,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,204,Benin,BEN,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,854,Burkina Faso,BFA,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,132,Cabo Verde,CPV,,,x,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,384,Côte d’Ivoire,CIV,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,270,Gambia,GMB,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,288,Ghana,GHA,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,324,Guinea,GIN,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,624,Guinea-Bissau,GNB,x,,x,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,430,Liberia,LBR,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,466,Mali,MLI,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,478,Mauritania,MRT,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,562,Niger,NER,x,x,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,566,Nigeria,NGA,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,654,Saint Helena,SHN,,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,686,Senegal,SEN,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,694,Sierra Leone,SLE,x,,,Developing +001,World,002,Africa,202,Sub-Saharan Africa,011,Western Africa,768,Togo,TGO,x,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,660,Anguilla,AIA,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,028,Antigua and Barbuda,ATG,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,533,Aruba,ABW,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,044,Bahamas,BHS,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,052,Barbados,BRB,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,535,"Bonaire, Sint Eustatius and Saba",BES,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,092,British Virgin Islands,VGB,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,136,Cayman Islands,CYM,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,192,Cuba,CUB,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,531,Curaçao,CUW,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,212,Dominica,DMA,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,214,Dominican Republic,DOM,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,308,Grenada,GRD,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,312,Guadeloupe,GLP,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,332,Haiti,HTI,x,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,388,Jamaica,JAM,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,474,Martinique,MTQ,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,500,Montserrat,MSR,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,630,Puerto Rico,PRI,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,652,Saint Barthélemy,BLM,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,659,Saint Kitts and Nevis,KNA,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,662,Saint Lucia,LCA,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,663,Saint Martin (French Part),MAF,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,670,Saint Vincent and the Grenadines,VCT,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,534,Sint Maarten (Dutch part),SXM,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,780,Trinidad and Tobago,TTO,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,796,Turks and Caicos Islands,TCA,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,029,Caribbean,850,United States Virgin Islands,VIR,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,084,Belize,BLZ,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,188,Costa Rica,CRI,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,222,El Salvador,SLV,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,320,Guatemala,GTM,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,340,Honduras,HND,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,484,Mexico,MEX,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,558,Nicaragua,NIC,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,013,Central America,591,Panama,PAN,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,032,Argentina,ARG,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,068,Bolivia (Plurinational State of),BOL,,x,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,074,Bouvet Island,BVT,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,076,Brazil,BRA,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,152,Chile,CHL,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,170,Colombia,COL,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,218,Ecuador,ECU,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,238,Falkland Islands (Malvinas),FLK,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,254,French Guiana,GUF,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,328,Guyana,GUY,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,600,Paraguay,PRY,,x,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,604,Peru,PER,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,239,South Georgia and the South Sandwich Islands,SGS,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,740,Suriname,SUR,,,x,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,858,Uruguay,URY,,,,Developing +001,World,019,Americas,419,Latin America and the Caribbean,005,South America,862,Venezuela (Bolivarian Republic of),VEN,,,,Developing +001,World,019,Americas,021,Northern America,,,060,Bermuda,BMU,,,,Developed +001,World,019,Americas,021,Northern America,,,124,Canada,CAN,,,,Developed +001,World,019,Americas,021,Northern America,,,304,Greenland,GRL,,,,Developed +001,World,019,Americas,021,Northern America,,,666,Saint Pierre and Miquelon,SPM,,,,Developed +001,World,019,Americas,021,Northern America,,,840,United States of America,USA,,,,Developed +001,World,,,,,,,010,Antarctica,ATA,,,, +001,World,142,Asia,143,Central Asia,,,398,Kazakhstan,KAZ,,x,,Developing +001,World,142,Asia,143,Central Asia,,,417,Kyrgyzstan,KGZ,,x,,Developing +001,World,142,Asia,143,Central Asia,,,762,Tajikistan,TJK,,x,,Developing +001,World,142,Asia,143,Central Asia,,,795,Turkmenistan,TKM,,x,,Developing +001,World,142,Asia,143,Central Asia,,,860,Uzbekistan,UZB,,x,,Developing +001,World,142,Asia,030,Eastern Asia,,,156,China,CHN,,,,Developing +001,World,142,Asia,030,Eastern Asia,,,344,"China, Hong Kong Special Administrative Region",HKG,,,,Developing +001,World,142,Asia,030,Eastern Asia,,,446,"China, Macao Special Administrative Region",MAC,,,,Developing +001,World,142,Asia,030,Eastern Asia,,,408,Democratic People's Republic of Korea,PRK,,,,Developing +001,World,142,Asia,030,Eastern Asia,,,392,Japan,JPN,,,,Developed +001,World,142,Asia,030,Eastern Asia,,,496,Mongolia,MNG,,x,,Developing +001,World,142,Asia,030,Eastern Asia,,,410,Republic of Korea,KOR,,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,096,Brunei Darussalam,BRN,,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,116,Cambodia,KHM,x,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,360,Indonesia,IDN,,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,418,Lao People's Democratic Republic,LAO,x,x,,Developing +001,World,142,Asia,035,South-eastern Asia,,,458,Malaysia,MYS,,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,104,Myanmar,MMR,x,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,608,Philippines,PHL,,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,702,Singapore,SGP,,,x,Developing +001,World,142,Asia,035,South-eastern Asia,,,764,Thailand,THA,,,,Developing +001,World,142,Asia,035,South-eastern Asia,,,626,Timor-Leste,TLS,x,,x,Developing +001,World,142,Asia,035,South-eastern Asia,,,704,Viet Nam,VNM,,,,Developing +001,World,142,Asia,034,Southern Asia,,,004,Afghanistan,AFG,x,x,,Developing +001,World,142,Asia,034,Southern Asia,,,050,Bangladesh,BGD,x,,,Developing +001,World,142,Asia,034,Southern Asia,,,064,Bhutan,BTN,x,x,,Developing +001,World,142,Asia,034,Southern Asia,,,356,India,IND,,,,Developing +001,World,142,Asia,034,Southern Asia,,,364,Iran (Islamic Republic of),IRN,,,,Developing +001,World,142,Asia,034,Southern Asia,,,462,Maldives,MDV,,,x,Developing +001,World,142,Asia,034,Southern Asia,,,524,Nepal,NPL,x,x,,Developing +001,World,142,Asia,034,Southern Asia,,,586,Pakistan,PAK,,,,Developing +001,World,142,Asia,034,Southern Asia,,,144,Sri Lanka,LKA,,,,Developing +001,World,142,Asia,145,Western Asia,,,051,Armenia,ARM,,x,,Developing +001,World,142,Asia,145,Western Asia,,,031,Azerbaijan,AZE,,x,,Developing +001,World,142,Asia,145,Western Asia,,,048,Bahrain,BHR,,,,Developing +001,World,142,Asia,145,Western Asia,,,196,Cyprus,CYP,,,,Developed +001,World,142,Asia,145,Western Asia,,,268,Georgia,GEO,,,,Developing +001,World,142,Asia,145,Western Asia,,,368,Iraq,IRQ,,,,Developing +001,World,142,Asia,145,Western Asia,,,376,Israel,ISR,,,,Developed +001,World,142,Asia,145,Western Asia,,,400,Jordan,JOR,,,,Developing +001,World,142,Asia,145,Western Asia,,,414,Kuwait,KWT,,,,Developing +001,World,142,Asia,145,Western Asia,,,422,Lebanon,LBN,,,,Developing +001,World,142,Asia,145,Western Asia,,,512,Oman,OMN,,,,Developing +001,World,142,Asia,145,Western Asia,,,634,Qatar,QAT,,,,Developing +001,World,142,Asia,145,Western Asia,,,682,Saudi Arabia,SAU,,,,Developing +001,World,142,Asia,145,Western Asia,,,275,State of Palestine,PSE,,,,Developing +001,World,142,Asia,145,Western Asia,,,760,Syrian Arab Republic,SYR,,,,Developing +001,World,142,Asia,145,Western Asia,,,792,Turkey,TUR,,,,Developing +001,World,142,Asia,145,Western Asia,,,784,United Arab Emirates,ARE,,,,Developing +001,World,142,Asia,145,Western Asia,,,887,Yemen,YEM,x,,,Developing +001,World,150,Europe,151,Eastern Europe,,,112,Belarus,BLR,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,100,Bulgaria,BGR,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,203,Czechia,CZE,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,348,Hungary,HUN,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,616,Poland,POL,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,498,Republic of Moldova,MDA,,x,,Developed +001,World,150,Europe,151,Eastern Europe,,,642,Romania,ROU,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,643,Russian Federation,RUS,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,703,Slovakia,SVK,,,,Developed +001,World,150,Europe,151,Eastern Europe,,,804,Ukraine,UKR,,,,Developed +001,World,150,Europe,154,Northern Europe,,,248,Åland Islands,ALA,,,,Developed +001,World,150,Europe,154,Northern Europe,830,Channel Islands,831,Guernsey,GGY,,,,Developed +001,World,150,Europe,154,Northern Europe,830,Channel Islands,832,Jersey,JEY,,,,Developed +001,World,150,Europe,154,Northern Europe,830,Channel Islands,680,Sark,,,,,Developed +001,World,150,Europe,154,Northern Europe,,,208,Denmark,DNK,,,,Developed +001,World,150,Europe,154,Northern Europe,,,233,Estonia,EST,,,,Developed +001,World,150,Europe,154,Northern Europe,,,234,Faroe Islands,FRO,,,,Developed +001,World,150,Europe,154,Northern Europe,,,246,Finland,FIN,,,,Developed +001,World,150,Europe,154,Northern Europe,,,352,Iceland,ISL,,,,Developed +001,World,150,Europe,154,Northern Europe,,,372,Ireland,IRL,,,,Developed +001,World,150,Europe,154,Northern Europe,,,833,Isle of Man,IMN,,,,Developed +001,World,150,Europe,154,Northern Europe,,,428,Latvia,LVA,,,,Developed +001,World,150,Europe,154,Northern Europe,,,440,Lithuania,LTU,,,,Developed +001,World,150,Europe,154,Northern Europe,,,578,Norway,NOR,,,,Developed +001,World,150,Europe,154,Northern Europe,,,744,Svalbard and Jan Mayen Islands,SJM,,,,Developed +001,World,150,Europe,154,Northern Europe,,,752,Sweden,SWE,,,,Developed +001,World,150,Europe,154,Northern Europe,,,826,United Kingdom of Great Britain and Northern Ireland,GBR,,,,Developed +001,World,150,Europe,039,Southern Europe,,,008,Albania,ALB,,,,Developed +001,World,150,Europe,039,Southern Europe,,,020,Andorra,AND,,,,Developed +001,World,150,Europe,039,Southern Europe,,,070,Bosnia and Herzegovina,BIH,,,,Developed +001,World,150,Europe,039,Southern Europe,,,191,Croatia,HRV,,,,Developed +001,World,150,Europe,039,Southern Europe,,,292,Gibraltar,GIB,,,,Developed +001,World,150,Europe,039,Southern Europe,,,300,Greece,GRC,,,,Developed +001,World,150,Europe,039,Southern Europe,,,336,Holy See,VAT,,,,Developed +001,World,150,Europe,039,Southern Europe,,,380,Italy,ITA,,,,Developed +001,World,150,Europe,039,Southern Europe,,,470,Malta,MLT,,,,Developed +001,World,150,Europe,039,Southern Europe,,,499,Montenegro,MNE,,,,Developed +001,World,150,Europe,039,Southern Europe,,,807,North Macedonia,MKD,,x,,Developed +001,World,150,Europe,039,Southern Europe,,,620,Portugal,PRT,,,,Developed +001,World,150,Europe,039,Southern Europe,,,674,San Marino,SMR,,,,Developed +001,World,150,Europe,039,Southern Europe,,,688,Serbia,SRB,,,,Developed +001,World,150,Europe,039,Southern Europe,,,705,Slovenia,SVN,,,,Developed +001,World,150,Europe,039,Southern Europe,,,724,Spain,ESP,,,,Developed +001,World,150,Europe,155,Western Europe,,,040,Austria,AUT,,,,Developed +001,World,150,Europe,155,Western Europe,,,056,Belgium,BEL,,,,Developed +001,World,150,Europe,155,Western Europe,,,250,France,FRA,,,,Developed +001,World,150,Europe,155,Western Europe,,,276,Germany,DEU,,,,Developed +001,World,150,Europe,155,Western Europe,,,438,Liechtenstein,LIE,,,,Developed +001,World,150,Europe,155,Western Europe,,,442,Luxembourg,LUX,,,,Developed +001,World,150,Europe,155,Western Europe,,,492,Monaco,MCO,,,,Developed +001,World,150,Europe,155,Western Europe,,,528,Netherlands,NLD,,,,Developed +001,World,150,Europe,155,Western Europe,,,756,Switzerland,CHE,,,,Developed +001,World,009,Oceania,053,Australia and New Zealand,,,036,Australia,AUS,,,,Developed +001,World,009,Oceania,053,Australia and New Zealand,,,162,Christmas Island,CXR,,,,Developed +001,World,009,Oceania,053,Australia and New Zealand,,,166,Cocos (Keeling) Islands,CCK,,,,Developed +001,World,009,Oceania,053,Australia and New Zealand,,,334,Heard Island and McDonald Islands,HMD,,,,Developed +001,World,009,Oceania,053,Australia and New Zealand,,,554,New Zealand,NZL,,,,Developed +001,World,009,Oceania,053,Australia and New Zealand,,,574,Norfolk Island,NFK,,,,Developed +001,World,009,Oceania,054,Melanesia,,,242,Fiji,FJI,,,x,Developing +001,World,009,Oceania,054,Melanesia,,,540,New Caledonia,NCL,,,x,Developing +001,World,009,Oceania,054,Melanesia,,,598,Papua New Guinea,PNG,,,x,Developing +001,World,009,Oceania,054,Melanesia,,,090,Solomon Islands,SLB,x,,x,Developing +001,World,009,Oceania,054,Melanesia,,,548,Vanuatu,VUT,x,,x,Developing +001,World,009,Oceania,057,Micronesia,,,316,Guam,GUM,,,x,Developing +001,World,009,Oceania,057,Micronesia,,,296,Kiribati,KIR,x,,x,Developing +001,World,009,Oceania,057,Micronesia,,,584,Marshall Islands,MHL,,,x,Developing +001,World,009,Oceania,057,Micronesia,,,583,Micronesia (Federated States of),FSM,,,x,Developing +001,World,009,Oceania,057,Micronesia,,,520,Nauru,NRU,,,x,Developing +001,World,009,Oceania,057,Micronesia,,,580,Northern Mariana Islands,MNP,,,x,Developing +001,World,009,Oceania,057,Micronesia,,,585,Palau,PLW,,,x,Developing +001,World,009,Oceania,057,Micronesia,,,581,United States Minor Outlying Islands,UMI,,,,Developing +001,World,009,Oceania,061,Polynesia,,,016,American Samoa,ASM,,,x,Developing +001,World,009,Oceania,061,Polynesia,,,184,Cook Islands,COK,,,x,Developing +001,World,009,Oceania,061,Polynesia,,,258,French Polynesia,PYF,,,x,Developing +001,World,009,Oceania,061,Polynesia,,,570,Niue,NIU,,,x,Developing +001,World,009,Oceania,061,Polynesia,,,612,Pitcairn,PCN,,,,Developing +001,World,009,Oceania,061,Polynesia,,,882,Samoa,WSM,,,x,Developing +001,World,009,Oceania,061,Polynesia,,,772,Tokelau,TKL,,,,Developing +001,World,009,Oceania,061,Polynesia,,,776,Tonga,TON,,,x,Developing +001,World,009,Oceania,061,Polynesia,,,798,Tuvalu,TUV,x,,x,Developing +001,World,009,Oceania,061,Polynesia,,,876,Wallis and Futuna Islands,WLF,,,,Developing diff --git a/tools/UN M49/region_galaxy.py b/tools/UN M49/region_galaxy.py new file mode 100644 index 0000000..d46c1b9 --- /dev/null +++ b/tools/UN M49/region_galaxy.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import csv +import argparse +import uuid +import json + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Region Galaxy - only create the list of values') + parser.add_argument("-c", "--csv", required=True, help="input csv") + args = parser.parse_args() + + values = [] + + with open(args.csv, newline='') as csvfile: + csvreader = csv.reader(csvfile, delimiter=',', quotechar='"') + pass_first_line = True + for data in csvreader: + if pass_first_line: + pass_first_line = False + continue + temp = {} + value_name = data[0] + " - " + data[1] + + test = 0 + for value in values: + if value['value']==value_name: + test = 1 + break + + if test==0: + temp['value'] = value_name + temp['meta'] = {} + temp['meta']['subregion'] = [] + values.append(temp) + + '''---------------- column 2 ------------------''' + + with open(args.csv, newline='') as csvfile: + csvreader = csv.reader(csvfile, delimiter=',', quotechar='"') + pass_first_line = True + for data in csvreader: + if pass_first_line: + pass_first_line = False + continue + temp = {} + value_name = data[2] + " - " + data[3] + parent_name = data[0] + " - " + data[1] + if value_name == " - ": + continue + + test = 0 + for value in values: + if value['value']==value_name: + test = 1 + break + + if test==0: + temp['value'] = value_name + temp['meta'] = {} + temp['meta']['subregion'] = [] + values.append(temp) + + for value in values: + if value['value']==parent_name: + test = 0 + for sub in value['meta']['subregion']: + if sub == value_name: + test = 1 + break + if test == 0: + value['meta']['subregion'].append(value_name) + + '''---------------- column 3 ------------------''' + + with open(args.csv, newline='') as csvfile: + csvreader = csv.reader(csvfile, delimiter=',', quotechar='"') + pass_first_line = True + for data in csvreader: + if pass_first_line: + pass_first_line = False + continue + temp = {} + value_name = data[4] + " - " + data[5] + parent_name = data[2] + " - " + data[3] + if value_name == " - ": + continue + + test = 0 + for value in values: + if value['value']==value_name: + test = 1 + break + + if test==0: + temp['value'] = value_name + temp['meta'] = {} + temp['meta']['subregion'] = [] + values.append(temp) + + for value in values: + if value['value']==parent_name: + test = 0 + for sub in value['meta']['subregion']: + if sub == value_name: + test = 1 + break + if test == 0: + value['meta']['subregion'].append(value_name) + + + '''---------------- column 4 ------------------''' + + with open(args.csv, newline='') as csvfile: + csvreader = csv.reader(csvfile, delimiter=',', quotechar='"') + pass_first_line = True + for data in csvreader: + if pass_first_line: + pass_first_line = False + continue + temp = {} + value_name = data[6] + " - " + data[7] + parent_name = data[4] + " - " + data[5] + if value_name == " - ": + continue + + test = 0 + for value in values: + if value['value']==value_name: + test = 1 + break + + if test==0: + temp['value'] = value_name + temp['meta'] = {} + temp['meta']['subregion'] = [] + values.append(temp) + + for value in values: + if value['value']==parent_name: + test = 0 + for sub in value['meta']['subregion']: + if sub == value_name: + test = 1 + break + if test == 0: + value['meta']['subregion'].append(value_name) + + '''---------------- column 5 ------------------''' + + with open(args.csv, newline='') as csvfile: + csvreader = csv.reader(csvfile, delimiter=',', quotechar='"') + pass_first_line = True + for data in csvreader: + if pass_first_line: + pass_first_line = False + continue + temp = {} + value_name = data[8] + " - " + data[9] + x=6 + y=7 + test = 0 + while test == 0: + parent_name = data[x] + " - " + data[y] + if parent_name == " - ": + x=x-2 + y=y-2 + else: + test=1 + + for value in values: + if value['value']==parent_name: + test = 0 + for sub in value['meta']['subregion']: + if sub == value_name: + test = 1 + break + if test == 0: + value['meta']['subregion'].append(value_name) + + + print (values) + + with open('region_valuea.json', 'w') as outfile: + json.dump(values, outfile)