#!/bin/csh
#
# EZPROF
#
# This script will plot a Skew-T diagram for a given location.
#
# The location for the Skew-T may be chosen by (1) entering the station ID
# for a station; or (2) graphically selecting the location using the mouse
# on a map/field window that has already been generated using a different
# EZ script.
#
# The user must enter the location, as above.
#
#	Syntax:   ezprof [station_id]
#
#	Examples: ezprof ( The script will prompt for station ID
#			   or graphical selection. )
#		  ezprof GLD
#
##
# Log:
# B. Colman/SEA		 1994
# R. Miller/COMET	 1994
# S. Jacobs/NMC		10/94	Clean up; Changed bg line colors; Changed margins
#

if ( ${1}x == x ) then
   echo " GEMPAK shell script to plot a Skew-T Log-P diagram from model "
   echo " grids.  The user has two options on selecting the location of "
   echo " the Skew-T.  The user can enter the station ID when"
   echo " prompted.  Or first display a map/fields using another script "
   echo " then run this script and select a point on the map using the"
   echo " mouse cursor. "

   echo " "
   echo " Do you want to specify the location by 1) station or "
   echo " 2) graphically or 3) use previous selection? "
   set ans=$<

   if $ans == 1 then
      echo " "
      echo " Enter the station: \c"
      set stn=$<
   else
      set stn=""
   endif
else
   set stn  = $1
endif

# The variable stn is empty if the user wants to specify the location 
# graphically.

if ( $ans != 3 ) then

    if ( ${stn}x == x ) then
	echo " "
	echo " Choose location on the screen using the mouse one the + appears."
	echo " "

	gdplot << EOD
	cursor gpoint
	exit
EOD

#   Otherwise, just set GPOINT to the station selected.

    else

	gdplot << EODD
	GPOINT = ${stn}
	exit
EODD

    endif

endif

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

source settings

gdprof << EOF
GDATTIM = all
GVCORD  = pres
GFUNC   = tmpc
GVECT   = wnd
LINE    = 2/1/4
MARKER  = 0
BORDER  = 1=white
PTYPE   = skewt//7;4;7;2
SCALE   = 0
XAXIS   = -40/40/10
YAXIS   = 
WIND    = bk1/1/1
WINPOS  = 1
FILTER  = YES
TITLE   = 1/-1/~  ${model} FCST SOUNDING AT #
PANEL   = 0
CLEAR   = yes
DEVICE  = $dev_prof
OUTPUT  = N
THTALN  = 12/3/1
THTELN  = 15/1/1
MIXRLN  = 5/10/2
r

GFUNC   = DWPC
LINE    = 3/2/4
GVECT   = 
TITLE   = 
THTALN  = 0
THTELN  = 0
MIXRLN  = 0
CLEAR   = NO
r

;2
;l
ex
EOF
