From a24690b8e27f4945bdbe8d7b2960bc506b20c24c Mon Sep 17 00:00:00 2001 From: fenix-soft Date: Wed, 12 Sep 2018 17:12:13 +0200 Subject: [PATCH] version 1.3 --- change_log.md | 4 ++++ fmeteo | 47 +++++++++++++++++++++++++++++++++++++++++++++-- version.txt | 2 +- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/change_log.md b/change_log.md index 8d11a5e..7a8edf0 100644 --- a/change_log.md +++ b/change_log.md @@ -1,3 +1,7 @@ +# V1.3 +- now fmeteo convert wind degreese on cardinal notation (N..E.. N-NE..ecc) called "wind dir" +- add deg2card tools script, look the readme on the tools folder for more info + # V1.2 - add curl silent mode (now the output video is more clear) - fix some code diff --git a/fmeteo b/fmeteo index 80e05a0..de3fc68 100644 --- a/fmeteo +++ b/fmeteo @@ -4,7 +4,7 @@ #################################################################################### # script meteo che usa oopenweathermap per i dati e li riporta a terminale # -# v:1.2 +# v:1.3 # # dipendenze: curl,jq,cat,bc # @@ -83,10 +83,53 @@ S=`cat meteonow.txt | jq -r '.list[0]|.snow'` Ws=`cat meteonow.txt | jq -r '.list[0]|.wind.speed'` Wsd=`cat meteonow.txt | jq -r '.list[0]|.wind.deg'` + # convert m/s to Km/s WsKM=$(echo "3.6"*$Ws | bc) +# convert degreese to cardinal name + +if (($(echo "$Wsd>= 0" | bc))); then W_nc="N"; fi + +if (($(echo "$Wsd>= 22.5" | bc))); then W_nc="N-NE"; fi + +if (($(echo "$Wsd>= 45" | bc))); then W_nc="NE"; fi; + +if (($(echo "$Wsd>= 67.5" | bc))); then W_nc="E-NE"; fi; + +if (($(echo "$Wsd>= 90" | bc))); then W_nc="E"; fi; + +if (($(echo "$Wsd>= 112.5" | bc))); then W_nc="E-SE"; fi; + +if (($(echo "$Wsd>= 135" | bc))); then W_nc="SE"; fi; + +if (($(echo "$Wsd>= 157.5" | bc))); then W_nc="S-SE"; fi; + +if (($(echo "$Wsd>= 180" | bc))); then W_nc="S"; fi; + +if (($(echo "$Wsd>= 202.5" | bc))); then W_nc="S-SW"; fi; + +if (($(echo "$Wsd>= 225" | bc))); then W_nc="SW"; fi; + +if (($(echo "$Wsd>= 247.5" | bc))); then W_nc="W-SW"; fi; + +if (($(echo "$Wsd>= 270" | bc))); then W_nc="W"; fi; + +if (($(echo "$Wsd>= 292.5" | bc))); then W_nc="W-NW"; fi; + +if (($(echo "$Wsd>= 315" | bc))); then W_nc="NW"; fi; + +if (($(echo "$Wsd>= 337.5" | bc))); then W_nc="N-NW"; fi; + +if (($(echo "$Wsd== 360" | bc))); then W_nc="N"; fi; + +if (($(echo "$Wsd> 360" | bc))); then W_nc="-?-"; fi; + +if (($(echo "$Wsd< 0" | bc))); then W_nc="-?-"; fi + + + # print to video all data.. echo " " echo " " $city_name","$L " " "Lat: "$Lat " " "Lon: "$Lon " " "id:" $city_id @@ -98,6 +141,6 @@ echo " " "Temp (C°): "$T " " "Tmax (C°): "$Tmax" " "Tmin (C°): "$Tmin " " " echo " " echo " " "Pressure (hPa): "$PrS " " "Clouds (%): "$ClD " " "Rain (mm): "$R " " "Snow (mm): "$S echo " " -echo " " "Wind speed (km/h): "$WsKM " " "Wind deg (°): "$Wsd +echo " " "Wind speed (km/h): "$WsKM " " "Wind deg (°): "$Wsd " " "Wind dir: "$W_nc echo " " echo " " diff --git a/version.txt b/version.txt index ea710ab..a58941b 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2 \ No newline at end of file +1.3 \ No newline at end of file