#!/bin/csh -f
#
# This command file will create a surface map for the specified forecast hour and model 
# on X windows.
#
# Philip Schumacher	12/96
#
# Check if a data has been input.  If not print instructions.
if ($1x == x || $2x == x || $3x == x || $4x == x) then
        echo "This script creates a map of potential vorticity, PV advection"
	echo "and frontogenesis centered on North Dakota."
	echo "look_pvft"
	echo " " 
	echo "Syntax:  look_pvft YYMMDDHH FHR MDL LVL PVLVL                        "
	echo " "
	echo "  where:                                               "
	echo "         YYMMDDHH is the year, month, day and hour of the model "
	echo "         to be examined       "
	echo " "
	echo "         FHR is the forecast hour of the map to be created " 
        echo " "
        echo "         MDL is the model to look at (in small letters)"
	echo "         ngm, ruc, avn, eta "
        echo " "
        echo "         LVL is the pressure level you want to look at"
        echo " " 
        echo "         PVLVL is the level to calculate PV. Selections are "
        echo "         mid or high "
        echo " "
	echo "   Example:  look_pvft 96102912 F12 eta 850 high                 "
	echo " "
	echo "   This create an 850 mb map from the 29th of the month at 12Z"
	exit

endif

# Set up the name of the ASCII model file.

set GEMDAT = ${2}
set GEMFIL = $METDAT/gempak/grids/${1}_${3}.gem 
#set GEMFIL = /usr2/phil/oct29/gempak/surface/${1}_sao.gem
echo ${GEMFIL}

# Now run sfmap to create quadrant 1

if (${5} == "mid" ) then

gdplot << EOF
res $GEMNTS/midpvfrnt
gdfile = $GEMFIL
gdattim = $GEMDAT
GLEVEL = 350:450 ! 350:450 ! ${4}
r
    
exit
EOF

endif

if (${5} == "high" ) then
gdplot << EOF1
res $GEMNTS/hipvfrnt
gdfile = $GEMFIL
gdattim = $GEMDAT
GLEVEL = 250:350 ! 250:350 ! ${4}
r
    exit
EOF1

endif
  

echo '********************************'
echo '*** TYPE gpend WHEN FINISHED ***'
echo '********************************'

exit
