:
# script to generate plots from latest mrf from the Alternative server
#   00 and 12Z 2 m temperature (F)
#
# this script is an example how to use wwwgrab and the web plotter
#
# requires GNU date command, wwwgrab and xv (optional)
#
set -x
set -e

tmpfile=/tmp/junk.mrfA.$$

# get initial time from web page

wwwgrab "http://wesley.wwb.noaa.gov/cgi-bin/pdisp_mrf.sh?ctlfile=mrf.ctl&display=140.90.196.45" $tmpfile

t="`grep \"Data available\" $tmpfile`"

hour=`echo $t | awk '{print $4}'`
day=`echo $t | awk '{print $5}'`
month=`echo $t | awk '{print $6}'`
year=`echo $t | awk '{print $7}'`
date=$hour$day$month$year
echo "date=$date"
for hr in 000 012 024 036 048 060 072 084 096 108 120
do
  hour=`date --utc +%H --date "$date $hr hours"`Z
  day=`date --utc +%d --date "$date $hr hours"`
  month=`date --utc +%b --date "$date $hr hours"`
  year=`date --utc +%Y --date "$date $hr hours"`
  png=/tmp/mrf_thick.$hr.png

wwwgrab "http://wesley.wwb.noaa.gov/cgi-bin/pdisp_mrf.sh?ctlfile=mrf.ctl&ptype=map&var=msl%26thick&level=1000&nlevels=16&op1=none&op2=none&hour=$hour&day=$day&month=$month&year=$year&proj=n_amer&lon0=280&dlon=50&lat0=-60&dlat=60&type=shaded&cint=default&plotsize=800x600&title=" $tmpfile

   pngname=`egrep "meta.*png" $tmpfile |sed -e 's/^.*src="//' -e 's/png.*$/png/'`

   if [ "$pngname" = "" -o "`grep -c "ERROR" $tmpfile`" -gt 0 ] ; then
      echo "forecast not available .. don't know why"
      echo "look at $tmpfile"
      exit 8
   fi

   wwwgrab "http://wesley.wwb.noaa.gov$pngname" $png
   rm $tmpfile

done
exit
