[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
our last conversation
- Subject: our last conversation
- Date: Tue, 14 Nov 2000 15:22:00 -0500 (Eastern Standard Time)
Tom,
I looked up the dataset we hurriedly tried to access last
Friday, and it is not set up for remote access. Spur of
the moment ideas are not always good ideas. I'll have to
think about changing the setup; it might be the right
thing to do.
Anyway, I thought I would share the latest version of
model.gui to show you how I am taking advantage of
adde as a backup source of model data. It is pretty simple,
but I thought a visual couldn't hurt. I told you about the
radial buttons near the bottom of the widget; and there
are several DATALOC ADD's in the script.
Bill
#!/bin/sh -f
# the next line restarts using mcwish \
exec mcwish "$0" "$@"
#---------------------------------------------------------------------------
#
# Name: model.gui version 1.1
#
# Purpose: fancy display of model forecasts
#
# Written by: Bill Fingerhut
#
# Modifications:
# 03/02/00 WAF upgrade to 7.6 & data stream
# 06/27/00 WAF clean up model selection
# 09/27/00 WAF up map mag w/wind params
# 09/28/00 WAF add server option
# 10/19/00 WAF field1 level1 defaults
#
set home $env(HOME)
set mcgui $env(MCGUI)
set mcpath $env(MCPATH)
set auto_path "$mcgui $auto_path"
# Global variables
global term
global mcgui
global mcdatadir
global mcpath
global loaded
global parameter
global env
# Set widget options
option add {*font} {-adobe-helvetica-bold-r-normal--*-120*}
option add *activeBackground bisque2
option add *activeForeground green3
option add *background bisque2
# option add *disabledForeground red
option add *foreground black
option add *highlightBackground bisque
option add *highlightColor green3
option add *insertBackground black
option add *selectBackground bisque2
option add *selectForeground white
option add *Text.Foreground white
option add *Text.Background black
#Defaults for variables
set model "NGM"
set day "LAST"
set hour "LAST"
set parameter $model
set fld1 "PCP"
set lev1 "SFC"
set fld2 "WINSFC"
set lev2 MSL
set stat "ALB"
set mag 4
set dserv "lsc"
upcRunCommand "DATALOC ADD RTGRIDS CIRRUS.LSC.VSC.EDU"
set loaded "FALSE"
# Retrieve station information
set file_info [fileToList FOUS14.DAT]
foreach line $file_info {
if { [string length $line] != 0 } {
set i [expr [string first " " $line] + 1]
set j [expr $i + 2]
lappend state_value [string range $line $i $j]
lappend state_name [string range $line 0 end]
}
}
# Retrieve model information
set i [exec grdlist.k RTGRIDS/ALL FORM=FILE > WMODEL.TXT]
set file_info [fileToList WMODEL.TXT]
foreach line $file_info {
if { [string length $line] != 0 } {
set i [expr [string first " " $line] + 18]
set j [expr $i + 34]
set k [expr $j + 2]
set o [expr $i + 4]
set l [expr $o + 6]
set m [expr $i + 30]
set n [expr $m + 1]
lappend model_info [string range $line $i end]
lappend model_name [string range $line $j $k]
lappend model_day [string range $line $o $l]
lappend model_hour [string range $line $m $n]
}
}
# Create an input widget
wm title . "LSC Model Display"
wm iconname . "model gui"
wm geometry . +150+150
wm maxsize . 650 700
# Describe the graphical widget
frame .frame
frame .frame.top
frame .frame.mid1
frame .frame.mid2
frame .frame.mid3
frame .frame.mid4
frame .frame.mid5
frame .frame.mid6
frame .frame.mid7
frame .frame.mid8
frame .frame.bot
message .msg1 -aspect 1200 -justify center -text "LSC Model Display"
label .lab1 -text "Model ->"
entry .ent_mod -width 5 -relief sunken -textvariable model
entry .ent_day -width 7 -relief sunken -textvariable day
entry .ent_hr -width 5 -relief sunken -textvariable hour
set helpmsg.ent_mod "Button to left opens a menu, or enter model name"
set helpmsg.ent_day "Button to left opens a menu, or enter model run day"
set helpmsg.ent_hr "Button to left opens a menu, or enter model run
hour"
label .lab2 -text "Parameter to color fill ->"
entry .ent_fld1 -width 10 -relief sunken -textvariable fld1
set helpmsg.ent_fld1 "Button to left opens a menu"
set helpmsg.mbut1 "Click left button for a parameter menu"
menubutton .mbut1 -menu .mbut1.menu -relief raised -bitmap
@${mcgui}/downarr.xbm \
-activeforeground green3 -cursor {hand2}
menu .mbut1.menu
.mbut1.menu add radiobutton -label "Height" -variable fld1 -value
Z
.mbut1.menu add radiobutton -label "Precipitation" -variable fld1
-value PCP
.mbut1.menu add radiobutton -label "Pressure @ MSL" -variable fld1
-value P
.mbut1.menu add radiobutton -label "Relative Humidity" -variable
fld1 -value RH
.mbut1.menu add radiobutton -label "Temperature" -variable fld1
-value T
.mbut1.menu add radiobutton -label "T @ surface" -variable fld1
-value TF
.mbut1.menu add radiobutton -label "Vorticity" -variable fld1
-value VOR
.mbut1.menu add radiobutton -label "Vorticity Advection" -variable
fld1 -value VADV
.mbut1.menu add radiobutton -label "Wind Speed" -variable fld1
-value SPD
label .lab3 -text "Pressure Level of Parameter ->"
entry .lev1 -width 10 -relief sunken -textvariable lev1
set helpmsg.lev1 "Click left button and enter: 1000 to 100 by 50 mb,
SFC, 2, 10, or ..."
label .lab4 -text "Parameter to overlay with contours ->"
entry .ent_fld2 -width 10 -relief sunken -textvariable fld2
set helpmsg.ent_fld2 "Button to left opens a menu"
set helpmsg.mbut2 "Click left button for a parameter menu"
menubutton .mbut2 -menu .mbut2.menu -relief raised -bitmap
@${mcgui}/downarr.xbm \
-activeforeground green3 -cursor {hand2}
menu .mbut2.menu
.mbut2.menu add radiobutton -label "NONE" -variable fld2 -value
NONE
.mbut2.menu add radiobutton -label "CAPE (ETA)" -variable fld2
-value CAPE
.mbut2.menu add radiobutton -label "Height" -variable fld2 -value
Z
.mbut2.menu add radiobutton -label "Lifted Index" -variable fld2
-value LI
.mbut2.menu add radiobutton -label "Precipitation" -variable fld2
-value PCP
.mbut2.menu add radiobutton -label "Pressure @sea level" -variable
fld2 -value PSL
.mbut2.menu add radiobutton -label "Thickness: 500 - 1000 mb"
-variable fld2 -value DZ5
.mbut2.menu add radiobutton -label "Thickness: 850 - 1000 mb"
-variable fld2 -value DZ8
.mbut2.menu add radiobutton -label "Vertical Velocity" -variable
fld2 -value W
.mbut2.menu add radiobutton -label "Wind speed @surface" -variable
fld2 -value WINSFC
.mbut2.menu add radiobutton -label "Wind speed" -variable fld2
-value WIN
set helpmsg.mbut3 "Click left button for model information"
menubutton .mbut3 -menu .mbut3.menu -relief raised -bitmap
@${mcgui}/help.xbm \
-activeforeground green3 -cursor {hand2}
menu .mbut3.menu
.mbut3.menu add radiobutton -label "NGM - Regional forecasts, 0 to
48 hours, \
every 6 hours" -variable dum -value N
.mbut3.menu add radiobutton -label "ETA - Regional forecasts, 0 to
48 hours, \
every 6 hours" -variable dum -value N
.mbut3.menu add radiobutton -label "MAPS (RUC) - Regional
forecasts, 0 to 12 hours, \
every 3 hours" -variable dum -value N
.mbut3.menu add radiobutton -label "AVN - Global forecasts, 0 to
72 hours, \
every 12 hours" -variable dum -value N
.mbut3.menu add radiobutton -label "MRF - Global forecasts, 84 to
144 hours, \
every 12 hours, 0Z run" -variable dum -value N
label .lab5 -text "Pressure Level of Parameter ->"
entry .lev2 -width 10 -relief sunken -textvariable lev2
set helpmsg.lev2 "Click left button and enter: 1000 to 100 by 50 mb,
SFC, 2, 10, or ..."
label .lab6 -text "Center of Map ->"
entry .stat -width 10 -relief sunken -textvariable stat -xscroll ".scrl
set"
set helpmsg.stat "Button to left opens a menu, or enter: station ID "
label .lab7 -text "Map Magnification Factor ->"
entry .ent_mag -width 10 -relief sunken -textvariable mag
scale .magscal -relief groove -from -10 -to 10 -orient horizontal
-tickinterval 0 \
-showvalue 0 -length 35m -cursor {hand2} -command { setScale mag
"by1"}
set helpmsg.ent_mag "Click left button and enter map magnification
factor"
set helpmsg.magscal "Hold left button down and drag slider to set map
magnification factor"
# used by .but1
button .but0 -command {
update idletasks
set i [lsearch $state_name $parameter]
set stat [lindex $state_value $i]
}
set helpmsg.but1 "Click left button for Station ID list"
button .but1 -bitmap @${mcgui}/downarr.xbm -activeforeground green3 \
-cursor {hand2}
# used by .but3
button .but2 -command {
update idletasks
set i [lsearch $model_info $parameter]
set model [lindex $model_name $i]
set day [lindex $model_day $i]
set hour [lindex $model_hour $i]
if { $model == "MRF" } {
set fld1 "Z"
set lev1 "500"
set fld2 "P"
set lev2 "MSL"
set mag "3"
}
if { $model == "AVN" } {
set fld1 "T"
set lev1 "SFC"
set fld2 "Z"
set lev2 "500"
set mag "2"
}
}
set helpmsg.but3 "Click left button for available model list"
button .but3 -bitmap @${mcgui}/downarr.xbm -activeforeground green3 \
-cursor {hand2}
scrollbar .scrl -command ".ent6 view" -orient horiz -relief sunken
set helpmsg.scrl "Click left button and drag mouse to scroll command"
label .lab8 -text "Data Server ->"
set helpmsg.dslsc "LSC data server"
set helpmsg.dsucar "UCAR data server"
radiobutton .dslsc -text "LSC" -variable dserv -value lsc -relief flat \
-anchor w -width 5 -command {
upcRunCommand "DATALOC ADD RTGRIDS CIRRUS.LSC.VSC.EDU"
}
radiobutton .dsucar -text "UCAR" -variable dserv -value ucar -relief flat
\
-anchor w -width 5 -command {
upcRunCommand "DATALOC ADD RTGRIDS ADDE.UCAR.EDU"
}
set helpmsg.ok "Click left mouse button"
button .ok -text "Create Image Loop" -activeforeground green3 -cursor
{hand2}
set helpmsg.exit "Click left mouse button"
button .exit -text "Exit" -activeforeground red -cursor {pirate} \
-command {
upcRunCommand "TD PREFIX QN"
upcRunCommand "DATALOC ADD RTGRIDS
CIRRUS.LSC.VSC.EDU"
exit
}
label .help -textvariable helptxt -width 55 -foreground blue
# Pack the widget
pack .frame -expand 1 -fill both
pack .frame.top -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid1 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid2 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid3 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid4 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid5 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid6 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid7 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.mid8 -in .frame -side top -expand 1 -fill both -padx 0
pack .frame.bot -in .frame -side bottom -expand 1 -fill x -pady 2m -padx
0
pack .msg1 -in .frame.top -fill x
pack .lab1 -in .frame.mid1 -side left
# pack .modruc -in .frame.mid1 -side right -padx 0
# pack .modngm -in .frame.mid1 -side right -padx 0
# pack .modmrf -in .frame.mid1 -side right -padx 0
# pack .modeta -in .frame.mid1 -side right -padx 0
# pack .modavn -in .frame.mid1 -side right -padx 0
pack .ent_hr -in .frame.mid1 -side right -padx 0
pack .ent_day -in .frame.mid1 -side right -padx 0
pack .ent_mod -in .frame.mid1 -side right -padx 0
pack .but3 -in .frame.mid1 -side right -padx 0
pack .mbut3 -in .frame.mid1 -side right -padx 2
pack .lab2 -in .frame.mid2 -side left
pack .ent_fld1 -in .frame.mid2 -side right -padx 0
pack .mbut1 -in .frame.mid2 -side right -padx 2
pack .lab3 -in .frame.mid3 -side left
pack .lev1 -in .frame.mid3 -side right -padx 0
pack .lab4 -in .frame.mid4 -side left
pack .ent_fld2 -in .frame.mid4 -side right -padx 0
pack .mbut2 -in .frame.mid4 -side right -padx 2
pack .lab5 -in .frame.mid5 -side left
pack .lev2 -in .frame.mid5 -side right -padx 0
pack .lab6 -in .frame.mid6 -side left
pack .stat -in .frame.mid6 -side right -padx 0
pack .but1 -in .frame.mid6 -side right -padx 2
pack .lab7 -in .frame.mid7 -side left
pack .ent_mag -in .frame.mid7 -side right
pack .magscal -in .frame.mid7 -side right -padx 2
.magscal set $mag
pack .lab8 -in .frame.mid8 -side left
pack .dsucar -in .frame.mid8 -side right
pack .dslsc -in .frame.mid8 -side right -padx 2
pack .ok -in .frame.bot -side right -expand 1 -fill both
pack .exit -in .frame.bot -side left -expand 1 -fill both
pack append . .help {fillx bottom}
bind .but1 <Button-1> {
set i [lsearch $state_value $stat]
set parameter [lindex $state_name $i]
runBusy busy
listSelect state_name [expr %X-%x] [expr %Y-%y] ".but0"\
"Station ID Selection"
runBusy normal
}
bind .but1 <Button-3> {
Help [expr %X-%x] [expr %Y-%y] "Select a station ID by clicking
the left mouse button in the ENTRY and entering a three-letter ID
(highlight the text to overwrite) or by selecting an ID from the list that
is accessed by clicking the left mouse button on the down arrow."
}
bind .but3 <Button-1> {
set i [lsearch $model_name $model]
set parameter [lindex $model_info $i]
runBusy busy
listSelect model_info [expr %X-%x] [expr %Y-%y] ".but2"\
"Model Selection"
runBusy normal
}
bind .stat <Button-3> {
Help [expr %X-%x] [expr %Y-%y] "Select a station ID by clicking
the left mouse button in the ENTRY and entering a three-letter ID
(highlight the text to overwrite) or by selecting an ID from the list that
is accessed by clicking the left mouse button on the down arrow."
}
bind .stat <Leave> {
set helptxt ""
string trim $stat " "
}
bind .stat <Return> {
string trim $stat " "
set i [lsearch $state_value $stat]
if {$i != -1} {
update idletasks
} else {
Notify [expr %X-%x] [expr %Y-%y] $stat "Invalid
Selection"
}
}
bind .ok <Button-1> {
runBusy busy
upcRunCommand "TE QNRUND DEV=NNN \\\"$day"
upcRunCommand "TE QNRUNH DEV=NNN \\\"$hour"
upcRunCommand "BATCH $model $fld1 $lev1 $fld2 $lev2 $stat
$mag CONTINUE=YES \
\\\"/usr/network/mcidas/labstuff/WAFMODX.BAT"
runBusy normal
}
bind Entry <Any-KeyPress> {
if {"%A" != ""} {
set a [string compare %A "A"]
set b [string compare %A "Z"]
set c [string compare %A "a"]
set d [string compare %A "z"]
if { ($a >= 0 && $b <= 0) || ($c >=0 && $d <=0 ) }
{
if [%W selection present] {
%W delete sel.first sel.last
}
%W insert insert [caseFlip %A]
break
}
set a [string first %A "0123456789 .:-+/\""]
if { $a != -1 } {
if [%W selection present] {
%W delete sel.first sel.last
}
%W insert insert %A
break
}
}
}
bind all <Enter> {
catch {set helptxt ${helpmsg%W}}
}
bind .mbut1.menu <Leave> {
if { $fld1 == "P" } { set lev1 "MSL" }
if { $fld1 == "PCP" } {set lev1 "SFC" }
if { $fld1 == "TF" } {set lev1 "SFC" }
}
bind .mbut2.menu <Leave> {
if { ($mag <= "2") && ($fld2 == "WIN" || $fld2 == "WINSFC") } {
set mag "3"
}
}
bind all <Leave> {
set helptxt ""
}
proc setScale {name step value} {
set name2 " "
set i [string first " " $name]
if { $i != -1 } {
scan $name "%s %s" name1 name2
set scale2 ".${name2}scal"
upvar $name1 nam1
upvar $name2 nam2
} else {
upvar $name nam1
}
if { [string range $step 0 1] == "by" } {
set factor [string range $step 2 end]
set value [expr $factor * int($value/$factor)]
} else {
set value [expr int(pow(2,int(log($value)/log(2))))]
}
if { $value == 0 || $value == -1 } {
set value -2
}
if { $name2 != " " } {
set nam1 $value
set nam2 $value
$scale2 set $value
} else {
set nam1 $value
}
if { $value == 0 || $value == -1 } {
set value -2
}
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
< Bill Fingerhut, Professor PHONE: 802-626-6257 >
< Meteorology Dept FAX: 802-626-9770 >
< Lyndon State College >
< Lyndonville, Vt 05851 >
< >
< EMAIL: address@hidden >
< address@hidden >
< WWW: http://apollo.lsc.vsc.edu/ >
< >
< disclaimer: I know nothing - I only work here. >
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv