From 568b22b02c87807b6bb6c71108d37aa2cc593427 Mon Sep 17 00:00:00 2001 From: fenix-soft Date: Thu, 13 Sep 2018 11:41:43 +0200 Subject: [PATCH] v1.4 - fix conversion on wind cardinal direction, fix (deg2card V1.2) --- change_log.md | 3 +++ fmeteo | 39 +++++++++++++++++++---------------- tools/deg2card | 40 +++++++++++++++++++----------------- tools/deg2card_changelog.md | 3 +++ tools/deg2card_version.md | 2 +- tools/wind_dir_vs_deg.png | Bin 9983 -> 9983 bytes version.txt | 2 +- 7 files changed, 50 insertions(+), 39 deletions(-) diff --git a/change_log.md b/change_log.md index e888c15..851957d 100644 --- a/change_log.md +++ b/change_log.md @@ -1,3 +1,6 @@ +# V1.4 +- fix conversion on wind cardinal direction, fix (deg2card V1.2) + # V1.3 bug note - part of the code of fmeteo derives from deg2card which is currently buggy, consequently conversions on wind cardinal direction are sometimes incorrect or inaccurate. For further clarification look at the changelog of the programs diff --git a/fmeteo b/fmeteo index de3fc68..5687fdc 100644 --- a/fmeteo +++ b/fmeteo @@ -4,7 +4,7 @@ #################################################################################### # script meteo che usa oopenweathermap per i dati e li riporta a terminale # -# v:1.3 +# v:1.4 # # dipendenze: curl,jq,cat,bc # @@ -90,44 +90,47 @@ WsKM=$(echo "3.6"*$Ws | bc) # convert degreese to cardinal name -if (($(echo "$Wsd>= 0" | bc))); then W_nc="N"; fi +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>= 11.25" | bc))); then W_nc="N-NE"; fi; -if (($(echo "$Wsd>= 45" | bc))); then W_nc="NE"; fi; +if (($(echo "$Wsd>= 33.25" | bc))); then W_nc="NE"; fi; -if (($(echo "$Wsd>= 67.5" | bc))); then W_nc="E-NE"; fi; +if (($(echo "$Wsd>= 56.25" | bc))); then W_nc="E-NE"; fi; -if (($(echo "$Wsd>= 90" | bc))); then W_nc="E"; fi; +if (($(echo "$Wsd>= 78.75" | bc))); then W_nc="E"; fi; -if (($(echo "$Wsd>= 112.5" | bc))); then W_nc="E-SE"; fi; +if (($(echo "$Wsd>= 101.25" | bc))); then W_nc="E-SE"; fi; -if (($(echo "$Wsd>= 135" | bc))); then W_nc="SE"; fi; +if (($(echo "$Wsd>= 123.75" | bc))); then W_nc="SE"; fi; -if (($(echo "$Wsd>= 157.5" | bc))); then W_nc="S-SE"; fi; +if (($(echo "$Wsd>= 146.25" | bc))); then W_nc="S-SE"; fi; -if (($(echo "$Wsd>= 180" | bc))); then W_nc="S"; fi; +if (($(echo "$Wsd>= 168.75" | bc))); then W_nc="S"; fi; -if (($(echo "$Wsd>= 202.5" | bc))); then W_nc="S-SW"; fi; +if (($(echo "$Wsd>= 191.25" | bc))); then W_nc="S-SW"; fi; -if (($(echo "$Wsd>= 225" | bc))); then W_nc="SW"; fi; +if (($(echo "$Wsd>= 213.75" | bc))); then W_nc="SW"; fi; -if (($(echo "$Wsd>= 247.5" | bc))); then W_nc="W-SW"; fi; +if (($(echo "$Wsd>= 236.25" | bc))); then W_nc="W-SW"; fi; -if (($(echo "$Wsd>= 270" | bc))); then W_nc="W"; fi; +if (($(echo "$Wsd>= 258.75" | bc))); then W_nc="W"; fi; -if (($(echo "$Wsd>= 292.5" | bc))); then W_nc="W-NW"; fi; +if (($(echo "$Wsd>= 281.25" | bc))); then W_nc="W-NW"; fi; -if (($(echo "$Wsd>= 315" | bc))); then W_nc="NW"; fi; +if (($(echo "$Wsd>= 303.75" | bc))); then W_nc="NW"; fi; -if (($(echo "$Wsd>= 337.5" | bc))); then W_nc="N-NW"; fi; +if (($(echo "$Wsd>= 326.25" | bc))); then W_nc="N-NW"; fi; -if (($(echo "$Wsd== 360" | bc))); then W_nc="N"; fi; +if (($(echo "$Wsd>= 348.75" | bc))); then W_nc="N"; fi; if (($(echo "$Wsd> 360" | bc))); then W_nc="-?-"; fi; if (($(echo "$Wsd< 0" | bc))); then W_nc="-?-"; fi +if [ "$Wsd" = "null" ]; then W_nc="-?-"; fi; + + # print to video all data.. diff --git a/tools/deg2card b/tools/deg2card index 15ad4f5..b32d3fc 100644 --- a/tools/deg2card +++ b/tools/deg2card @@ -1,6 +1,6 @@ #!/bin/bash # simple script to convert degrees to cardinal direction wind -# V1.0 +# V1.2 # @@ -8,42 +8,44 @@ n=$1 -if (($(echo "$n>= 0" | bc))); then W_nc="N"; fi +if (($(echo "$n>= 0" | bc))); then W_nc="N"; fi; -if (($(echo "$n>= 22.5" | bc))); then W_nc="N-NE"; fi +if (($(echo "$n>= 11.25" | bc))); then W_nc="N-NE"; fi; -if (($(echo "$n>= 45" | bc))); then W_nc="NE"; fi; +if (($(echo "$n>= 33.75" | bc))); then W_nc="NE"; fi; -if (($(echo "$n>= 67.5" | bc))); then W_nc="E-NE"; fi; +if (($(echo "$n>= 56.25" | bc))); then W_nc="E-NE"; fi; -if (($(echo "$n>= 90" | bc))); then W_nc="E"; fi; +if (($(echo "$n>= 78.75" | bc))); then W_nc="E"; fi; -if (($(echo "$n>= 112.5" | bc))); then W_nc="E-SE"; fi; +if (($(echo "$n>= 101.25" | bc))); then W_nc="E-SE"; fi; -if (($(echo "$n>= 135" | bc))); then W_nc="SE"; fi; +if (($(echo "$n>= 123.75" | bc))); then W_nc="SE"; fi; -if (($(echo "$n>= 157.5" | bc))); then W_nc="S-SE"; fi; +if (($(echo "$n>= 146.25" | bc))); then W_nc="S-SE"; fi; -if (($(echo "$n>= 180" | bc))); then W_nc="S"; fi; +if (($(echo "$n>= 168.75" | bc))); then W_nc="S"; fi; -if (($(echo "$n>= 202.5" | bc))); then W_nc="S-SW"; fi; +if (($(echo "$n>= 191.25" | bc))); then W_nc="S-SW"; fi; -if (($(echo "$n>= 225" | bc))); then W_nc="SW"; fi; +if (($(echo "$n>= 213.75" | bc))); then W_nc="SW"; fi; -if (($(echo "$n>= 247.5" | bc))); then W_nc="W-SW"; fi; +if (($(echo "$n>= 236.25" | bc))); then W_nc="W-SW"; fi; -if (($(echo "$n>= 270" | bc))); then W_nc="W"; fi; +if (($(echo "$n>= 258.75" | bc))); then W_nc="W"; fi; -if (($(echo "$n>= 292.5" | bc))); then W_nc="W-NW"; fi; +if (($(echo "$n>= 281.25" | bc))); then W_nc="W-NW"; fi; -if (($(echo "$n>= 315" | bc))); then W_nc="NW"; fi; +if (($(echo "$n>= 303.75" | bc))); then W_nc="NW"; fi; -if (($(echo "$n>= 337.5" | bc))); then W_nc="N-NW"; fi; +if (($(echo "$n>= 326.25" | bc))); then W_nc="N-NW"; fi; -if (($(echo "$n== 360" | bc))); then W_nc="N"; fi; +if (($(echo "$n>= 348.75" | bc))); then W_nc="N"; fi; if (($(echo "$n> 360" | bc))); then W_nc="-?-"; fi; -if (($(echo "$n< 0" | bc))); then W_nc="-?-"; fi +if (($(echo "$n< 0" | bc))); then W_nc="-?-"; fi; + +if [ "$n" = "null" ]; then W_nc="-?-"; fi; echo $W_nc \ No newline at end of file diff --git a/tools/deg2card_changelog.md b/tools/deg2card_changelog.md index 5963b61..6f4f9fc 100644 --- a/tools/deg2card_changelog.md +++ b/tools/deg2card_changelog.md @@ -1,3 +1,6 @@ +# V1.2 + +- fix the wind direction range bug, now the conversion rispect the data table on this picture: "wind_dir_vs_deg.png" # V1.0 bug note diff --git a/tools/deg2card_version.md b/tools/deg2card_version.md index 9f8e9b6..ea710ab 100644 --- a/tools/deg2card_version.md +++ b/tools/deg2card_version.md @@ -1 +1 @@ -1.0 \ No newline at end of file +1.2 \ No newline at end of file diff --git a/tools/wind_dir_vs_deg.png b/tools/wind_dir_vs_deg.png index 70a005e2c20e4ed9d62ce2626a72481b8ff5309e..2a0b6fdbc618f55897a5a5dd89c030aa356aec80 100644 GIT binary patch delta 18 acmezG``>rMZgx>w6Oq*>mo^@rMZgvq}!(Fa(W^O!Ws|Em7oCs$C diff --git a/version.txt b/version.txt index a58941b..840ca8c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.3 \ No newline at end of file +1.4 \ No newline at end of file