Quote:
sounds like u are onto something, will you publish?
Quote:
sounds like u are onto something, will you publish?
#!/bin/zsh -f
FILE=/tmp/ft.xml
function wxgrab
{
key="<$1>"
rep1="s/<$1>//g"
rep2="s/<\/$1>//g"
grep $key $FILE | sed $rep1 | sed $rep2
}
function wet_bulb
{
TEMPK=$(((TEMP-32)/1.8))
echo $((((-5.806+0.672*TEMPK-0.006*TEMPK*TEMPK+(0.061+0.004*TEMPK+0.000099*TEMPK*TEMPK)*RH+(-0.000033-0.000005*TEMPK-0.0000001*TEMPK*TEMPK)*RH*RH)*1.8)+32))
}
function snow_life
{
echo $((0.027*0.027*TEMP*TEMP))
}
XMLLINT_INDENT=
export XMLLINT_INDENT
curl -s http://nws.noaa.gov/data/current_obs/$1.xml > /tmp/temp.xml
xmllint --output $FILE --format /tmp/temp.xml
rm /tmp/temp.xml
LOC=$(wxgrab location)
RH=$(wxgrab relative_humidity)
TEMP=$(wxgrab temp_f)
TIME=$(wxgrab observation_time)
WTHR=$(wxgrab weather)
WINDDIR=$(wxgrab wind_dir)
WINDSPD=$(wxgrab wind_mph)
GUST=$(wxgrab wind_gust_mph)
CHILL=$(wxgrab windchill_f)
TWB=$(wet_bulb)
#SL=$(snow_life)
SL=$TEMP
SNOW="EXCELLENT"
if [ $((TWB)) -gt 20.9 ]; then
SNOW="GOOD"
fi
if [ $((TWB)) -gt 27.9 ]; then
SNOW="NO"
fi
LIFE="EXCELLENT"
if [ $((SL)) -gt 24.0 ]; then
LIFE="GOOD"
fi
if [ $((SL)) -gt 32.0 ]; then
LIFE="FAIR"
fi
if [ $((SL)) -gt 37.0 ]; then
LIFE="POOR"
fi
printf "\n"
printf "%s\n" $LOC
printf "%s\n" $TIME
printf "Observation: %s\n" $WTHR
printf "Temp: %s F (Wind Chill: %s F)\n" $TEMP $CHILL
printf "Relative Humidity: %s %%\n" $RH
printf "Wind: %s %s MPH, gusting to %s MPH\n" $WINDDIR $WINDSPD $GUST
printf "Wet Bulb Temp: %g F\n" $TWB
printf "Snow Making: %s \n" $SNOW
printf "Snow Life: %s \n" $LIFE
printf "\n"
Quote:
Craig,
I like your choice of platform. (Note that DCSki runs on Mac OS X on an XServe.)
- Scott
Join the conversation by logging in.
Don't have an account? Create one here.