- fix conversion on wind cardinal direction, fix (deg2card V1.2)
This commit is contained in:
fenix-soft 2018-09-13 11:41:43 +02:00 committed by GitHub
parent 0f3ad22dd5
commit 568b22b02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 39 deletions

View File

@ -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

39
fmeteo
View File

@ -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..

View File

@ -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

View File

@ -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

View File

@ -1 +1 @@
1.0
1.2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -1 +1 @@
1.3
1.4