You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
3.0 KiB
78 lines
3.0 KiB
4 years ago
|
January 2021
|
||
|
====================
|
||
|
Stations are retrieved from https://tgftp.nws.noaa.gov/data/nsd_cccc.txt
|
||
|
|
||
|
wget -O data/nsd_cccc.txt https://tgftp.nws.noaa.gov/data/nsd_cccc.txt
|
||
|
|
||
|
dos2unix data/nsd_cccc.txt
|
||
|
|
||
|
data/station_names.txt is used to provide correct orthography of the area
|
||
|
where the station is located, which is used in the configuration dialog
|
||
|
of kweather applet.
|
||
|
|
||
|
The format of station_names.txt is ICAO;status;region_state;name;INFO1;INFO2
|
||
|
|
||
|
If status is one of none|false|na|decomissioned the station is ignored.
|
||
|
INFO1 is what was previously the 5th position in weather_stations.desktop
|
||
|
makred with ------
|
||
|
INFO2 is what was previously the 6th position in weather_stations.desktop
|
||
|
makred with ---
|
||
|
|
||
|
The source nsd_cccc.txt has illed information and structure that needs to be
|
||
|
corrected in the files used in kweather. Some of the problems are:
|
||
|
1. decomissioned stations
|
||
|
2. names of station locations
|
||
|
|
||
|
The genstations.pl is based on following idea
|
||
|
|
||
|
Based on the input nsd_cccc.txt and the station_names.txt file we can
|
||
|
generate stations.dat like following:
|
||
|
|
||
|
for each station in nsd_cccc.txt do
|
||
|
check if station ID matches one in station_names.txt
|
||
|
if it matches then
|
||
|
use the name of the station
|
||
|
else
|
||
|
use the name from nsd_cccc.txt
|
||
|
write entry/line in stations.dat
|
||
|
|
||
|
Based on stations.dat and weather_stations.desktop.in we can generate
|
||
|
weather_stations.desktop.
|
||
|
weather_stations.desktop will be updated with the names from stations.dat
|
||
|
and the additional information will be preserved like following.
|
||
|
for each station in stations.dat
|
||
|
for each region from weather_stations.desktop.in
|
||
|
if state is provided in stations.dat
|
||
|
use the state to build a key with region and state
|
||
|
else
|
||
|
for each state in the states of the region
|
||
|
use the state to build a key
|
||
|
if section for this key exists
|
||
|
and
|
||
|
if name of the section matches
|
||
|
stop processing
|
||
|
proper section was found
|
||
|
we add the station here
|
||
|
write entry for the station
|
||
|
|
||
|
There are few problems with this approach and the ill provided nsd_cccc.txt data
|
||
|
|
||
|
1. States are missing and thus correlation between station and state can not be done
|
||
|
2. When State is missing, based on the country/state name some entries are ambig
|
||
|
Example Georgia and US state of Georgia
|
||
|
|
||
|
Country list seemed to be used for the country names and as convention here
|
||
|
wget ftp://ftp.ncdc.noaa.gov/pub/data/noaa/country-list.txt but the FIPS notation was
|
||
|
dropped in 2008 as a standard, however continiues to be used.
|
||
|
|
||
|
"The Census Bureau decided that, based on decades of using the terminology FIPS to
|
||
|
describe its codes, it would continue to use the FIPS name for its updated codes,
|
||
|
where FIPS now stood for FIP "Series", since there no longer existed an official
|
||
|
FIP "Standard". [https://en.wikipedia.org/wiki/FIPS_county_code]
|
||
|
|
||
|
A mapping to ISO 3166 ALPHA-2 https://laendercode.net/en/2-letter-list.html
|
||
|
seems more appropriate.
|
||
|
|
||
|
TODO: check the country code mapping in weather_stations.desktop.in
|
||
|
|