For the past couple of years, I’ve used a “Stamp” in
Tinderbox to append weather
conditions to the current note’s text.
See Recording The Weather In Tinderbox
While preparing my Daybook for 2017 I decided I wanted to include just
the current condition and temperature rather than the entire weather
summary. The following script grabs the weather (using wu) and returns
either just the current conditions and temperature or, if a date is
passed, it returns summary information for that date.
# Jack Baty, 2016 (https://baty.net)
# Grab and parse weather info using 'wu' by Stephen Ramsay
# Pass the date as YYYYMMDD to get summary info for that date
# If no date is passed, just get current conditions
# Assumes $GOPATH is set
if [ $# -ge 1 ]
HITEMP=`echo "$WEATHER" | awk '/Max Temperature/' | cut -d':' -f2-`
LOWTEMP=`echo "$WEATHER" | awk '/Min Temperature/' | cut -d':' -f2-`
PRECIP=`echo "$WEATHER" | awk '/Precipitation/' | cut -d':' -f2-`
COND=`echo "$WEATHER" | awk '/Weather summary/' | cut -d':' -f2-`
if [ "$COND" != " " ]
echo "High:$HITEMP, Low:$LOWTEMP, Conditions:$COND$PRECIP"
echo "High:$HITEMP, Low:$LOWTEMP"
TEMP=`echo "$WEATHER" | awk '/Temperature/' | cut -d':' -f2-`
COND=`echo "$WEATHER" | awk '/Conditions/' | cut -d':' -f2-`
My Stamp calls this new script, adds the results to a custom attribute
named “Weather” and then adds Weather as a KeyAttribute to the current
note. This way the weather is only displayed on notes for which I
explicitly asked for it. The new Stamp looks like this:
Now, if I want to include the weather conditions with a note, I apply
the “Get Weather on \$StartDate” Stamp and it looks like this…
Note that this gets the weather on the date set in the \$StartDate
attribute for a note. It could easily use the \$Created attribute
instead but I always set \$StartDate explicitly so that’s what I use.
If I only want the current conditions, I use the “Get Weather
Conditions” Stamp instead. It’s basically the same thing, but without
including a date parameter. The results look like this…