lib/Weather/GHCN/CountryCodes.pm

filter: Statementstmt 100% 54 / 54 Branchbran 100% 18 / 18 Conditioncond 100% 2 / 3 MC/DCmcdc 100% 1 / 2 Subroutinesub 100% 11 / 11 Podpod 100% 3 / 3 totaltotal 100% 89 / 91 CC 12 SCAR 18.1
CC
12
Cov
100%
search_country
11.0
get_country_by_gec
2.0
BEGIN
1.0
CRAP 6.1
« lib/Weather/GHCN/App/StationCounts.pm ↑ Summary lib/Weather/GHCN/TimingStats.pm »
1 # CountryCodes.pm - map country codes to country names.
2
3 ## no critic (Documentation::RequirePodAtEnd)
4
5 =head1 NAME
6
7 Weather::GHCN::CountryCodes - convert between various country codes
8  
9 =head1 VERSION
10  
11 version v0.0.002
12
13 =head1 SYNOPSIS
14
15 use Weather::GHCN::CountryCodes qw(:all);
16
17
18 =head1 DESCRIPTION
19
20 The B<CountryCodes> module provides functions to search a table of country
21 codes and country names using various search criteria. It can also do a
22 direct lookup of a country entry using the 2-character GEC (formerly FIPS)
23 code.
24
25 The source for the mapping table is taken from the CIA World Factbook. See
26 https://www.cia.gov/library/publications/the-world-factbook/appendix/appendix-d.html
27
28 The module is primarily for use by modules Weather::GHCN::Options, and
29 Weather::GHCN::StationTable.
30
31 =cut
32
33
34 5 ▶use v5.18; # minimum for Object::Pad
Subroutine BEGIN: called CC=1 SCAR=0.0
35
36 5 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
37 5 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
38
39 package Weather::GHCN::CountryCodes;
40
41 5 our $VERSION = 'v0.0.002';
42
43 5 ▶use Carp qw(carp croak cluck confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
44 5 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
45 5 ▶use Const::Fast;
Subroutine BEGIN: called CC=1 SCAR=0.0
46
47 5 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 5 ▶use parent 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
49
50 # Items to export into callers namespace by default.
51 ## no critic [Modules::ProhibitAutomaticExportation]
52 5 our @EXPORT = ( qw/ get_country_by_gec search_country / );
53
54
55 5 my %Country;
56
57 # Preloaded methods go here.
58
59 # Constants
60
61 5 const my $EMPTY => q(); # empty string
62 5 const my $SPACE => q( ); # space character
63 5 const my $TAB => qq(\t); # tab character
64 5 const my $TRUE => 1; # perl's usual TRUE
65 5 const my $FALSE => not $TRUE; # a dual-var consisting of '' and 0
66
67
68 #############################################################################
69
70 # Load the %Country hash during the UNITCHECK phase, before any of the
71 # regular runtime code needs it.
72
73 UNITCHECK {
74 my @lines = split m{ \n }xms, country_table();
75
76 foreach my $line (@lines) {
77 my ($entity, $gec, $iso2, $iso3, $isonum, $nato, $internet, $comment) = split m{ [|] }xms, $line;
78
79 # skip table entries with no GEC
80 next if $gec eq '-';
81
82 # check for duplicates, though there shouldn't be any
83 croak "*W* country $entity with GEC $gec already exists"
84 if $Country{$gec};
85
86 $Country{$gec} = {
87 'name' => $entity,
88 'gec' => $gec,
89 'iso2' => $iso2,
90 'iso3' => $iso3,
91 'isonum' => $isonum,
92 'nato' => $nato,
93 'internet' => $internet,
94 'comment' => $comment
95 };
96 }
97 }
98
99 #############################################################################
100
101 =head1 FUNCTIONS
102
103 =head2 get_country_by_gec($code)
104
105 For a given GEC (FIPS) country code, return a hash containing the country
106 name and other country codes. Returns empty if the code was not found.
107
108 =cut
109
110 ▶sub get_country_by_gec ($code) {
Subroutine get_country_by_gec: called CC=2 SCAR=6.9
Pod documented
111 # uncoverable condition right
112 4 ▶ return $Country{$code} // $EMPTY;
Condition100%3/3
$Country{$code} // $EMPTY
l!l&&r!l&&!r
202
MC/DC50%1/2
$Country{$code} // $EMPTY
$Country{$code} -$EMPTY
Truth table66%2/3
A // B
A= $Country{$code}B= $EMPTY
ABresult
1X1
011
000
113 }
114
115 =head2 search_country( $search [, $type] )
116
117 Search the country table and return the entries which match the
118 search criteria. The optional $type argument allows you to designate
119 which field the search criteria is to be matched against, as follows:
120
121 name does an unanchored pattern match on the country name
122 gec matches the GEC (formerly FIPS) country code
123 iso2 matches the ISO 3166 2-character country code
124 iso3 matches the ISO 3166 3-character country code
125 isonum matches the ISO 3166 country numeric code
126 nato matches the STANAG 1059 country code used by NATO
127 internet matches the internet country code (such as .ca)
128
129 If the search criteria is only two-characters long, then the type
130 defaults to gec. To match a name, the search criteria must be longer
131 than three characters, otherwise you'll get results from matches against
132 gec or iso3.
133
134 In list context, all matches are returned. In scalar context,
135 only the first match is returned. Undef is returned if there
136 are no matches.
137
138 =cut
139
140 ▶sub search_country ($search_value, $field) {
Subroutine search_country: called CC=11 SCAR=24.0
Pod documented
141 14 my $search_key;
142
143 ## no critic [ValuesAndExpressions::ProhibitMagicNumbers]
144
145 14 ▶ if ( defined $field ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $field) { } 8 6 14
146 8 ▶ if ( $field !~ m{ \A (gec | iso2 | iso3 | isonum | nato | internet | name) \Z }xmsi) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($field =~ / \A (gec | iso2 | iso3 | isonum | nato | internet | name) \Z /imsux) 1 7 8
147 1 croak 'invalid search field name';
148 }
149 7 $search_key = lc $field;
150 } else {
151 6 ▶ if ( $search_value =~ m{ \A \d+ \Z }xms ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($search_value =~ / \A \d+ \Z /msux) { } 1 5 6
elsif ($search_value =~ / \A [.][[:lower:]][[:lower:]] \Z /imsux) { } 1 4 5
elsif (length $search_value == 2) { } 1 3 4
elsif (length $search_value == 3) { } 2 1 3
152 1 $search_key = 'isonum';
153 }
154 elsif ( $search_value =~ m{ \A [.][[:lower:]][[:lower:]] \Z }xmsi ) {
155 1 $search_key = 'internet';
156 }
157 elsif ( length $search_value == 2 ) {
158 1 $search_key = 'gec';
159 }
160 elsif ( length $search_value == 3 ) {
161 2 $search_key = 'iso3';
162 }
163 # can't distinguish between iso3 and nato so this branch
164 # would be unreachable -- removed for better test coverage
165 # elsif ( length $search_value == 3 ) {
166 # $search_key = 'nato';
167 # }
168 else {
169 1 $search_key = 'name';
170 }
171 }
172
173 13 my @results;
174 13 foreach my $href (
175 24150 sort { $a->{$search_key} cmp $b->{$search_key} }
176 values %Country )
177 {
178 3523 my $v = lc $href->{$search_key};
179
180 3523 ▶ if ($search_key eq 'name') {
Branch: 1 branch
BranchTrueFalseTotal
if ($search_key eq 'name') { } 542 2981 3523
181 ## no critic [RequireDotMatchAnything]
182 ## no critic [RequireExtendedFormatting]
183 ## no critic [RequireLineBoundaryMatching]
184 542 ▶ push @results, $href if $v =~ m{$search_value}i;
Branch: 1 branch
BranchTrueFalseTotal
if $v =~ /$search_value/iu 6 536 542
185 } else {
186 2981 ▶ push @results, $href if $v eq lc $search_value
Branch: 1 branch
BranchTrueFalseTotal
if $v eq lc $search_value 10 2971 2981
187 }
188 }
189
190 13 return @results;
191 }
192
193 =head2 country_table
194
195 Returns the country table.
196
197 =cut
198
199 sub country_table {
200 5 ▶ my () = @_;
Subroutine country_table: called CC=1 SCAR=0.0
Pod documented
201
202 #entity|gec|iso2|iso3|isonum|nato|internet|comment
203
204 5 return <<'_TABLE_';
205 Afghanistan|AF|AF|AFG|4|AFG|.af|
206 Akrotiri|AX|-|-|-|-|-|
207 Albania|AL|AL|ALB|8|ALB|.al|
208 Algeria|AG|DZ|DZA|12|DZA|.dz|
209 American Samoa|AQ|AS|ASM|16|ASM|.as|
210 Andorra|AN|AD|AND|20|AND|.ad|
211 Angola|AO|AO|AGO|24|AGO|.ao|
212 Anguilla|AV|AI|AIA|660|AIA|.ai|
213 Antarctica|AY|AQ|ATA|10|ATA|.aq|ISO defines as the territory south of 60 degrees south latitude
214 Antigua and Barbuda|AC|AG|ATG|28|ATG|.ag|
215 Argentina|AR|AR|ARG|32|ARG|.ar|
216 Armenia|AM|AM|ARM|51|ARM|.am|
217 Aruba|AA|AW|ABW|533|ABW|.aw|
218 Ashmore and Cartier Islands|AT|-|-|-|AUS|-|ISO includes with Australia
219 Australia|AS|AU|AUS|36|AUS|.au|ISO includes Ashmore and Cartier Islands, Coral Sea Islands
220 Austria|AU|AT|AUT|40|AUT|.at|
221 Azerbaijan|AJ|AZ|AZE|31|AZE|.az|
222 Bahamas, The|BF|BS|BHS|44|BHS|.bs|
223 Bahrain|BA|BH|BHR|48|BHR|.bh|
224 Baker Island|FQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
225 Bangladesh|BG|BD|BGD|50|BGD|.bd|
226 Barbados|BB|BB|BRB|52|BRB|.bb|
227 Bassas da India|BS|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
228 Belarus|BO|BY|BLR|112|BLR|.by|
229 Belgium|BE|BE|BEL|56|BEL|.be|
230 Belize|BH|BZ|BLZ|84|BLZ|.bz|
231 Benin|BN|BJ|BEN|204|BEN|.bj|
232 Bermuda|BD|BM|BMU|60|BMU|.bm|
233 Bhutan|BT|BT|BTN|64|BTN|.bt|
234 Bolivia|BL|BO|BOL|68|BOL|.bo|
235 Bosnia and Herzegovina|BK|BA|BIH|70|BIH|.ba|
236 Botswana|BC|BW|BWA|72|BWA|.bw|
237 Bouvet Island|BV|BV|BVT|74|BVT|.bv|
238 Brazil|BR|BR|BRA|76|BRA|.br|
239 British Indian Ocean Territory|IO|IO|IOT|86|IOT|.io|
240 British Virgin Islands|VI|VG|VGB|92|VGB|.vg|
241 Brunei|BX|BN|BRN|96|BRN|.bn|
242 Bulgaria|BU|BG|BGR|100|BGR|.bg|
243 Burkina Faso|UV|BF|BFA|854|BFA|.bf|
244 Burma|BM|MM|MMR|104|MMR|.mm|ISO uses the name Myanmar
245 Burundi|BY|BI|BDI|108|BDI|.bi|
246 Cabo Verde|CV|CV|CPV|132|CPV|.cv|
247 Cambodia|CB|KH|KHM|116|KHM|.kh|
248 Cameroon|CM|CM|CMR|120|CMR|.cm|
249 Canada|CA|CA|CAN|124|CAN|.ca|
250 Cayman Islands|CJ|KY|CYM|136|CYM|.ky|
251 Central African Republic|CT|CF|CAF|140|CAF|.cf|
252 Chad|CD|TD|TCD|148|TCD|.td|
253 Chile|CI|CL|CHL|152|CHL|.cl|
254 China|CH|CN|CHN|156|CHN|.cn|see also Taiwan
255 Christmas Island|KT|CX|CXR|162|CXR|.cx|
256 Clipperton Island|IP|-|-|-|FYP|-|ISO includes with France
257 Cocos (Keeling) Islands|CK|CC|CCK|166|AUS|.cc|
258 Colombia|CO|CO|COL|170|COL|.co|
259 Comoros|CN|KM|COM|174|COM|.km|
260 Congo, Democratic Republic of the|CG|CD|COD|180|COD|.cd|formerly Zaire
261 Congo, Republic of the|CF|CG|COG|178|COG|.cg|
262 Cook Islands|CW|CK|COK|184|COK|.ck|
263 Coral Sea Islands|CR|-|-|-|AUS|-|ISO includes with Australia
264 Costa Rica|CS|CR|CRI|188|CRI|.cr|
265 Cote d'Ivoire|IV|CI|CIV|384|CIV|.ci|
266 Croatia|HR|HR|HRV|191|HRV|.hr|
267 Cuba|CU|CU|CUB|192|CUB|.cu|
268 Curacao|UC|CW|CUW|531|-|.cw|
269 Cyprus|CY|CY|CYP|196|CYP|.cy|
270 Czechia|EZ|CZ|CZE|203|CZE|.cz|
271 Denmark|DA|DK|DNK|208|DNK|.dk|
272 Dhekelia|DX|-|-|-|-|-|
273 Djibouti|DJ|DJ|DJI|262|DJI|.dj|
274 Dominica|DO|DM|DMA|212|DMA|.dm|
275 Dominican Republic|DR|DO|DOM|214|DOM|.do|
276 Ecuador|EC|EC|ECU|218|ECU|.ec|
277 Egypt|EG|EG|EGY|818|EGY|.eg|
278 El Salvador|ES|SV|SLV|222|SLV|.sv|
279 Equatorial Guinea|EK|GQ|GNQ|226|GNQ|.gq|
280 Eritrea|ER|ER|ERI|232|ERI|.er|
281 Estonia|EN|EE|EST|233|EST|.ee|
282 Eswatini|WZ|SZ|SWZ|748|SWZ|.sz|
283 Ethiopia|ET|ET|ETH|231|ETH|.et|
284 Europa Island|EU|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
285 Falkland Islands (Islas Malvinas)|FK|FK|FLK|238|FLK|.fk|
286 Faroe Islands|FO|FO|FRO|234|FRO|.fo|
287 Fiji|FJ|FJ|FJI|242|FJI|.fj|
288 Finland|FI|FI|FIN|246|FIN|.fi|
289 France|FR|FR|FRA|250|FRA|.fr|ISO includes metropolitan France along with the dependencies of Clipperton Island, French Guiana, French Polynesia, French Southern and Antarctic Lands, Guadeloupe, Martinique, Mayotte, New Caledonia, Reunion, Saint Pierre and Miquelon, Wallis and Futuna
290 France, Metropolitan|-|FX|FXX|249|-|.fx|ISO limits to the European part of France
291 French Guiana|FG|GF|GUF|254|GUF|.gf|
292 French Polynesia|FP|PF|PYF|258|PYF|.pf|
293 French Southern and Antarctic Lands|FS|TF|ATF|260|ATF|.tf|GEC does not include the French-claimed portion of Antarctica (Terre Adelie)
294 Gabon|GB|GA|GAB|266|GAB|.ga|
295 Gambia, The|GA|GM|GMB|270|GMB|.gm|
296 Gaza Strip|GZ|PS|PSE|275|PSE|.ps|ISO identifies as Occupied Palestinian Territory
297 Georgia|GG|GE|GEO|268|GEO|.ge|
298 Germany|GM|DE|DEU|276|DEU|.de|
299 Ghana|GH|GH|GHA|288|GHA|.gh|
300 Gibraltar|GI|GI|GIB|292|GIB|.gi|
301 Glorioso Islands|GO|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
302 Greece|GR|GR|GRC|300|GRC|.gr|For its internal communications, the European Union recommends the use of the code EL in lieu of the ISO 3166-2 code of GR
303 Greenland|GL|GL|GRL|304|GRL|.gl|
304 Grenada|GJ|GD|GRD|308|GRD|.gd|
305 Guadeloupe|GP|GP|GLP|312|GLP|.gp|
306 Guam|GQ|GU|GUM|316|GUM|.gu|
307 Guatemala|GT|GT|GTM|320|GTM|.gt|
308 Guernsey|GK|GG|GGY|831|UK|.gg|
309 Guinea|GV|GN|GIN|324|GIN|.gn|
310 Guinea-Bissau|PU|GW|GNB|624|GNB|.gw|
311 Guyana|GY|GY|GUY|328|GUY|.gy|
312 Haiti|HA|HT|HTI|332|HTI|.ht|
313 Heard Island and McDonald Islands|HM|HM|HMD|334|HMD|.hm|
314 Holy See (Vatican City)|VT|VA|VAT|336|VAT|.va|
315 Honduras|HO|HN|HND|340|HND|.hn|
316 Hong Kong|HK|HK|HKG|344|HKG|.hk|
317 Howland Island|HQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
318 Hungary|HU|HU|HUN|348|HUN|.hu|
319 Iceland|IC|IS|ISL|352|ISL|.is|
320 India|IN|IN|IND|356|IND|.in|
321 Indonesia|ID|ID|IDN|360|IDN|.id|
322 Iran|IR|IR|IRN|364|IRN|.ir|
323 Iraq|IZ|IQ|IRQ|368|IRQ|.iq|
324 Ireland|EI|IE|IRL|372|IRL|.ie|
325 Isle of Man|IM|IM|IMN|833|UK|.im|
326 Israel|IS|IL|ISR|376|ISR|.il|
327 Italy|IT|IT|ITA|380|ITA|.it|
328 Jamaica|JM|JM|JAM|388|JAM|.jm|
329 Jan Mayen|JN|-|-|-|SJM|-|ISO includes with Svalbard
330 Japan|JA|JP|JPN|392|JPN|.jp|
331 Jarvis Island|DQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
332 Jersey|JE|JE|JEY|832|UK|.je|
333 Johnston Atoll|JQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
334 Jordan|JO|JO|JOR|400|JOR|.jo|
335 Juan de Nova Island|JU|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
336 Kazakhstan|KZ|KZ|KAZ|398|KAZ|.kz|
337 Kenya|KE|KE|KEN|404|KEN|.ke|
338 Kingman Reef|KQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
339 Kiribati|KR|KI|KIR|296|KIR|.ki|
340 Korea, North|KN|KP|PRK|408|PRK|.kp|
341 Korea, South|KS|KR|KOR|410|KOR|.kr|
342 Kosovo|KV|XK|XKS|-|-|-|XK and XKS are ISO 3166 user assigned codes; ISO 3166 Maintenace Authority has not assigned codes
343 Kuwait|KU|KW|KWT|414|KWT|.kw|
344 Kyrgyzstan|KG|KG|KGZ|417|KGZ|.kg|
345 Laos|LA|LA|LAO|418|LAO|.la|
346 Latvia|LG|LV|LVA|428|LVA|.lv|
347 Lebanon|LE|LB|LBN|422|LBN|.lb|
348 Lesotho|LT|LS|LSO|426|LSO|.ls|
349 Liberia|LI|LR|LBR|430|LBR|.lr|
350 Libya|LY|LY|LBY|434|LBY|.ly|
351 Liechtenstein|LS|LI|LIE|438|LIE|.li|
352 Lithuania|LH|LT|LTU|440|LTU|.lt|
353 Luxembourg|LU|LU|LUX|442|LUX|.lu|
354 Macau|MC|MO|MAC|446|MAC|.mo|
355 Madagascar|MA|MG|MDG|450|MDG|.mg|
356 Malawi|MI|MW|MWI|454|MWI|.mw|
357 Malaysia|MY|MY|MYS|458|MYS|.my|
358 Maldives|MV|MV|MDV|462|MDV|.mv|
359 Mali|ML|ML|MLI|466|MLI|.ml|
360 Malta|MT|MT|MLT|470|MLT|.mt|
361 Marshall Islands|RM|MH|MHL|584|MHL|.mh|
362 Martinique|MB|MQ|MTQ|474|MTQ|.mq|
363 Mauritania|MR|MR|MRT|478|MRT|.mr|
364 Mauritius|MP|MU|MUS|480|MUS|.mu|
365 Mayotte|MF|YT|MYT|175|FRA|.yt|
366 Mexico|MX|MX|MEX|484|MEX|.mx|
367 Micronesia, Federated States of|FM|FM|FSM|583|FSM|.fm|
368 Midway Islands|MQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
369 Moldova|MD|MD|MDA|498|MDA|.md|
370 Monaco|MN|MC|MCO|492|MCO|.mc|
371 Mongolia|MG|MN|MNG|496|MNG|.mn|
372 Montenegro|MJ|ME|MNE|499|MNE|.me|
373 Montserrat|MH|MS|MSR|500|MSR|.ms|
374 Morocco|MO|MA|MAR|504|MAR|.ma|
375 Mozambique|MZ|MZ|MOZ|508|MOZ|.mz|
376 Myanmar|-|-|-|-|-|-|see Burma
377 Namibia|WA|NA|NAM|516|NAM|.na|
378 Nauru|NR|NR|NRU|520|NRU|.nr|
379 Navassa Island|BQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
380 Nepal|NP|NP|NPL|524|NPL|.np|
381 Netherlands|NL|NL|NLD|528|NLD|.nl|
382 Netherlands Antilles|NT||||ANT|.an|disestablished in October 2010 this entity no longer exists; ISO deleted the codes in December 2010
383 New Caledonia|NC|NC|NCL|540|NCL|.nc|
384 New Zealand|NZ|NZ|NZL|554|NZL|.nz|
385 Nicaragua|NU|NI|NIC|558|NIC|.ni|
386 Niger|NG|NE|NER|562|NER|.ne|
387 Nigeria|NI|NG|NGA|566|NGA|.ng|
388 Niue|NE|NU|NIU|570|NIU|.nu|
389 Norfolk Island|NF|NF|NFK|574|NFK|.nf|
390 North Macedonia|MK|MK|MKD|807|FYR|.mk|
391 Northern Mariana Islands|CQ|MP|MNP|580|MNP|.mp|
392 Norway|NO|NO|NOR|578|NOR|.no|
393 Oman|MU|OM|OMN|512|OMN|.om|
394 Pakistan|PK|PK|PAK|586|PAK|.pk|
395 Palau|PS|PW|PLW|585|PLW|.pw|
396 Palmyra Atoll|LQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
397 Panama|PM|PA|PAN|591|PAN|.pa|
398 Papua New Guinea|PP|PG|PNG|598|PNG|.pg|
399 Paracel Islands|PF|-|-|-|-|-|
400 Paraguay|PA|PY|PRY|600|PRY|.py|
401 Peru|PE|PE|PER|604|PER|.pe|
402 Philippines|RP|PH|PHL|608|PHL|.ph|
403 Pitcairn Islands|PC|PN|PCN|612|PCN|.pn|
404 Poland|PL|PL|POL|616|POL|.pl|
405 Portugal|PO|PT|PRT|620|PRT|.pt|
406 Puerto Rico|RQ|PR|PRI|630|PRI|.pr|
407 Qatar|QA|QA|QAT|634|QAT|.qa|
408 Reunion|RE|RE|REU|638|REU|.re|
409 Romania|RO|RO|ROU|642|ROU|.ro|
410 Russia|RS|RU|RUS|643|RUS|.ru|
411 Rwanda|RW|RW|RWA|646|RWA|.rw|
412 Saint Barthelemy|TB|BL|BLM|652|-|.bl|ccTLD .fr and .gp may also be used
413 Saint Helena, Ascension, and Tristan da Cunha|SH|SH|SHN|654|SHN|.sh|includes Saint Helena Island, Ascension Island, and the Tristan da Cunha archipelago
414 Saint Kitts and Nevis|SC|KN|KNA|659|KNA|.kn|
415 Saint Lucia|ST|LC|LCA|662|LCA|.lc|
416 Saint Martin|RN|MF|MAF|663|-|.mf|ccTLD .fr and .gp may also be used
417 Saint Pierre and Miquelon|SB|PM|SPM|666|SPM|.pm|
418 Saint Vincent and the Grenadines|VC|VC|VCT|670|VCT|.vc|
419 Samoa|WS|WS|WSM|882|WSM|.ws|
420 San Marino|SM|SM|SMR|674|SMR|.sm|
421 Sao Tome and Principe|TP|ST|STP|678|STP|.st|
422 Saudi Arabia|SA|SA|SAU|682|SAU|.sa|
423 Senegal|SG|SN|SEN|686|SEN|.sn|
424 Serbia|RI|RS|SRB|688|-|.rs|
425 Seychelles|SE|SC|SYC|690|SYC|.sc|
426 Sierra Leone|SL|SL|SLE|694|SLE|.sl|
427 Singapore|SN|SG|SGP|702|SGP|.sg|
428 Sint Maarten|NN|SX|SXM|534|-|.sx|
429 Slovakia|LO|SK|SVK|703|SVK|.sk|
430 Slovenia|SI|SI|SVN|705|SVN|.si|
431 Solomon Islands|BP|SB|SLB|90|SLB|.sb|
432 Somalia|SO|SO|SOM|706|SOM|.so|
433 South Africa|SF|ZA|ZAF|710|ZAF|.za|
434 South Georgia and the Islands|SX|GS|SGS|239|SGS|.gs|
435 South Sudan|OD|SS|SSD|728|-|-|IANA has designated .ss as the ccTLD for South Sudan, however it has not been activated in DNS root zone
436 Spain|SP|ES|ESP|724|ESP|.es|
437 Spratly Islands|PG|-|-|-|-|-|
438 Sri Lanka|CE|LK|LKA|144|LKA|.lk|
439 Sudan|SU|SD|SDN|729|SDN|.sd|
440 Suriname|NS|SR|SUR|740|SUR|.sr|
441 Svalbard|SV|SJ|SJM|744|SJM|.sj|ISO includes Jan Mayen
442 Sweden|SW|SE|SWE|752|SWE|.se|
443 Switzerland|SZ|CH|CHE|756|CHE|.ch|
444 Syria|SY|SY|SYR|760|SYR|.sy|
445 Taiwan|TW|TW|TWN|158|TWN|.tw|
446 Tajikistan|TI|TJ|TJK|762|TJK|.tj|
447 Tanzania|TZ|TZ|TZA|834|TZA|.tz|
448 Thailand|TH|TH|THA|764|THA|.th|
449 Timor-Leste|TT|TL|TLS|626|TLS|.tl|
450 Togo|TO|TG|TGO|768|TGO|.tg|
451 Tokelau|TL|TK|TKL|772|TKL|.tk|
452 Tonga|TN|TO|TON|776|TON|.to|
453 Trinidad and Tobago|TD|TT|TTO|780|TTO|.tt|
454 Tromelin Island|TE|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
455 Tunisia|TS|TN|TUN|788|TUN|.tn|
456 Turkey|TU|TR|TUR|792|TUR|.tr|
457 Turkmenistan|TX|TM|TKM|795|TKM|.tm|
458 Turks and Caicos Islands|TK|TC|TCA|796|TCA|.tc|
459 Tuvalu|TV|TV|TUV|798|TUV|.tv|
460 Uganda|UG|UG|UGA|800|UGA|.ug|
461 Ukraine|UP|UA|UKR|804|UKR|.ua|
462 United Arab Emirates|AE|AE|ARE|784|ARE|.ae|
463 United Kingdom|UK|GB|GBR|826|GBR|.uk|for its internal communications, the European Union recommends the use of the code UK in lieu of the ISO 3166-2 code of GB
464 United States|US|US|USA|840|USA|.us|
465 United States Minor Outlying Islands|-|UM|UMI|581|-|.um|ISO includes Baker Island, Howland Island, Jarvis Island, Johnston Atoll, Kingman Reef, Midway Islands, Navassa Island, Palmyra Atoll, Wake Island
466 Uruguay|UY|UY|URY|858|URY|.uy|
467 Uzbekistan|UZ|UZ|UZB|860|UZB|.uz|
468 Vanuatu|NH|VU|VUT|548|VUT|.vu|
469 Venezuela|VE|VE|VEN|862|VEN|.ve|
470 Vietnam|VM|VN|VNM|704|VNM|.vn|
471 Virgin Islands|VQ|VI|VIR|850|VIR|.vi|
472 Virgin Islands (UK)|-|-|-|-|-|.vg|see British Virgin Islands
473 Virgin Islands (US)|-|-|-|-|-|.vi|see Virgin Islands
474 Wake Island|WQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
475 Wallis and Futuna|WF|WF|WLF|876|WLF|.wf|
476 West Bank|WE|PS|PSE|275|PSE|.ps|ISO identifies as Occupied Palestinian Territory
477 Western Sahara|WI|EH|ESH|732|ESH|.eh|
478 Western Samoa|-|-|-|-|-|.ws|see Samoa
479 World|-|-|-|-|-|-|the Factbook uses the W data code from DIAM 65-18 Geopolitical Data Elements and Related Features, Data Standard No. 3, December 1994, published by the Defense Intelligence Agency
480 Yemen|YM|YE|YEM|887|YEM|.ye|
481 Zaire|-|-|-|-|-|-|see Democratic Republic of the Congo
482 Zambia|ZA|ZM|ZMB|894|ZMB|.zm|
483 Zimbabwe|ZI|ZW|ZWE|716|ZWE|.zw|
484 _TABLE_
485 }
486
487 5 1; # file must return true when compiled
488
489 __END__
« lib/Weather/GHCN/App/StationCounts.pm ↑ Summary lib/Weather/GHCN/TimingStats.pm »