Weather logging
So been experimenting with some of the options for ansiweather, partly as schools need to teach data logging as part of the national curriculum computing, however not all schools have the kit required.
As I have this running on a Raspberry Pi, I thought it may be possible to set one up to log just the location and temperature.
ansiweather -l paignton -p false -h false -w false -i false >temponly.txt
so the above will display the location and temperature, but exclude pressure, humidity, wind and UV index.
now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l Paignton -a false) >> weather_$now.csv
Control what is sent to stdout.
now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l torquay -p false -h false -w false -i false) >> torquay_$now.csv
Final script
now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l torquay -p false -h false -w false -i false) >> torquay_$now.csv
Tags
#Bash,#BashScripting,#Logging,#Data
AI statement :
Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Logging the weather
I have modified the script that runs every 10 minutes to record the output from the ansiweather utility, This still saves the output to a file but adds the current date to the file name.
now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l Paignton -a false) >> weather_$now.csv
So the output looks like
Humidity: 71% - Pressure: 1023 hPa
06/09/25, 14:20:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s WSW - Humidity: 69% - Pressure: 1024 hPa
06/09/25, 14:30:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 2.24 m/s SW - Humidity: 70% - Pressure: 1023 hPa
06/09/25, 14:40:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 3.13 m/s W - Humidity: 69% - Pressure: 1023 hPa
06/09/25, 14:50:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s SW - Humidity: 69% - Pressure: 1023 hPa
06/09/25, 15:00:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s WSW - Humidity: 71% - Pressure: 1023 hPa
06/09/25, 15:10:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.34 m/s SSW - Humidity: 71% - Pressure: 1024 hPa
As this runs on a headless pi4, I can login and copy the data files locally before uploading to my gopherspace (Look it up)
gopher://vern.cc/1/~zleap
Tags
#Bash,#BashScripting,#Data,#Logging,#Gopher,#RaspberryPi,
#Weather
AI statement :
Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.
