# FLTWFDISC - wfdisc Dbe Table Name
# SITE - site Dbe Table Name
# ORIGIN - origin Dbe Table Name
# LAT    - Event Latitude
# LON    - Event Longitude
# RANGE  - The map plot range in degrees from the origin
#                    to  the  edges  of the map.
# OUTNAMEPS - Name of postscript out file without extension name '.ps'
# After Quit dbmapevents all working file will be deleted

set FLTWFDISC=$1
set SITE=$2
set ORIGIN=$3
set LAT=$4
set LON=$5
set RANGE=$6
set OUTNAMEPS=$7
echo Filtering wfdisc    = $FLTWFDISC
echo Site Table          = $SITE
echo Origin Table        = $ORIGIN
echo Event Latitude      = $LAT
echo Event Longitude     = $LON
echo The map plot range  = $RANGE
echo Name of postscript out file = ${OUTNAMEPS}.ps
cp $FLTWFDISC @FmtTemporarywork.wfdisc
cp $SITE     @FmtTemporarywork.site
cp $ORIGIN   @FmtTemporarymap.origin
dbjoin -n zzz @FmtTemporarywork.wfdisc site
dbunjoin -o @FmtTemporarymap @FmtTemporarywork.zzz
Fmtmapview  @FmtTemporarymap ${LAT}:${LON} $RANGE -c
mv dbmapevents.ps ${OUTNAMEPS}.ps
\rm  @FmtTemporary*
