summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsh/wtr7
1 files changed, 1 insertions, 6 deletions
diff --git a/sh/wtr b/sh/wtr
index c9907d9..5b385d6 100755
--- a/sh/wtr
+++ b/sh/wtr
@@ -1,8 +1,7 @@
#!/bin/sh
# https://github.com/open-meteo/open-meteo
-i=0
-curl -s -G -d "latitude=${1:-37.34}" -d "longitude=${2:--121.89}" -d 'daily=weathercode,temperature_2m_max,temperature_2m_min,sunrise,sunset' -d 'timezone=auto' 'https://api.open-meteo.com/v1/forecast' | jq -r '[.daily|.time, .weathercode, .temperature_2m_max, .temperature_2m_min, .sunrise, .sunset]|transpose|.[]|@tsv' | while read -r time code max min sunrise sunset; do
+curl -s -G -d "latitude=${1:-37.34}" -d "longitude=${2:--121.89}" -d 'daily=weathercode,temperature_2m_max,temperature_2m_min' -d 'timezone=auto' 'https://api.open-meteo.com/v1/forecast' | jq -r '[.daily|.time, .weathercode, .temperature_2m_max, .temperature_2m_min]|transpose|.[]|@tsv' | while read -r time code max min; do
# https://open-meteo.com/en/docs
case "$code" in
0) code='clear sky';;
@@ -35,9 +34,5 @@ curl -s -G -d "latitude=${1:-37.34}" -d "longitude=${2:--121.89}" -d 'daily=weat
99) code='thunderstorm with heavy hail';;
*) exit 1;;
esac
- if [ "$i" -ne 1 ]; then
- printf 'sunrise: %s | sunset: %s\n' "${sunrise#*T}" "${sunset#*T}"
- i=1
- fi
printf '%s\t%s\t%s\t%s\n' "${time#*-}" "$max" "$min" "$code"
done