Last active
September 7, 2016 01:43
-
-
Save vvikramjhu/c7f4b6edec3426cae3bcf0bc179d3ab4 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
for year in all/* | |
do | |
echo -ne `basename $year .gz`"\t" | |
gunzip -c $year | \ | |
awk '{ temp = substr($0, 88, 5) + 0; | |
q = substr($0, 93, 1); | |
if (temp !=9999 && q ~ /[01459]/ && temp > max) max = temp } | |
END { print max }' | |
done |
This file contains 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
input is in form of zipped files each having the weather station nos and the year : "startingStation endingStation year" | |
010010-99999-1990.gz | |
010014-99999-1990.gz | |
010015-99999-1990.gz | |
010016-99999-1990.gz | |
010017-99999-1990.gz | |
010030-99999-1990.gz | |
010040-99999-1990.gz | |
010080-99999-1990.gz | |
010100-99999-1990.gz | |
010150-99999-1990.gz | |
Each file for each weather station inside each zip has data like this --- | |
0057 | |
332130 # USAF weather station identifier | |
99999 # WBAN weather station identifier | |
19500101 # observation date | |
0300 # observation time | |
4 | |
+51317 # latitude (degrees x 1000) | |
+028783 # longitude (degrees x 1000) | |
FM-12 | |
+0171 # elevation (meters) | |
99999 | |
V020 | |
320 # wind direction (degrees) | |
1 # quality code | |
N | |
0072 | |
1 | |
00450 # sky ceiling height (meters) | |
1 # quality code | |
C | |
N | |
010000 # visibility distance (meters) | |
1 # quality code | |
N | |
9 | |
-0128 # air temperature (degrees Celsius x 10) | |
1 # quality code | |
-0139 # dew point temperature (degrees Celsius x 10) | |
1 # quality code | |
10268 # atmospheric pressure (hectopascals x 10) | |
1 # quality code | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment