#!/bin/csh
#
# EZQVEC
#
# This script displays the layer averaged Q-vectors with the layer thickness
# and layer averaged isotachs.
#
# The user must supply the script with the bottom and top pressure levels of
# the layer.  Note that the order is important.
#
#	Syntax:  ezqvec lower_level upper_level
#
#	Example: ezqvec 500 300
#
##
# Log:
# B. Colman/SEA		 1994
# R. Miller/COMET	 1994
# S. Jacobs/NMC		10/94	Clean up
#

if ( ${2}x == x ) then
   echo " GEMPAK shell script to plot Q vectors average isotachs and"
   echo " thickness over a layer."
   echo " The user must supply the top and bottom levels,"
   echo " either on the command line or by prompting."

   echo " "
   echo " Enter the bottom pressure level (e.g. 500)."
   set lvlb=$<

   echo " "
   echo " Enter the top pressure level (e.g. 300)."
   set lvlt=$<

else
   set lvlb = $1
   set lvlt = $2
endif

if ( $lvlt > $lvlb ) then
   echo " "
   echo " ERROR.  Top pressure level is lower than bottom level."
   echo " "
   exit
endif

# Source the file called settings.  This file contains commands to set
# environment variables for the model name and device driver.

source settings

gdcntr << EOF
GDATTIM = all
GLEVEL  = ${lvlt}:${lvlb}
GVCORD  = pres
GFUNC   = ldf[hght]
CINT    = 20
LINE    = 5/1/1
TITLE   = 1=white/-3/~  $model  @ Thickness (solid)
DEVICE  = $dev
CLEAR   = yes
PANEL   = 0
SCALE   = 0
CONTUR  = 1
SKIP    = 1
FINT    = 
FLINE   = 
CTYPE   = c
HILO    = 5/W;K
r

GFUNC   = knts[mag[vlav[wnd]]]
CINT    = 10
LINE    = 2/3/2
CLEAR   = no
TITLE   = 1=white/-2/Mean Isotachs (dashed)
HILO    = 2/J;
r

ex
EXIT

EOF

gdwind << EOD
CLEAR   = no
GVECT   = smul[4e9;qvcl[hght,geo]]
SKIP    = /1
WIND    = an27/.8/1//.5
TITLE   = 1=white/-1/@  Q Vectors
r

;2
;l
ex
EOD
