mirror of
https://github.com/fenix-soft/fmeteo.git
synced 2025-01-03 09:39:14 +01:00
Add files via upload
small fix
This commit is contained in:
parent
8c01ae6cee
commit
7a407c2cff
10
README.md
10
README.md
@ -26,10 +26,11 @@ cat
|
||||
|
||||
#### Some examples:
|
||||
|
||||
for example we want to recover the weather data of a city called "**Tempio Pausania**" that openwatermap has indexed as written with the space.
|
||||
for example we want to recover the weather data of a city called "**Tempio Pausania**" (IT) or "**New York**" that openwatermap has indexed written with the space.
|
||||
|
||||
fmeteo "Tempio%20Pausania"
|
||||
fmeteo "Tempio%20Pausania,IT"
|
||||
|
||||
fmeteo "New%20York,USA"
|
||||
|
||||
***
|
||||
|
||||
@ -62,8 +63,9 @@ cat
|
||||
|
||||
#### Alcuni esempi:
|
||||
|
||||
ad esempio vogliamo recuperare il tempo di una citta chiamata "**Tempio Pausania**" che openwatermap ha indicizzato così come scritta con lo spazio.
|
||||
ad esempio vogliamo recuperare il tempo di una citta chiamata "**Tempio Pausania**"(IT), oppure "**New York**" che openwatermap ha indicizzato scritta con lo spazio.
|
||||
|
||||
fmeteo "Tempio%20Pausania"
|
||||
fmeteo "Tempio%20Pausania,IT"
|
||||
|
||||
fmeteo "New%20York,USA"
|
||||
|
||||
|
61
fmeteo
61
fmeteo
@ -2,9 +2,9 @@
|
||||
#
|
||||
#
|
||||
####################################################################################
|
||||
# script meteo che usa oopenweather map per i dati e li riporta a terminale #
|
||||
# script meteo che usa oopenweathermap per i dati e li riporta a terminale
|
||||
#
|
||||
# v:1.0 alpha
|
||||
# v:1.1
|
||||
#
|
||||
# dipendenze: curl,jq,cat,bc
|
||||
#
|
||||
@ -12,16 +12,22 @@
|
||||
####################################################################################
|
||||
|
||||
|
||||
|
||||
# set api-key
|
||||
|
||||
key_meteo="1487dd8a93bfd85d278d9ac8dcfee94c"
|
||||
|
||||
|
||||
|
||||
# set global variable
|
||||
|
||||
surc_city=$1
|
||||
api1="http://api.openweathermap.org/data/2.5/find?q="
|
||||
api_par="&units=metric&appid="
|
||||
api_lang="&lang=en"
|
||||
|
||||
api2="http://api.openweathermap.org/data/2.5/forecast/daily?id="
|
||||
api3="http://api.openweathermap.org/data/2.5/forecast?id="
|
||||
key_meteo="1487dd8a93bfd85d278d9ac8dcfee94c"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -33,7 +39,7 @@ echo " "
|
||||
echo "get data... "
|
||||
curl $api1$surc_city$api_par$key_meteo$api_lang > meteonow.txt
|
||||
echo " "
|
||||
city_id=`cat meteonow.txt | jq '.list[]|.id'`
|
||||
city_id=`cat meteonow.txt | jq '.list[0]|.id'`
|
||||
|
||||
|
||||
|
||||
@ -58,24 +64,24 @@ echo -e '\0033\0143'
|
||||
|
||||
# exstract data to jason file
|
||||
|
||||
city_name=`cat meteonow.txt | jq -r '.list[]|.name'`
|
||||
L=`cat meteonow.txt | jq -r '.list[]|.sys[]'`
|
||||
Lat=`cat meteonow.txt | jq -r '.list[]|.coord.lat'`
|
||||
Lon=`cat meteonow.txt | jq -r '.list[]|.coord.lon'`
|
||||
data_X=`cat meteonow.txt | jq -r '.list[]|.dt'`
|
||||
city_name=`cat meteonow.txt | jq -r '.list[0]|.name'`
|
||||
L=`cat meteonow.txt | jq -r '.list[0]|.sys[]'`
|
||||
Lat=`cat meteonow.txt | jq -r '.list[0]|.coord.lat'`
|
||||
Lon=`cat meteonow.txt | jq -r '.list[0]|.coord.lon'`
|
||||
data_X=`cat meteonow.txt | jq -r '.list[0]|.dt'`
|
||||
data_U=`date -d @$data_X`
|
||||
Wcond_n=`cat meteonow.txt | jq -r '.list[]|.weather[].main'`
|
||||
Wcond_nd=`cat meteonow.txt | jq -r '.list[]|.weather[].description'`
|
||||
T=`cat meteonow.txt | jq -r '.list[]|.main.temp'`
|
||||
Tmax=`cat meteonow.txt | jq -r '.list[]|.main.temp_max'`
|
||||
Tmin=`cat meteonow.txt | jq -r '.list[]|.main.temp_min'`
|
||||
Hm=`cat meteonow.txt | jq -r '.list[]|.main.humidity'`
|
||||
PrS=`cat meteonow.txt | jq -r '.list[]|.main.pressure'`
|
||||
ClD=`cat meteonow.txt | jq -r '.list[]|.clouds[]'`
|
||||
R=`cat meteonow.txt | jq -r '.list[]|.rain'`
|
||||
S=`cat meteonow.txt | jq -r '.list[]|.snow'`
|
||||
Ws=`cat meteonow.txt | jq -r '.list[]|.wind.speed'`
|
||||
Wsd=`cat meteonow.txt | jq -r '.list[]|.wind.deg'`
|
||||
Wcond_n=`cat meteonow.txt | jq -r '.list[0]|.weather[].main'`
|
||||
Wcond_nd=`cat meteonow.txt | jq -r '.list[0]|.weather[].description'`
|
||||
T=`cat meteonow.txt | jq -r '.list[0]|.main.temp'`
|
||||
Tmax=`cat meteonow.txt | jq -r '.list[0]|.main.temp_max'`
|
||||
Tmin=`cat meteonow.txt | jq -r '.list[0]|.main.temp_min'`
|
||||
Hm=`cat meteonow.txt | jq -r '.list[0]|.main.humidity'`
|
||||
PrS=`cat meteonow.txt | jq -r '.list[0]|.main.pressure'`
|
||||
ClD=`cat meteonow.txt | jq -r '.list[0]|.clouds[]'`
|
||||
R=`cat meteonow.txt | jq -r '.list[0]|.rain'`
|
||||
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)
|
||||
@ -83,14 +89,15 @@ WsKM=$(echo "3.6"*$Ws | bc)
|
||||
|
||||
# print to video all data..
|
||||
echo " "
|
||||
echo " " $city_name","$L " " "Lat: "$Lat "Lon: "$Lon " " "id:" $city_id
|
||||
echo " " $city_name","$L " " "Lat: "$Lat " " "Lon: "$Lon " " "id:" $city_id
|
||||
echo " " $data_U
|
||||
echo " "
|
||||
echo " " "Weather: "$Wcond_n"," $Wcond_nd
|
||||
echo " "
|
||||
echo " " "Temp C°: "$T " " "Tmax C°: "$Tmax" " "Tmin C°: "$Tmin " " "Humidity %: "$Hm
|
||||
echo " " "Temp (C°): "$T " " "Tmax (C°): "$Tmax" " "Tmin (C°): "$Tmin " " "Humidity (%): "$Hm
|
||||
echo " "
|
||||
echo " " "Pressure (hPa): "$PrS " " "Clouds (%): "$ClD " " "Rain (mm): "$R " " "Snow (mm): "$S
|
||||
echo " "
|
||||
echo " " "Wind speed (km/h): "$WsKM " " "Wind deg (°): "$Wsd
|
||||
echo " "
|
||||
echo " " "Pressure hPa: "$PrS " " "Clouds %: "$ClD " " "Rain mm: "$R " " "Snow mm: "$S
|
||||
echo " "
|
||||
echo " " "Wind speed Km/h: "$WsKM
|
||||
echo " "
|
Loading…
Reference in New Issue
Block a user