[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20000405: radar gif images



>From: Anthony Rockwood - MSCD Meteorology <address@hidden>
>Organization: .
>Keywords: 200004051446.IAA18752

>Hi,
>
>I'd like to learn how to put certain radar images on our web site for
>local viewing only.  I know lots of other sites do it, and I was wondering
>if you could point me to the script that does this.
>
>Thanks,
>
>Tony
>
> ****************************************************************************
>   Anthony A. Rockwood              Metropolitan State College of Denver    
>   Meteorology Program              Dept.of Earth and Atmospheric Sciences 
>   303.556.8399                     P.O. Box 173362, Campus Box 22
>   address@hidden                Denver, CO  80217-3362                  
>   http://www.mscd.edu/~eas         http://clem.mscd.edu/~rockwooa
> ****************************************************************************
>
>


Tony,

I use the following action here in pqact.conf to generate the FTG BREF1
and VEL1 gifs as the images arrive:

#
# make some nids gifs
WSI     
^NEX/(FTG)/(BREF1|VEL1)/..([0-9][0-9])([0-1][0-9])([0-3][0-9])([0-2][0-9])([0-6][0-9])
        FILE    -close   data/gempak/tmp/nids/\2_\1_\3\4\5\6\7.nex
WSI     
^NEX/(FTG)/(BREF1|VEL1)/..([0-9][0-9])([0-1][0-9])([0-3][0-9])([0-2][0-9])([0-6][0-9])
        EXEC    util/NIDS_gif.csh \2_\1_\3\4\5\6\7.nex \1_\2_\3\4\5\6\7.gif

The first action writes a copy of the BREF1 or VEL1 for FTG (these can be 
be modified for more products and/or sites).

The second line kicks off a script which I use to run gpmap.

The script looks like:

#!/bin/csh -f

setenv DISPLAY laraine:1   
setenv PATH /bin:/usr/bin:/usr/local/bin:/usr/sbin:/usr/ucb:.:/usr/local/ldm/bin
setenv LD_LIBRARY_PATH /usr/openwin/lib:/usr/dt/lib:/opt/SUNWspro/lib

source /home/gempak/Gemenviron


setenv NEX /usr/local/ldm/data/gempak/tmp/nids

set FILENAME=$1
set GIFFILE=$2

cd /usr/local/ldm/data/gempak/web

set LOCK=.inuse.$$
touch $LOCK
sleep 5

@ COUNT = 0
set TEST=`ls .inuse.* | head -1`
while(($TEST != $LOCK)&&($COUNT < 61))
   sleep 10
   set TEST=`ls .inuse.* | head -1`
   if($COUNT == 60) then
      echo "Please check `hostname` on $TEST for nids generation $FILENAME 
$GIFFILE" | \
         /usr/bin/mailx -s NIDS chiz
      rm $LOCK
      rm $NEX/${FILENAME}
      exit 0
   endif
   @ COUNT = $COUNT + 1
end

if(-e $GIFFILE) then
   rm -f $GIFFILE
endif

set YMD=`echo $FILENAME | cut -f3 -d_ | cut -c1-6`
set HHMM=`echo $FILENAME | cut -f3 -d_ | cut -c7-10`
set TYPE=`echo $FILENAME | cut -f1 -d_`
set SITE=`echo $FILENAME | cut -f2 -d_`
set TITLE="NIDS $SITE $TYPE  ${YMD}/${HHMM}"

if($TYPE == 'BREF1') then
   set TITLE="NIDS $SITE Base Reflectivity  ${YMD}/${HHMM}"
endif
if($TYPE == 'VEL1') then
   set TITLE="NIDS $SITE Radial Velocity  ${YMD}/${HHMM}"
endif
if($TYPE == 'SRMV1') then
   set TITLE="NIDS $SITE Storm Relative Velocity  ${YMD}/${HHMM}"
endif

gpmap_gf << EOF
 \$mapfil = hicnus.uni+hipowo.cia+rdus.uni+rdis.uni
 MAP      = 8/1/1+1/1/2+15/1/1+2/1/2
 GAREA    = dset
 PROJ     = rad
 SATFIL   = 
 RADFIL   = \$NEX/${FILENAME}
 LATLON   = 0
 PANEL    = 0
 TITLE    = 5/-1/$TITLE
 TEXT     = 1/22/1/hw
 CLEAR    = y
 DEVICE   = gf|${GIFFILE}
 LUTFIL   = osf_ref16.tbl
 STNPLT   = 5|0|disco_sites.tbl
 r

 e
EOF

rm -f $NEX/${FILENAME}
rm -f $LOCK

#pqinsert $GIFFILE

set LAST=`echo $GIFFILE | cut -f1,2 -d_`
if(-e $LAST.gif) then
   rm -f $LAST.gif
endif
mv $GIFFILE $LAST.gif

exit 0
# -------------- end script -------------------------------



An example image of this output is at:
http://www.unidata.ucar.edu/staff/chiz/gifs/NIDS_example.gif

The script does a little locking so that only one copy of gpmap is
run at a time....which is useful when you first start up the LDM and
you might get several products all at once. The LDM will EXEC the script,
and if another copy of the script is running, it will wait its turn.
I first wrote this script for sending images to the discovery channel,
so the commented out pqinsert line is an example of of inserting
the gif image back in the ldm queue as an EXP product.

I use a copy of gpmap called "gpmap_gf" for this script, which
links the gif driver directly to the gpmap code so that you don't
have to have a gpmap, gplt and gf process all run. I can provide
you a copy of gpmap_gf if you want....or you can just use gpmap
(and add the gpend command following the EOF line).

the disco_sites.tbl file should be in your $GEMTBL/stns file.
I creates this as a more "english" version of stations to plot
on the map, rather than the surface metar id's.

Let me know if you would like me to help you set this up.

Steve Chiswell