Photo of Andy Arthur

Andy Arthur

Ultimately maybe I could have headed out of town this weekend, πŸ•οΈ but that's behind me and I found ways to be busy and have fun riding down to Henry Hudson and Hollyhock Preserve this weekend. And doing lots of reading. I'm hoping for better weather next weekend, but maybe it's time to get out of town regardless.

Hawks Rock

Hawk Rock via Appalachian Trail is a 1.9 mile heavily trafficked out and back trail located near Duncannon, Pennsylvania that features beautiful wild flowers and is rated as moderate.

In Hope of Nice Weekend Weather

Maybe I’m just desperate for a nice weather weekend, or I wanted to practice my skills for work, but I created this quick little bash script that runs on the 29 and 59 minutes of each hour, so I get the latest NOAA forecast for the weekend, hot off the presses displayed on my screen for the weekend.

#!/bin/bash

wget "https://forecast.weather.gov/MapClick.php?lat=42.4686&lon=-73.9294&unit=0&lg=english&FcstType=dwml" -O /var/tmp/forecast.xml

WEEKENDS=( Friday Saturday Sunday  )

for WEEKEND in "${WEEKENDS[@]}"
do
	DAY=$(xmllint /var/tmp/forecast.xml --xpath '/dwml/data/time-layout[2]/start-valid-time' | awk /$WEEKEND\"/'{print NR}')
	DAY12=$(xmllint /var/tmp/forecast.xml --xpath '/dwml/data/time-layout[1]/start-valid-time' | awk /$WEEKEND\"/'{print NR}')
	DAY12NIGHT=$((DAY12+1))
	HIGH=$(xmllint /var/tmp/forecast.xml --xpath "/dwml/data/parameters/temperature[@type=\"maximum\"]/value[$DAY]/text()" 2>/dev/null)
	LOW=$(xmllint /var/tmp/forecast.xml --xpath "/dwml/data/parameters/temperature[@type=\"minimum\"]/value[$DAY]/text()" 2> /dev/null)
	DAYSUMMARY=$(xmllint /var/tmp/forecast.xml --xpath "string(/dwml/data/parameters/weather/weather-conditions[$DAY12]/@weather-summary)" 2> /dev/null)
	NIGHTSUMMARY=$(xmllint /var/tmp/forecast.xml --xpath "string(/dwml/data/parameters/weather/weather-conditions[$DAY12NIGHT]/@weather-summary)" 2> /dev/null)
 
	[[ $WEEKEND == Saturday ]] && xmllint /var/tmp/forecast.xml --xpath "/dwml/data/parameters/conditions-icon/icon-link[$DAY12]/text()" 2> /dev/null | wget -i - -O /var/tmp/wxicon.png	


	[[  -z $HIGH ]] || OUTPUT+="\n $WEEKEND: "
	[[  -z $HIGH ]] || OUTPUT+="$DAYSUMMARY $HIGH "
	[[  -z $LOW ]]  || OUTPUT+="/ $NIGHTSUMMARY $LOW"

done
notify-send "Weekend Weather Update" "$OUTPUT" -t 15000 -i /var/tmp/wxicon.png