ansiweather

Weather in terminal, with ANSI colors and Unicode symbols
Log | Files | Refs | README | LICENSE

commit a7832ab08463e284130099a07ef1d22ed3a58072
parent e90496cbab6adf9bf236e5aa9fb6658e8950eb78
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Mon, 28 Oct 2013 23:35:09 +0100

Adding Wind direction support (Closes #9)

Diffstat:
Mansiweather | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ansiweather b/ansiweather @@ -105,6 +105,16 @@ sky=$(echo $weather | jq -r '.weather[0].main') sunrise=$(echo $weather | jq '.sys.sunrise') sunset=$(echo $weather | jq '.sys.sunset') wind=$(echo $weather | jq '.wind.speed') +azimuth=$(echo $weather | jq '.wind.deg') + + + +###[ Process Wind data ]####################################################### + +declare -a directions +directions=(N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW) + +direction=${directions[$(echo "($azimuth + 11.25)/22.5 % 16" | bc)]} @@ -172,4 +182,4 @@ fi ###[ Display current Weather ]################################################# -echo -e "$background$text Current weather in $city $delimiter$data $temperature $scale $icon$dashes$text Humidity $delimiter$data $humidity % $dashes$text Wind $delimiter$data $wind $speed_unit $dashes$text Pressure $delimiter$data $pressure $pressureUnit \033[0m" +echo -e "$background$text Current weather in $city $delimiter$data $temperature $scale $icon$dashes$text Wind $delimiter$data $wind $speed_unit $direction $dashes$text Humidity $delimiter$data $humidity % $dashes$text Pressure $delimiter$data $pressure $pressureUnit \033[0m"