#!/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 || $5x == x || $6x == x) then

        echo "This script creates a map of EPV, and RH in a lower layer, PV in an "
	echo "upper level layer and frontogenesis at a specified level for a map"
	echo " centered on North Dakota"
	echo " " 
	echo "Syntax:  look_epvpv YYMMDDHH FHR MDL TOP BOTTOM FLVL 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 "         TOP is the top of the layer to look at EPV "
	echo " "
	echo "         BOTTOM is the bottom of the layer to look at EPV "
	echo " "
        echo "         FLVL is the pressure level you want to examine frontogenesis"
	echo " "
	echo "         PVLVL is the layer you want to examine PV advection. " 
	echo "         Selections are mid (350 to 450 mb) or high (250 to 350 mb )"
	echo " "
	echo "   Example:  look_epvpv 96102912 F12 eta 850 800 950 high    "
	echo " "
	echo "   This create a map that examines EPV and mean RH in the 800 to 850 "
	echo "   mb layer, frontogenesis at 950 mb and high level (250 to 350 mb) PV." 
	exit

endif

# Set up the name of the ASCII model file.

set EPVLYR = ${4}:${5}
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 (${7} == "high" ) then  
 gdplot << EOF
 res $GEMNTS/look_epvpv
 GDFILE   = $GEMFIL
 GDATTIM  = $GEMDAT
 GLEVEL = ${4}:${5} ! 250:350 ! ${4}:${5} ! ${6}
 r
 
exit
EOF
endif

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

gdplot << EOF2
res $GEMNTS/look_epvpv
GDFILE = $GEMFIL
GDATTIM = $GEMDAT
GLEVEL = ${4}:${5} ! 350:450 ! ${4}:${5} ! ${6}
r

exit
EOF2
endif


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

exit
