X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=v1%2Fbin%2Fkhatus_update_weather;fp=v1%2Fbin%2Fkhatus_update_weather;h=0000000000000000000000000000000000000000;hb=499c58a269a00e031302938b5a8f006f23aae451;hp=665ae07198cd40636d22f42b2bf5d93b7ab27357;hpb=4c703fadbdc17d1753d16841582636598f862416;p=khatus.git diff --git a/v1/bin/khatus_update_weather b/v1/bin/khatus_update_weather deleted file mode 100755 index 665ae07..0000000 --- a/v1/bin/khatus_update_weather +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/bash - -set -e - -STATION_ID="$1" # ICAO designator. e.g. KJFK, KBOS - -FILE_METAR_DECODED="$HOME/var/run/metar-${STATION_ID}-decoded" -FILE_TEMP_FAHRENHEIT="${FILE_METAR_DECODED}-temp-fahrenheit" -FILE_TEMP_CELSIUS="${FILE_METAR_DECODED}-temp-celsius" - -(metar -d "$STATION_ID" 2>&1) > $FILE_METAR_DECODED # TODO: Better error handling - -awk \ - -v file_fahrenheit="$FILE_TEMP_FAHRENHEIT" \ - -v file_celsius="$FILE_TEMP_CELSIUS" \ - ' - /METAR pattern not found in NOAA data/ { - failures++ - } - - /^Temperature/ { - celsius = $3; - fahrenheit = (celsius * (9 / 5)) + 32; - } - - END { - if (failures > 0) { - print "--" > file_fahrenheit - print "--" > file_celsius - } else { - print fahrenheit > file_fahrenheit - print celsius > file_celsius - } - }' \ - $FILE_METAR_DECODED