EXAM Answer #4


#!/bin/csh -f

if(x${1} != x) then
   gpmap << SELECT1
      garea = $1
      e
SELECT1
else
  gpmap << SELECT2
     garea = usnps
     proj = str/90;-100;0 
     map = 6
     title = 5/-2/Select Map Area
     dev = xw|SELECT_AREA
     clear = y
     \$mapfil = hipowo.gsf
     r

     cursor garea
     e
SELECT2
  gpend
endif

# This is the directory of our lightning data
set NLDN=$GEMDATA/nldn

# set the current year, month day
set YMD=`date -u '+%Y%m%d'`

# set the current HOUR
set HOUR=`date -u '+%H'`

# get the day of week, month abbrev., day and 4 digit year for title
set TITLE = `date -u '+%A %B %d, %Y'`

#
# There may be more than 1 NLDN file for each hour...we store ours 
# at 30 minute intervals. Alternatively, if more that the maximum number
# of strikes that can be stored in a single file is exceeded, then
# an additional file is opened (see the dcnldn template @@).
# The file naming expected can be one of:
# YYYYMMDDHHNN_@@_nldn.gem
# YYYYMMDDHHNN_nldn.gem
# YYYYMMDDHH_@@_nldn.gem
# YYYYMMDDHH_nldn.gem
set FILES=`ls $NLDN/${YMD}${HOUR}*_nldn.gem`

set CLEAR = yes
if($#FILES > 0) then

   foreach FILE ($FILES)
      # Data may be binned hourly, or at other intervals. We assume 5 minute bins.
      # We could use dattim=all (but that will generate a loop using XW
      # instead, plot the data for each time in the file, setting clear=no
      # after the first time in the file.
      set TIMES=`sfctime $FILE`

      foreach TIME ($TIMES)
      sfmap << EOF
      map = 1
      dev = xw|"lightning strikes"
      area = dset
      filter = no
      clear = $CLEAR
      text = 1.2/23/1/hw
      title = 5/-2/Lightning Strikes  $TITLE ${HOUR}Z
      panel = .02;.02;.97;.97/1/1/4
      sffile = $FILE
      color = 0;30
      dattim = $TIME
      sfparm = sgnl<-400;mark:22:1:1
      r
  
      clear = no 
      sfparm = sgnl>400;mark:1:1:1
      r

      sfparm = sgnl > -401 < 401;mark:15:2:1
      r

      e
EOF
      set CLEAR = no
      end
   end
endif




exit(0)

      

previous page