#!/usr/bin/perl use Tk; require Tk::FileSelect; require Tk::Balloon; sub ResetAll { $dtype = 0; $plot{domain} = "us"; $plot{type} = "sfc/sfc"; $plot{file} = "la"; $plot{time} = "init"; $plot{level} = "sfc"; $plot{var} = "all"; $plot{plot} = "plot_data"; $plot{intrvl} = ""; $plot{loop} = 0; $param{lalo} = 0; $param{gridx} = 1; $param{utitle} = ""; $param{draw_text} = 1; $param{draw_data} = 1; $param{draw_sum} = 1; $param{draw_map} = 1; $param{draw_bord} = 1; $param{draw_textul} = 1; $param{draw_textur} = 1; $param{draw_textll} = 1; $param{draw_textlr} = 1; $param{device} = "d"; $param{message} = ""; } sub SetupState { foreach $x ( @_ ){ $widget{level_menu}->configure( -state => active ) if $x eq "+level"; $widget{level_menu}->configure( -state => disabled ) if $x eq "-level"; $widget{level_entry}->configure( -state => normal ) if $x eq "+level"; $widget{level_entry}->configure( -state => disabled ) if $x eq "-level"; $widget{time_menu}->configure( -state => active ) if $x eq "+time"; $widget{time_menu}->configure( -state => disabled ) if $x eq "-time"; $widget{time_entry}->configure( -state => normal ) if $x eq "+time"; $widget{time_entry}->configure( -state => disabled ) if $x eq "-time"; $widget{var_menu}->configure( -state => active ) if $x eq "+var"; $widget{var_menu}->configure( -state => disabled ) if $x eq "-var"; $widget{var_entry}->configure( -state => normal ) if $x eq "+var"; $widget{var_entry}->configure( -state => disabled ) if $x eq "-var"; $widget{plot_menu}->configure( -state => active ) if $x eq "+plot"; $widget{plot_menu}->configure( -state => disabled ) if $x eq "-plot"; $widget{plot_entry}->configure( -state => normal ) if $x eq "+plot"; $widget{plot_entry}->configure( -state => disabled ) if $x eq "-int"; $widget{int_menu}->configure( -state => active ) if $x eq "+int"; $widget{int_menu}->configure( -state => disabled ) if $x eq "-int"; $widget{int_entry}->configure( -state => normal ) if $x eq "+int"; $widget{int_entry}->configure( -state => disabled ) if $x eq "-ident"; $widget{int_menu}->configure( -state => active ) if $x eq "+ident"; $widget{int_menu}->configure( -state => disabled ) if $x eq "-ident"; $widget{int_entry}->configure( -state => normal ) if $x eq "+ident"; $widget{int_entry}->configure( -state => disabled ) if $x eq "-ident"; $widget{int_menu}->configure( -text => "Ident" ) if $x eq "+ident"; $widget{int_menu}->configure( -text => "Interval" ) if $x ne "+ident"; } } sub SetupTimeMenu { $widget{time_menu}->menu->delete( 0, 'end' ); $widget{color} = "#c0c040"; $def = ""; $found = 0; my $menu = $widget{time_menu}; $cascade = ""; foreach ( @_ ){ $value = $_; $value =~ s/^\+//; $def = $value if /^\+/; if( /^#/ ){ if( $cascade ){ AddCascade( $widget{time_menu}, $cascade, $menu ); } $cascade = substr $_, 1; $menu = AddDropMenu( $widget{time_menu} ); } else { $found = 1 if $value eq $plot{time}; AddCommand( $menu, $value, [ \&SetTime, $value ] ); } } if( $cascade ){ } $plot{time} = $def if( ! $found ); } sub SetupLevelMenu { $widget{level_menu}->menu->delete( 0, 'end' ); $widget{color} = "#c08040"; $def = ""; $found = 0; my $menu = $widget{level_menu}; $cascade = ""; foreach ( @_ ){ $value = $_; $value =~ s/^\+//; $def = $value if /^\+/; if( /^#/ ){ if( $cascade ){ AddCascade( $widget{level_menu}, $cascade, $menu ); } $cascade = substr $_, 1; $menu = AddDropMenu( $widget{level_menu} ); } else { $found = 1 if $value eq $plot{level}; AddCommand( $menu, $value, [ \&SetLevel, $value ] ); } } if( $cascade ){ AddCascade( $widget{level_menu}, $cascade, $menu ); } print "Level: $def - $found\n"; $plot{level} = $def if( ! $found ); } sub SetupVarMenu { $widget{var_menu}->menu->delete( 0, 'end' ); $widget{color} = "#c04040"; $def = ""; $found = 0; my $menu = $widget{var_menu}; $cascade = ""; foreach ( @_ ){ $value = $_; $value =~ s/^\+//; $def = $value if /^\+/; if( /^#/ ){ if( $cascade ){ AddCascade( $widget{var_menu}, $cascade, $menu ); } $cascade = substr $_, 1; $menu = AddDropMenu( $widget{var_menu} ); } else { $found = 1 if $value eq $plot{var}; AddCommand( $menu, $value, [ \&SetVar, $value ] ); } } if( $cascade ){ AddCascade( $widget{var_menu}, $cascade, $menu ); } $plot{var} = $def if( ! $found ); } sub SetupPlotMenu { $widget{plot_menu}->menu->delete( 0, 'end' ); $widget{color} = "#c040c0"; $def = ""; $found = 0; foreach ( @_ ){ $value = $_; $value =~ s/^\+//; $def = $value if /^\+/; $found = 1 if $value eq $plot; AddCommand( $widget{plot_menu}, $value, [ \&SetPlot, $value ] ); } $plot{plot} = $def if( ! $found ); } sub SetFilter { if( $plot{type1} eq "sat" ){ if( $plot{type2} eq "wc" || $plot{type2} eq "an" || $plot{type2} eq "hn" ){ $fdir = "$bdata/goesw/sat"; } elsif( $plot{type2} eq "cf" ){ $fdir = "$bdata/spare/sat"; } else { $fdir = "$bdata/goese/sat"; } if( $plot{var} eq "irenh" ){ $var = "i11"; } else { $var = $plot{var}; } $filter = "*_g$plot{type2}${var}.sat"; } } sub SetDefaultValue { my ($rtime, $rlevel, $rvar, $rplot) = @_; $plot{time} = $rtime if $rtime; $plot{level} = $rlevel if $rlevel; $plot{var} = $rvar if $rvar; $plot{plot} = $rplot if $rplot; } sub SetType { my ($var, $flag) = @_; $plot{ptype} = $plot{type}; $plot{type} = $var; ($plot{type1}, $plot{type2}) = ($plot{type} =~ /(\w+)\/(.+)/); print "Type: $plot{type} - $plot{type1} - $plot{type2}\n"; $plot{intrvl} = "" if $plot{type} ne $plot{ptype}; $widget{main}->title( "ptkWXP: $plot{type}" ); if( $plot{type1} eq "sat" ){ SetupState( "-level", "-time", "+var", "-plot", "-int" ); SetupVarMenu( "vis","+ir","irenh","ir3","ir12","wv" ); SetDefaultValue( "anal", "sat", "", "plot_image" ); SetFilter; } elsif( $plot{type1} eq "sfc" ){ if( $plot{type2} eq "frt" ){ SetupState( "-level", "-time", "-var", "-plot", "-int" ); SetDefaultValue( "anal", "sfc", "frt", "plot_data" ); $fdir = "$bdata/nwstg/data"; $filter = "*_frt.wmo"; } elsif( $plot{type2} eq "forfrt" ){ SetupState( "-level", "+time", "-var", "-plot", "-int" ); SetupTimeMenu( "12hr","+24hr","36hr","48hr" ); SetDefaultValue( "24hr", "sfc", "frt", "plot_data" ); $fdir = "$bdata/nwstg/data"; $filter = "*_frf.wmo"; } elsif( $plot{type2} eq "met" ){ SetupState( "-level", "-time", "-var", "-plot", "+ident" ); SetDefaultValue( "anal", "sfc", "", "plot_data" ); $fdir = "$bdata/nwstg/convert"; $filter = "*_sao.wxp"; } else { SetupState( "-level", "-time", "+var", "+plot", "+int" ); SetupPlotMenu( "default", "+plot_data", "cont_fill", "cont_line", "cont_dash", "cont_neg_dash", "grid_val", "vector", "stream" ); SetDefaultValue( "anal", "sfc", "", "" ); SetPlot(); $fdir = "$bdata/nwstg/convert"; $filter = "*_sao.wxp"; } } elsif( $plot{type1} eq "upa" ){ if( $plot{type2} eq "snd" ){ SetupState( "-level", "-time", "-var", "+plot", "+ident" ); SetupPlotMenu( "+skewt", "stuve", "ema", "hodo" ); SetDefaultValue( "anal", "snd", "", "" ); $fdir = "$bdata/convert"; $filter = "*_upa.wxp"; } else { SetupState( "+level", "-time", "+var", "+plot", "+int" ); SetupPlotMenu( "default", "+plot_data", "cont_fill", "cont_line", "cont_dash", "cont_neg_dash", "grid_val", "vector", "stream" ); SetupLevelMenu( "#Pressure", "sfc", "1000mb", "925mb", "+850mb", "700mb", "500mb", "400mb", "300mb", "250mb", "200mb", "150mb", "100mb", "70mb", "50mb", "30mb", "20mb", "10mb", "#Height", "5000ft", "10000ft", "15000ft", "20000ft", "25000ft", "30000ft", "35000ft", "#Isentropic", "280k", "300k", "320k", "340k", "#Misc", "trop", "wind", "snd" ); SetPlot(); SetDefaultValue( "anal", "", "", "" ); $fdir = "$bdata/convert"; $filter = "*_upa.wxp"; } } elsif( $plot{type1} eq "rad" ){ if( $plot{type2} eq "mdr" ){ SetupState( "-level", "-time", "+var", "-plot", "-int" ); SetupVarMenu( "+all", "sum", "pr_typ", "pr_tt", "echtop", "pr_amv", "pr_cmv", "watch" ); SetDefaultValue( "anal", "sfc", "", "plot_sum" ); $fdir = "$bdata/nwstg/convert"; $filter = "*_rad.wxp"; } elsif( $plot{type2} eq "rcm" ){ SetupState( "-level", "-time", "+var", "-plot", "-int" ); SetupVarMenu( "+comp", "stat", "sum", "tvs", "meso", "move", "tops", "watch" ); SetDefaultValue( "anal", "sfc", "", "plot_sum" ); $fdir = "$bdata/nwstg/convert"; $filter = "*_rcm.wxp"; } elsif( $plot{type2} eq "mos" ){ SetupState( "-level", "-time", "+var", "-plot", "-int" ); SetupVarMenu( "bref", "+bref2", "bref4", "tops", "prec1", "prec12", "precd" ); SetDefaultValue( "anal", "sfc", "", "plot_sum" ); SetVar(); } elsif( $plot{type2} eq "nids" ){ SetupState( "-level", "-time", "+var", "-plot", "+ident" ); SetupVarMenu( "+ref1", "ref2", "ref3", "ref4", "bref1+", "cref", "cref+", "vel1", "vel2", "vel3", "srvel1", "srvel2", "srvel3", "top", "vil", "prec1", "prec3", "prect", "dpa", "vad" ); SetDefaultValue( "anal", "sfc", "", "plot_sum" ); $plot{domain} = "miss"; $fdir = "$bdata/convert"; $filter = "*_*.nid"; } elsif( $plot{type2} eq "nldn" ){ SetupState( "-level", "-time", "+var", "-plot", "-int" ); SetupVarMenu( "+signal", "time", "age" ); SetDefaultValue( "anal", "sfc", "", "plot_sum" ); $fdir = "$bdata/nwstg/nldn"; $filter = "*.nldn"; } } elsif( $plot{type1} eq "mos" ){ $fdir = "$bdata/data"; $filter = "*_mod.wmo"; if( $plot{type2} eq "ngmmet" ){ SetupState( "-level", "+time", "-var", "-plot", "+ident" ); SetDefaultValue( "", "sfc", "", "plot_data" ); } elsif( $plot{type2} eq "avnmet" ){ SetupState( "-level", "+time", "-var", "-plot", "+ident" ); SetDefaultValue( "", "sfc", "", "plot_data" ); } elsif( $plot{type2} eq "mrfmet" ){ SetupState( "-level", "+time", "-var", "-plot", "+ident" ); SetDefaultValue( "", "sfc", "", "plot_data" ); } elsif( $plot{type2} eq "mrf" ){ SetupState( "-level", "+time", "+var", "+plot", "+int" ); SetupTimeMenu( "1day","+2day","3day","4day","5day","6day", "7day","8day" ); SetupPlotMenu( "default", "+plot_data", "cont_fill", "cont_line", "cont_dash", "cont_neg_dash", "grid_val", "vector", "stream" ); if( $plot{plot} eq "plot_data" ){ SetupVarMenu( "+allm", "maxt", "mint", "dmaxt", "dmint", "pop", "cldcv" ); } else { SetupVarMenu( "+maxt", "mint", "dmaxt", "dmint", "pop", "cldcv" ); } SetDefaultValue( "", "sfc", "", "" ); $fdir = "$bdata/data"; $filter = "*_mod.wmo"; } else { SetupState( "-level", "+time", "+var", "+plot", "+int" ); SetupTimeMenu( "6hr","12hr","18hr","+24hr","30hr","36hr", "42hr","48hr","60hr" ); SetupPlotMenu( "default", "+plot_data", "cont_fill", "cont_line", "cont_dash", "cont_neg_dash", "grid_val", "vector", "stream" ); if( $plot{plot} eq "plot_data" ){ SetupVarMenu( "+all", "cli", "temp", "dewp", "wdir", "wspd", "wbrb", "wx", "pop", "pot", "vis", "cldcl", "cldcv", "extt", "prec", "snwfl", "wchill", "heat", "rhum", "epot" ); } else { SetupVarMenu( "+temp", "dewp", "wspd", "wind", "pop", "pot", "vis", "cldcl", "cldcv", "extt", "prec", "snwfl", "wchill", "heat", "rhum", "epot", "conv","mconv","tadv","madv" ); } SetDefaultValue( "", "sfc", "", "" ); $fdir = "$bdata/data"; $filter = "*_mod.wmo"; } } elsif( $plot{type1} eq "grb" ){ SetupState( "+level", "+time", "+var", "+plot", "+int" ); SetupLevelMenu( "sfc", "1000mb", "+850mb", "700mb", "500mb", "400mb", "300mb", "250mb", "200mb", "150mb", "100mb", "snd", "miss" ); print "Lev: $plot{level}\n"; SetupPlotMenu( "default", "+cont_fill", "cont_line", "cont_dash", "cont_neg_dash", "grid_val", "vector", "stream" ); print "Lev: $plot{level}\n"; $fdir = "$bdata/nwstg/model"; # # Model specific info # print "Lev: $plot{level}\n"; if( $plot{type2} eq "eta" ){ SetupTimeMenu( "init","6hr","12hr","18hr","+24hr","30hr","36hr", "42hr","48hr","54hr","60hr" ); print "Lev: $plot{level}\n"; SetLevel(); print "Lev: $plot{level}\n"; $filter = "*_eta.grb"; } elsif( $plot{type2} eq "eta2" ){ SetupTimeMenu( "init","3hr","6hr","9hr","12hr","15hr","18hr","21hr", "+24hr","27hr","30hr","33hr","36hr", "39hr", "42hr","45hr","48hr" ); SetupVarMenu( "stemp", "sdewp", "swind", "prec", "cprec", "lprec", "snwdp", "precct", "prec48", "snw48"); SetDefaultValue( "", "sfc", "", "" ); $filter = "*_eta2.grb"; } elsif( $plot{type2} eq "ngm" ){ SetupTimeMenu( "init","6hr","12hr","18hr","+24hr","30hr","36hr", "42hr","48hr" ); SetLevel(); $filter = "*_ngm.grb"; } elsif( $plot{type2} =~ /avn/ ){ SetupTimeMenu( "init","6hr","12hr","18hr","+24hr","30hr","36hr", "42hr","48hr", "60hr", "72hr" ); SetLevel(); $filter = "*_$plot{type2}.grb"; } elsif( $plot{type2} =~ /ruc/ ){ SetupTimeMenu( "init","3hr","6hr","9hr","+12hr"); SetLevel(); $filter = "*_$plot{type2}.grb"; } elsif( $plot{type2} =~ /mrf/ ){ SetupTimeMenu( "init", ".5day", "1day", "1.5day", "2day", "2.5day", "3day", "3.5day", "+4day", "4.5day", "5day", "5.5day", "6day", "6.5day", "7day", "7.5day", "8day", "8.5day", "9day", "9.5day", "10day" ); SetLevel(); $filter = "*_$plot{type2}.grb"; } elsif( $plot{type1} =~ /^grb\/ecmwf/ ){ SetupState( "+level", "+time", "+var", "+plot", "+int" ); SetupTimeMenu( "init","1day","+2day","3day","4day","5day","6day", "7day" ); SetupLevelMenu( "sl", "850mb", "500mb", "200mb" ); SetupVarMenu( "temp","pres","wind","wdir","wspd","hght" ); $filter = "*_ecmwf.grb"; } elsif( $plot{type1} =~ /grb\/ukmet/ ){ SetupTimeMenu( "init","6hr","12hr","18hr","+24hr","30hr","36hr", "42hr","48hr", "60hr", "72hr" ); SetLevel(); $filter = "*_egr.grb"; } } } sub SetTime { my ($val) = @_; $plot{time} = $val if $val; } sub SetLevel { my ($val) = @_; $plot{level} = $val if $val; print "SetLevel: $plot{type} - $plot{level} - $val\n"; if( $plot{type} eq "upa/upa" ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "lpres", "+thk50", "thk58", "pwat", "lift", "show", "tt", "ki", "hel", "cape" ); } else { if( $plot{plot} eq "plot_data" ){ SetupVarMenu( "+all", "temp", "dewp", "wdir", "wspd", "wbrb", "hght", "mrat", "rhum", "epot" ); } else { SetupVarMenu( "+temp", "dewp", "wspd", "wind", "geos", "qvect", "hght", "rhum", "epot", "rvort", "avort", "conv", "mconv", "tadv","madv" ); } } } if( $plot{type} eq "grb/eta" || $plot{type} eq "grb/eta2" ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "+slp", "stemp", "sdewp", "swind", "thk50", "mrhum", "prec", "cprec", "lprec", "snwdp", "precct", "prec48", "snw48", "lift", "hel", "cape", "ehi" ); } else { SetupVarMenu( "+temp","dewp","wind","wdir","wspd","vvel","hght","rhum", "#Derived", "geos","ageos","conv","mconv","rvort","avort", "tadv","madv", "vadv", "qvect", "qvconv", "#Composite", "cpres","csfc","c850","c700","c500","c300","crhli" ); } } elsif( $plot{type} eq "grb/ngm" ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "+slp", "thk50", "mrhum", "prec", "cprec", "lprec", "prec48", "lift" ); } else { SetupVarMenu( "+temp","dewp","wind","wdir","wspd","vvel","hght","rhum", "#Derived", "geos","ageos","conv","mconv","rvort","avort", "tadv","madv", "vadv", "qvect", "qvconv", "#Composite", "cpres","csfc","c850","c700","c500","c300","crhli" ); } } elsif( $plot{type2} =~ /avn/ ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "+slp", "stemp", "sdewp", "swind", "thk50", "mrhum", "prec", "cprec", "lprec" ); } else { SetupVarMenu( "+temp","dewp","wind","wdir","wspd","vvel","hght","rhum", "#Derived", "geos","ageos","conv","mconv","rvort","avort", "tadv","madv", "vadv", "qvect", "qvconv", "#Composite", "cpres","csfc","c850","c700","c500","c300","crhsi" ); } } elsif( $plot{type2} =~ /ruc/ ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "+slp", "stemp", "sdewp", "swind", "thk50", "mrhum", "prec", "cprec", "lprec" ); } else { SetupVarMenu( "+temp","dewp","wind","wdir","wspd","vvel","hght","rhum", "#Derived", "geos","ageos","conv","mconv","rvort","avort", "tadv","madv", "vadv", "qvect", "qvconv", "#Composite", "cpres","csfc","c850","c700","c500","c300","crhli" ); } } elsif( $plot{type2} =~ /mrf/ ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "+slp", "btemp", "bdewp", "bwind", "thk50", "mrhum", "prec", "cprec", "lprec", "prec48", "show" ); } else { SetupVarMenu( "+temp","dewp","wind","wdir","wspd","vvel","hght","rhum", "#Derived", "geos","ageos","conv","mconv","rvort","avort", "tadv","madv", "vadv", "qvect", "qvconv", "#Composite", "cpres","csfc","c850","c700","c500","c300","crhli" ); } } elsif( $plot{type2} eq "ukmet" ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "+slp", "stemp", "sdewp", "swind", "thk50", "mrhum", "prec", "cprec", "lprec" ); } else { SetupVarMenu( "+temp","dewp","wind","wdir","wspd","vvel","hght","rhum", "#Derived", "geos","ageos","conv","mconv","rvort","avort", "tadv","madv", "vadv", "qvect", "qvconv", "#Composite", "cpres","csfc","c850","c700","c500","c300","crhsi" ); } } } sub SetVar { my ($val) = @_; $plot{var} = $val if $val; if( $plot{type} eq "rad/mos" ){ if( $plot{var} eq "bref" ){ $fdir = "$bdata/unisys/natmos"; $filter = "*_*.nid"; } else { $fdir = "$bdata/unisys/natmos"; $filter = "*_*.nid"; } } } sub SetPlot { my ($val) = @_; $plot{plot} = $val if $val; if( $plot{type} eq "sfc/sfc" || $plot{type} eq "sfc/syn" ){ if( $plot{plot} eq "plot_data" ){ SetupVarMenu( "+all", "temp", "dewp", "wdir", "wspd", "wgst", "wbrb", "slp", "alt", "wx", "vis", "cldcl", "cldcv", "ptend", "prec24", "maxt", "mint", "snwdp", "wchill", "heat", "rhum", "epot" ); } else { SetupVarMenu( "+temp", "dewp", "wspd", "wgst", "wind", "slp", "alt", "vis", "cldcl", "cldcv", "ptend", "prec24", "maxt", "mint", "snwdp", "wchill", "heat", "rhum", "epot", "conv","mconv","tadv","madv" ); } } if( $plot{type} eq "upa/upa" ){ if( $plot{level} eq "snd" ){ SetupVarMenu( "lpres", "+thk50", "thk58", "pwat", "lift", "show", "tt", "ki", "hel", "cape" ); } else { if( $plot{plot} eq "plot_data" ){ SetupVarMenu( "+all", "temp", "dewp", "wdir", "wspd", "wbrb", "hght", "mrat", "rhum", "epot" ); } else { SetupVarMenu( "+temp", "dewp", "wspd", "wind", "geos", "qvect", "hght", "rhum", "epot", "rvort", "avort", "conv", "mconv", "tadv","madv" ); } } } } sub SetInt { my ($val) = @_; $plot{intrvl} = $val; } sub GetFile { print "GetFile: $fdir filter: $filter\n"; @files = FileDialog( $fdir, $filter ); $plot{file} = "@files" if @files; } ########################### # Domain procedure ########################### sub Domain { undef $bok; $wdom = $widget{main}->Toplevel; $wdom->title( "ptkWXP: Domain Specification" ); # # Predefined regions # $wfrm1 = $wdom->Frame->pack( -side => "top", -fill => "x" ); $wcb = $wfrm1->Radiobutton( -text => "Predefined", -value => 0, -variable => \$dtype ) ->pack( -side => "left" ); $predef = "us"; $wbe = $wfrm1->BrowseEntry( -variable => \$predef ) ->pack( -side => "right" ); foreach $reg ( "us", "ne", "at", "se", "mw", "cp", "sp", "nw", "sw", "ak", "hi", "namer", "canada", "wcan", "ecan", "ncan", "mex", "carib", "camer", "samer", "brazil", "argent", "europe", "easia", "seasia", "nasia", "wasia", "wasia", "nafr", "safr", "aust", "wpac", "arc", "antarc", "globe", "nhem", "shem" ){ $wbe->insert("end",$reg); } # # User defined regions # $wfrm2 = $wdom->Frame->pack( -side => "top", -fill => "x" ); $wcb = $wfrm2->Radiobutton( -text => "User Defined", -value => 1, -variable => \$dtype ) ->pack( -side => "left" ); $wfrm21 = $wfrm2->Frame->pack( -side => "right", -fill => "y" ); # # Projection $wfrm211 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wlab21 = $wfrm211->Label( -text => "Projection:" ) ->pack( -side => "left" ); $proj = "ps"; $wbe = $wfrm211->BrowseEntry( -variable => \$proj ) ->pack( -side => "right" ); foreach $reg ( "pstereo", "latlon", "merc", "lamb", "moll", "gnomic", "ortho", "sat" ){ $wbe->insert("end",$reg); } # Central Lat $wfrm212 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wfrm212->Label( -text => "Central latitude:" ) ->pack( -side => "left" ); $wfrm212->Entry( -textvariable => \$clat ) ->pack( -side => "right" ); # Central Long $wfrm212 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wfrm212->Label( -text => "Central longitude:" ) ->pack( -side => "left" ); $wfrm212->Entry( -textvariable => \$clon ) ->pack( -side => "right" ); # Number X $wfrm212 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wfrm212->Label( -text => "Number grid X:" ) ->pack( -side => "left" ); $wfrm212->Entry( -textvariable => \$nx ) ->pack( -side => "right" ); # Number Y $wfrm212 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wfrm212->Label( -text => "Number grid Y:" ) ->pack( -side => "left" ); $wfrm212->Entry( -textvariable => \$ny ) ->pack( -side => "right" ); # Grid X $wfrm212 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wfrm212->Label( -text => "Grid distance X:" ) ->pack( -side => "left" ); $wfrm212->Entry( -textvariable => \$dx ) ->pack( -side => "right" ); # Grid Y $wfrm212 = $wfrm21->Frame->pack( -side => "top", -fill => "x" ); $wfrm212->Label( -text => "Grid distance Y:" ) ->pack( -side => "left" ); $wfrm212->Entry( -textvariable => \$dy ) ->pack( -side => "right" ); $wfrm3 = $wdom->Frame->pack( -side => "top", -fill => "x" ); $wbut1 = $wfrm3->Button( -text => "OK", -command => sub { $bok=1; } ) ->pack( -side => "left" ); $wbut1 = $wfrm3->Button( -text => "Cancel", -command => sub { $bok=-1; } ) ->pack( -side => "right" ); $wdom->grab; $wdom->waitVariable( \$bok ); $wdom->grabRelease; $wdom->destroy; return 0 if $bok == -1; # # Compute region # if( $dtype == 1 ){ $plot{domain} = "$proj,$clat,$clon,$nx,$ny,$dx,$dy"; } else { $plot{domain} = $predef; } } sub GetFiles { my ($box, $dir, $filter) = @_; print "GetFiles: $dir/$filter\n"; $box->delete( 0, 'end' ); while( glob "$dir/$filter" ){ s/$dir\///; $box->insert( 'end', $_ ); } $box->see( 'end' ); } sub FileDialog { my ($dir, $filter,$option) = @_; my (@files, $list, $file); undef $bok; $dial = $widget{main}->Toplevel; $dial->title( "ptkWXP: File Selection" ); $frame = $dial->Frame( -relief => "groove", -borderwidth => 1 )->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Directory" )->pack( -side => "left" ); $entry = $frame->Entry( -textvariable => \$dir, -width => 25 )->pack( -side => "left", -fill => "x" ); $entry->bind( "", sub { GetFiles( $list, $dir, $filter ) } ); $frame = $dial->Frame( -relief => "groove", -borderwidth => 1 )->pack( -side => "top", -fill => "x" ); $list = $frame->Scrolled( "Listbox", -scrollbars => 'se', -selectmode => 'extended' ) ->pack( -side => "left", -fill => "x" ); # $list->bind $list->bind( "", sub { @index = $list->curselection(); $file = ""; foreach ( @index ){ $file .= $list->get( $_ ) . " "; } } ); GetFiles( $list, $dir, $filter ); $frame = $dial->Frame( -relief => "groove", -borderwidth => 1 )->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "File:" )->pack( -side => "left" ); $entry = $frame->Entry( -textvariable => \$file, -width => 25 )->pack( -side => "left", -fill => "x" ); $frame = $dial->Frame()->pack( -side => "top", -fill => "x" ); $frame->Button( -text => "OK", -command => sub { $bok=1; } ) ->pack( -side => "left" ); $frame->Button( -text => "Cancel", -command => sub { $bok=-1; } ) ->pack( -side => "right" ); $dial->grab; $dial->waitVariable( \$bok ); $dial->grabRelease; if( $bok == 1 ){ @index = $list->curselection(); foreach ( @index ){ push @files, $dir . "/" . $list->get( $_ ); } } $dial->destroy; return () if $bok == -1; return @files; } sub MapDialog { undef $bok; $dial = $widget{main}->Toplevel; $dial->title( "ptkWXP: Map Options" ); $frame = $dial->Frame( -relief => "groove", -borderwidth => 1 )->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Predefined" )->pack( -side => "left" ); $frame = $dial->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "File" )->grid( -row => 0, -column => 0 ); $frame->Label( -text => "Color" )->grid( -row => 0, -column => 1 ); $frame->Label( -text => "Bold" )->grid( -row => 0, -column => 2 ); $frame->Label( -text => "Under" )->grid( -row => 0, -column => 3 ); $frame->Label( -text => "Over" )->grid( -row => 0, -column => 4 ); for( $i = 0; $i < 10; $i++ ){ $frame->Entry( -textvariable => \$file[$i] )->grid( -row => $i+1, -column => 0 ); $frame->Entry( -textvariable => \$color[$i] )->grid( -row => $i+1, -column => 1 ); $frame->Checkbutton( -variable => \$bold[$i] )->grid( -row => $i+1, -column => 2 ); $frame->Checkbutton( -variable => \$under[$i] )->grid( -row => $i+1, -column => 3 ); $frame->Checkbutton( -variable => \$over[$i] )->grid( -row => $i+1, -column => 4 ); } $frame = $dial->Frame()->pack( -side => "top", -fill => "x" ); $frame->Button( -text => "OK", -command => sub { $bok=1; } ) ->pack( -side => "left" ); $frame->Button( -text => "Cancel", -command => sub { $bok=-1; } ) ->pack( -side => "right" ); $dial->grab; $dial->waitVariable( \$bok ); $dial->grabRelease; $dial->destroy; return 0 if $bok == -1; } sub PlotDialog { undef $bok; $dial = $widget{main}->Toplevel; $dial->title( "ptkWXP: Plot Options" ); $frame = $dial->Frame()->pack( -side => "top", -fill => "x" ); $note = $frame->NoteBook( -ipadx => 6, -ipady => 6 ); # # Window parameters # $nwind = $note->add( "window", -label => "Window", -underline => 0 ); # # Window title $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Window Title: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$utitle )->pack( -side => "left" ); # # Geometry $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Window Geometry: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$wgeom )->pack( -side => "left" ); $frame->Radiobutton( -text => "XL", -variable => \$wgeom, -value => "1000x800" )->pack( -side => "left" ); $frame->Radiobutton( -text => "L", -variable => \$wgeom, -value => "750x600" )->pack( -side => "left" ); $frame->Radiobutton( -text => "M", -variable => \$wgeom, -value => "640x512" )->pack( -side => "left" ); $frame->Radiobutton( -text => "S", -variable => \$wgeom, -value => "375x300" )->pack( -side => "left" ); $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Checkbutton( -text => "Full plot", -variable => \$fullplt )->pack( -side => "left" ); $frame->Checkbutton( -text => "Inverse plot", -variable => \$invplt )->pack( -side => "left" ); # # Labels $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Labels: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$labels, -width => 50 )->pack( -side => "left" ); $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Timezone: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$tzone, -width => 10 )->pack( -side => "left" ); $frame->Checkbutton( -text => "Contour bar", -variable => \$contbar )->pack( -side => "left" ); # # Device $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Device: " )->pack( -side => "left" ); $frame->Radiobutton( -text => "Display", -variable => \$device, -value => "d" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Window", -variable => \$device, -value => "w" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Postscript", -variable => \$device, -value => "p" )->pack( -side => "left" ); $frame->Radiobutton( -text => "HPGL/PCL5", -variable => \$device, -value => "h" )->pack( -side => "left" ); $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Params: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$devparam )->pack( -side => "left" ); # # Message $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Message level: " )->pack( -side => "left" ); $frame->Radiobutton( -text => "None", -variable => \$mess, -value => "none" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Print", -variable => \$mess, -value => "print" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Mess", -variable => \$device, -value => "mess" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Out1", -variable => \$device, -value => "out1" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Out2", -variable => \$device, -value => "out2" )->pack( -side => "left" ); $frame = $nwind->Frame()->pack( -side => "top", -fill => "x" ); $frame->Radiobutton( -text => "Out3", -variable => \$device, -value => "out3" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Out4", -variable => \$device, -value => "out4" )->pack( -side => "left" ); $frame->Radiobutton( -text => "Debug", -variable => \$device, -value => "debug" )->pack( -side => "left" ); # # File parameters # $nfile = $note->add( "file", -label => "File", -underline => 0 ); # # Convert path $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Convert path: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$cpath )->pack( -side => "left" ); # # Data path $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Data path: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$dpath )->pack( -side => "left" ); # # Text path $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Text path: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$tpath )->pack( -side => "left" ); # # Model path $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Model path: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$mpath )->pack( -side => "left" ); # # Sat path $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Sat path: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$spath )->pack( -side => "left" ); $frame = $nfile->Frame( -background => "black", -height => 2 ) ->pack( -side => "top", -fill => "x" ); # # Input file type $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Input type: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$intype )->pack( -side => "left" ); # # Input file tag $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Infile tag: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$infile )->pack( -side => "left" ); # # Output file tag $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Output tag: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$outfile )->pack( -side => "left" ); # # Number of hours $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Number of hours: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$numhour )->pack( -side => "left" ); # # File hour $frame = $nfile->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "File hour: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$fhour )->pack( -side => "left" ); # # Plot parameters # $nplot = $note->add( "plot", -label => "Plot", -underline => 0 ); # # Draw $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Draw: " )->pack( -side => "left" ); $frame->Radiobutton( -text => "text", -variable => \$param{draw_text} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "data", -variable => \$param{draw_data} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "sum", -variable => \$param{draw_sum} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "map", -variable => \$param{draw_map} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "border", -variable => \$param{draw_bord} ) ->pack( -side => "left" ); $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Radiobutton( -text => "text UL", -variable => \$param{draw_textul} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "text UR", -variable => \$param{draw_textur} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "text LL", -variable => \$param{draw_textll} ) ->pack( -side => "left" ); $frame->Radiobutton( -text => "text LR", -variable => \$param{draw_textlr} ) ->pack( -side => "left" ); # # Plot scale $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Plot Scale: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$pscale, -width => 5 )->pack( -side => "left" ); $frame->Radiobutton( -text => "XL", -variable => \$pscale, -value => "2" )->pack( -side => "left" ); $frame->Radiobutton( -text => "L", -variable => \$pscale, -value => "1.5" )->pack( -side => "left" ); $frame->Radiobutton( -text => "M", -variable => \$pscale, -value => "1" )->pack( -side => "left" ); $frame->Radiobutton( -text => "S", -variable => \$pscale, -value => ".75" )->pack( -side => "left" ); $frame->Radiobutton( -text => "XS", -variable => \$pscale, -value => ".5" )->pack( -side => "left" ); # # Station priority $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Plot Priority: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$pscale, -width => 5 )->pack( -side => "left" ); $frame->Label( -text => "Grid Filter: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$grdfilt, -width => 5 )->pack( -side => "left" ); # # City file $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "City File: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$ctyfile )->pack( -side => "left" ); # # Plot format $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Plot Format: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$pltform )->pack( -side => "left" ); # # Plot param $frame = $nplot->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Plot Parameter: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$pltparam )->pack( -side => "left" ); # # Contour parameters # $ncont = $note->add( "cont", -label => "Contour", -underline => 0 ); $frame = $ncont->Frame()->pack( -side => "top", -fill => "x" ); # # Labelling Parameter $frame = $ncont->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Contour Label - Line skip: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$labskip, -width => 4 )->pack( -side => "left" ); $frame->Label( -text => "ExtRad: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$labrad, -width => 4 )->pack( -side => "left" ); $frame->Label( -text => "Dx: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$labx, -width => 4 )->pack( -side => "left" ); $frame->Label( -text => "Dy: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$laby, -width => 4 )->pack( -side => "left" ); # # Object Parameter $frame = $ncont->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Obj Anal Filter: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$oafilt, -width => 4 )->pack( -side => "left" ); $frame->Label( -text => "Radinf: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$oarad, -width => 4 )->pack( -side => "left" ); $frame->Label( -text => "Passes: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$oapass, -width => 4 )->pack( -side => "left" ); $frame->Label( -text => "Conv: " )->pack( -side => "left" ); $frame->Entry( -textvariable => \$oaconv, -width => 4 )->pack( -side => "left" ); # # GridX $frame = $ncont->Frame()->pack( -side => "top", -fill => "x" ); $frame->Label( -text => "Grid Multiplier: " )->pack( -side => "left" ); $frame->Radiobutton( -text => "1", -variable => \$gridx, -value => "1" )->pack( -side => "left" ); $frame->Radiobutton( -text => "2", -variable => \$gridx, -value => "2" )->pack( -side => "left" ); $frame->Radiobutton( -text => "3", -variable => \$gridx, -value => "3" )->pack( -side => "left" ); $frame->Radiobutton( -text => "4", -variable => \$gridx, -value => "4" )->pack( -side => "left" ); # # Color Parameters # $ncont = $note->add( "colors", -label => "Colors", -underline => 0 ); $note->pack( -expand => "yes", -fill => "both", -side => "top" ); $frame = $dial->Frame()->pack( -side => "top", -fill => "x" ); $frame->Button( -text => "OK", -command => sub { $bok=1; } ) ->pack( -side => "left" ); $frame->Button( -text => "Reset", -command => sub { $bok=1; } ) ->pack( -side => "left" ); $frame->Button( -text => "Cancel", -command => sub { $bok=-1; } ) ->pack( -side => "right" ); $dial->grab; $dial->waitVariable( \$bok ); $dial->grabRelease; $dial->destroy; return 0 if $bok == -1; } sub ErrorDialog { my $result = @_; undef $bok; $dial = $widget{main}->Toplevel( -borderwidth => 10, -background => red ); $dial->title( "ptkWXP: Error" ); if( $result == 10 ){ $label = "File not found"; } elsif( $result == 30 ){ $label = "Not data found"; } else { $label = "Exit value: $result"; } $dial->Label( -text => "File not found", -foreground => "white", -background => "red" ) ->pack( -side => "top" ); $wbut1 = $dial->Button( -text => "OK", -command => sub { $bok=1; } ) ->pack( -side => "top" ); $dial->grab; $dial->waitVariable( \$bok ); $dial->grabRelease; $dial->destroy; } sub AddMenuLine { my( $frame, $text, $var ) = @_; $menub = $frame->Menubutton( -text => $text, -relief => "raised", -tearoff => 0, -background => $widget{color}, -foreground => "white", -activebackground => $widget{color}, -activeforeground => "white", -width => 10 ) ->pack( -side => "left" ); $entry = $frame->Entry( -textvariable => $var, -relief => "sunken", -width => 15, -background => $widget{color}, -foreground => "white" ) ->pack( -side => "left" ); return ( $menub, $entry ); } sub AddDropMenu { my( $menub ) = @_; $wmenu1 = $menub->menu->Menu( -tearoff => 0, -background => $widget{color}, -foreground => "white", -activebackground => $widget{color}, -activeforeground => "white" ); return $wmenu1; } sub AddCascade { my( $menu, $text, $cmenu ) = @_; $menu->cascade( -label => $text, -background => $widget{color}, -foreground => "white" ); $menu->entryconfigure( $text, -menu => $cmenu ); } sub AddCommand { my ($menu, $lab, $command ) = @_; $acolor = $widget{color}; $acolor = "black" if $os eq "Win"; $menu->command( -label => $lab, -command => $command, -background => $widget{color}, -foreground => "white", -activebackground => $acolor, -activeforeground => "white" ); } sub GetPlotType { return "cf" if $type eq "cont_fill"; return "ln" if $type eq "cont_line"; return "dln" if $type eq "cont_dash"; return "ndln" if $type eq "cont_neg_dash"; return "gvalue" if $type eq "grid_val"; return "vect" if $type eq "vector"; return "strm" if $type eq "stream"; return $type; } sub AddPlotParam { my( $opt ) = @_; if( $param eq "" ){ $param = $opt; } else { $param = "$param,$opt"; } } ########################### # Setup Command ########################### sub SetupCommand { $ptype = GetPlotType; $lcmd = ""; $param = ""; # # Satellite Data # if( $plot{type1} eq "sat" ){ if( $plot{var} eq "vis" ){ $ftype = "sat_vis_$plot{type2}"; $ftype = "sat_vi4_$plot{type2}" if $plot{type2} eq "ec" || $plot{type2} eq "wc"; $cmd = "xsat -pd=$plot{domain} -if=$ftype"; } elsif( $plot{var} eq "ir" ){ $ftype = "sat_ir_$plot{type2}"; $cmd = "xsat -pd=$plot{domain} -if=$ftype"; } elsif( $plot{var} eq "irenh" ){ $ftype = "sat_ir_$plot{type2}"; $cmd = "xsat -pd=$plot{domain} -if=$ftype -cof=sat_mb.enh"; } elsif( $plot{var} eq "ir3" ){ $ftype = "sat_ir3_$plot{type2}"; $cmd = "xsat -pd=$plot{domain} -if=$ftype"; } elsif( $plot{var} eq "ir12" ){ $ftype = "sat_ir12_$plot{type2}"; $cmd = "xsat -pd=$plot{domain} -if=$ftype"; } elsif( $plot{var} eq "wv" ){ $ftype = "sat_wv_$plot{type2}"; $cmd = "xsat -pd=$plot{domain} -if=$ftype -cof=-0:0,150:0,1-49,210:white"; } $cmd .= " -sp=$bdata/goesw/sat" if $plot{type2} eq "wc"; $cmd .= " -sp=$bdata/spare/sat" if $plot{type2} eq "cf"; } # # Surface Data # elsif( $plot{type1} eq "sfc" ){ if( $plot{type2} eq "sfc" ){ if( $plot{plot} eq "plot_data" ){ $cmd = "sfcwx -pd=$plot{domain} -va=$plot{var}"; $cmd = "$cmd -in=$plot{intrvl}" if $plot{intrvl}; } else { $cmd = "sfccalc -pd=$plot{domain} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } } elsif( $plot{type2} eq "syn" ){ if( $plot{plot} eq "plot_data" ){ $cmd = "sfcwx -if=syn_cvt -cf=syn.cty -pd=$plot{domain} -va=$plot{var}"; $cmd = "$cmd -in=$plot{intrvl}" if $plot{intrvl}; } else { $cmd = "sfccalc -if=syn_cvt -cf=syn.cty -pd=$plot{domain} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } } elsif( $plot{type2} eq "met" ){ $plot{intrvl} = "KPHL" if !$plot{intrvl}; $cmd = "statlog -va=all -nh=-24 -id=$plot{intrvl}"; } elsif( $plot{type2} eq "frt" ){ $cmd = "sfcwx -inp=front -pd=$plot{domain}"; AddPlotParam( "barb" ); } elsif( $plot{type2} eq "forfrt" ){ $cmd = "sfcwx -inp=forfront -ft=$plot{time} -pd=$plot{domain}"; AddPlotParam( "barb" ); } } # # Upper Air Data # elsif( $plot{type1} eq "upa" ){ if( $plot{type2} eq "snd" ){ $plot{intrvl} = "KIAD" if !$plot{intrvl}; $cmd = "uacalplt -id=$plot{intrvl} -pl=$plot{plot}"; } else { if( $plot{plot} eq "plot_data" ){ $cmd = "upairwx -pd=$plot{domain} -le=$plot{level} -va=$plot{var}"; $cmd = "$cmd -in=$plot{intrvl}" if $plot{intrvl}; } else { $cmd = "upcalc -pd=$plot{domain} -le=$plot{level} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } } } # # Radar Data # elsif( $plot{type1} eq "rad" ){ if( $plot{type2} eq "mdr" ){ $cmd = "rad -if=rad_cvt -pd=$plot{domain} -va=$plot{var}"; } elsif( $plot{type2} eq "rcm" ){ $cmd = "rad -if=rcm_cvt -pd=$plot{domain} -va=$plot{var}"; AddPlotParam( "noclar,numplt:3" ); } elsif( $plot{type2} eq "mos" ){ if( $plot{var} eq "bref" ){ $cmd = "xsat -na=wxpmos -pd=$plot{domain}"; } else { $var = "br2" if $plot{var} eq "bref2"; $var = "br4" if $plot{var} eq "bref4"; $var = "et4" if $plot{var} eq "tops"; $var = "r14" if $plot{var} eq "prec1"; $var = "ra4" if $plot{var} eq "prec12"; $var = "rd4" if $plot{var} eq "precd"; $cmd = "rad -na=wmaxmos -if=nids_${var}:i=natmos -pd=$plot{domain}"; } } elsif( $plot{type2} eq "nids" ){ $var = "n0r" if $plot{var} eq "ref1"; $var = "n1r" if $plot{var} eq "ref2"; $var = "n2r" if $plot{var} eq "ref3"; $var = "n3r" if $plot{var} eq "ref4"; $var = "n0z" if $plot{var} eq "ref1+"; $var = "n0v" if $plot{var} eq "vel1"; $var = "n1v" if $plot{var} eq "vel2"; $var = "n2v" if $plot{var} eq "vel3"; $var = "n0s" if $plot{var} eq "srvel1"; $var = "n1s" if $plot{var} eq "srvel2"; $var = "n2s" if $plot{var} eq "srvel3"; $var = "ncr" if $plot{var} eq "cref"; $var = "ncr" if $plot{var} eq "cref+"; $var = "nvl" if $plot{var} eq "vil"; $var = "net" if $plot{var} eq "tops"; $var = "n1p" if $plot{var} eq "prec1"; $var = "n3p" if $plot{var} eq "prec3"; $var = "ntp" if $plot{var} eq "prect"; $cmd = "rad -na=nids -if=nids_${var}:i=$plot{intrvl} -pd=$plot{domain}"; $cmd = "$cmd -cof=miss" if $plot{var} !~ /ref/; $cmd = "$cmd -va=comp" if $plot{var} eq "cref+"; } elsif( $type eq "rad/nldn" ){ $cmd = "light -pd=$plot{domain} -nh=-1 -va=$plot{var}"; } } # # MOS Data # elsif( $plot{type1} eq "mos" ){ if( $plot{type2} eq "ngm" ){ if( $plot{plot} eq "plot_data" ){ $cmd = "fouswx -pd=$plot{domain} -ft=$plot{time} -va=$plot{var}"; $cmd = "$cmd -in=$plot{intrvl}" if $plot{intrvl}; } else { $cmd = "focalc -pd=$plot{domain} -ft=$plot{time} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } } elsif( $plot{type2} eq "avn" ){ if( $plot{plot} eq "plot_data" ){ $cmd = "fouswx -mo=avn -pd=$plot{domain} -ft=$plot{time} -va=$plot{var}"; $cmd = "$cmd -in=$plot{intrvl}" if $plot{intrvl}; } else { $cmd = "focalc -mo=avn -pd=$plot{domain} -ft=$plot{time} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } } elsif( $plot{type2} eq "mrf" ){ if( $plot{plot} eq "plot_data" ){ $cmd = "fouswx -mo=mrf -ho=0 -pd=$plot{domain} -ft=$plot{time} -va=$plot{var}"; $cmd = "$cmd -in=$plot{intrvl}" if $plot{intrvl}; } else { $cmd = "focalc -mo=mrf -ho=0 -pd=$plot{domain} -ft=$plot{time} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } } elsif( $plot{type2} eq "ngmmet" ){ $cmd = "statlog -mo=ngm -va=all -id=$plot{intrvl}"; } elsif( $plot{type2} eq "avnmet" ){ $cmd = "statlog -mo=avn -va=all -id=$plot{intrvl}"; } elsif( $plot{type2} eq "mrfmet" ){ $cmd = "statlog -mo=mrf -ho=0 -va=all -id=$plot{intrvl}"; } } # # Model Data # elsif( $plot{type1} eq "grb" ){ $cmd = "grbcalc -mo=$plot{type2} -pd=$plot{domain} -ft=$plot{time} -le=$plot{level} -va=$plot{var} -pl=$ptype -in=$plot{intrvl}"; } # # Parameters # $wtitle = "$plot{type}"; $wtitle = $param{utitle} if $param{utitle}; $wtitle =~ s/\//-/; $cmd = "$cmd -ge=$wgeom" if $wgeom; $cmd = "$cmd -de=$device" if $device; $cmd = "$cmd -la=$labels" if $labels; $cmd = "$cmd -me=$mess" if $mess; AddPlotParam( "tz:$tzone" ) if $tzone; AddPlotParam( "bar" ) if $contbar; AddPlotParam( "inv" ) if $invplt; AddPlotParam( "full" ) if $fullplt; AddPlotParam( "lalo:5" ) if $lalo; $cmd = "$cmd -cp=$cpath" if $cpath; $cmd = "$cmd -dp=$dpath" if $dpath; $cmd = "$cmd -mp=$mpath" if $mpath; $cmd = "$cmd -tp=$tpath" if $tpath; $cmd = "$cmd -sp=$spath" if $spath; $cmd = "$cmd -inp=$intype" if $intype; $cmd = "$cmd -if=$infile" if $infile; $cmd = "$cmd -of=$outfile" if $outfile; $cmd = "$cmd -nh=$numhour" if $numhour; $cmd = "$cmd -ho=$fhour" if $fhour; # # Loop # if( $plot{loop} ){ $lcmd = "-nh=-3" if $plot{type1} eq "sat"; $lcmd = "-nh=-4" if $plot{type1} eq "sfc"; $lcmd = "-nh=-24" if $plot{type} eq "sfc/frt"; $lcmd = "-nh=-24" if $plot{type1} eq "upa"; $lcmd = "-nh=-6" if $plot{type} eq "rad/mdr"; $lcmd = "-nh=-3" if $plot{type} eq "rad/rcm"; $lcmd = "-nh=-1" if $plot{type} eq "rad/mos"; $lcmd = "-ft=12h,24h,36h,48h" if $plot{type} eq "mos/ngm"; $lcmd = "-ft=12h,24h,36h,48h" if $plot{type} eq "mos/avn"; $lcmd = "-ft=1d,2d,3d,4d,5d" if $plot{type} eq "mos/mrf"; $lcmd = "-ft=12h,24h,36h,48h" if $plot{type1} eq "grb"; $lcmd = "-ft=12h,24h,36h,48h,60h" if $plot{type} =~ /grb\/eta/; $lcmd = "-ft=12h,24h,36h,48h,60h,72h" if $plot{type} =~ /grb\/avn/; $lcmd = "-ft=1d,2d,3d,4d,5d" if $plot{type} =~ /grb\/mrf/; $lcmd = "-ft=1d,2d,3d,4d,5d" if $plot{type} eq "grb/ecmwf"; $lcmd = "-ft=3h,6h,9h,12h" if $plot{type} eq "grb/ruc"; } # # Draw $draw = ""; $draw = "$draw,-text" if !$param{draw_text}; $draw = "$draw,-data" if !$param{draw_data}; $draw = "$draw,-sum" if !$param{draw_sum}; $draw = "$draw,-map" if !$param{draw_map}; $draw = "$draw,-bord" if !$param{draw_bord}; $draw = "$draw,-text_ul" if !$param{draw_textul}; $draw = "$draw,-text_ur" if !$param{draw_textur}; $draw = "$draw,-text_ll" if !$param{draw_textll}; $draw = "$draw,-text_lr" if !$param{draw_textlr}; $draw =~ s/^,//; $cmd = "$cmd -dr=$draw" if $draw; $cmd = "$cmd -sc=$pscale" if $pscale; $cmd = "$cmd -ba $lcmd -pp=$param -ti=$wtitle $plot{file}"; $cmd = "$binpath$S$cmd -df=$default"; return $cmd; } ########################### # Run procedure ########################### sub Run { $cmd = SetupCommand; print "$cmd\n"; $str = $cmd; $str =~ s/$binpath//; $str = "Running: " . substr( $cmd, 0, 25 ) . "..."; $statusbar->configure( -text => $str ); $text = `$cmd`; $status = $? >> 8; print "Status: $status\nOutput: $text\n"; if( $status != 0 ){ ErrorDialog $status; } } sub read_resrc { $default = $ENV{wxpdefault} if $ENV{wxpdefault}; print "$default\n"; open RESRC, "$default/wxp.def" if -e "$default/wxp.def"; open RESRC, "$default/wxp.cfg" if -e "$default/wxp.cfg"; open RESRC, "$default/.wxpdef" if -e "$default/.wxpdef"; open RESRC, "$default/Wxp.res" if -e "$default/Wxp.res"; while( ){ next if /^#/; if( /^([a-z._\*]+):\s+(.+)/ ){ $tag = $1; $val = $2; if( $tag =~ /^$prog.(.+)/ ){ $resrc{$1} = $val; } elsif( $tag =~ /^\*(.+)/ ){ $resrc{$1} = $val; } } } close RESRC; foreach ( keys %resrc ){ print "$_ = $resrc{$_}\n"; } } sub comline { my( $tag ) = @_; for( $i = 0; $i <= $#ARGV; $i++ ){ if( $ARGV[$i] =~ /^-$tag=(.+)/ ){ return $1; } if( $ARGV[$i] eq "-$tag" ){ return $ARGV[$i+1]; } } return undef; } ################################################################### # Main Program ################################################################### $os = $^O; $os = "Win" if $^O eq "MSWin32"; $S = "/"; $S = "\\" if $os eq "Win"; $default = comline( "df" ) if comline( "df" ); $prog = "ptkwxp"; read_resrc; $binpath = "/home/wxp/bin"; $binpath = $resrc{bin_path} if $resrc{bin_path}; ResetAll; $widget{main} = MainWindow->new; $widget{main}->title( "ptkWXP: $type" ); $widget{main}->geometry( "+10+10" ); #------------------------------------------------------------------ # Header Bar # $bar = $widget{main}->Frame->pack( -side => "top", -fill => "x" ); $widget{run} = $bar->Button( -text => "Run", -command => \&Run ) ->pack( -side => "left" ); $widget{option} = $bar->Menubutton( -text => "Option", -tearoff => 0, -foreground => "black" ) ->pack( -side => "left" ); $widget{option}->command( -label => "Plot", -command => \&PlotDialog ); $widget{option}->command( -label => "Map", -command => \&MapDialog ); $widget{quit} = $bar->Button( -text => "Quit", -command => sub { exit } ) ->pack( -side => "right" ); #------------------------------------------------------------------ # Domain # $widget{color} = "#4040c0"; $widget{domain} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{domain_menu}, $widget{domain_entry} ) = AddMenuLine( $widget{domain}, "Domain", \$plot{domain} ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "US", sub { $plot{domain}="us" } ); AddCommand( $menu, "New Eng", sub { $plot{domain}="ne" } ); AddCommand( $menu, "Mid Atl", sub { $plot{domain}="at" } ); AddCommand( $menu, "SE", sub { $plot{domain}="se" } ); AddCommand( $menu, "MidWest", sub { $plot{domain}="mw" } ); AddCommand( $menu, "Cen Pln", sub { $plot{domain}="cp" } ); AddCommand( $menu, "Sth Pln", sub { $plot{domain}="sp" } ); AddCommand( $menu, "NW", sub { $plot{domain}="nw" } ); AddCommand( $menu, "SW", sub { $plot{domain}="sw" } ); AddCommand( $menu, "AK", sub { $plot{domain}="ak" } ); AddCommand( $menu, "HI", sub { $plot{domain}="hi" } ); AddCascade( $widget{domain_menu}, "US", $menu ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "N Amer", sub { $plot{domain}="namer" } ); AddCommand( $menu, "Canada", sub { $plot{domain}="canada" } ); AddCommand( $menu, "W Canada", sub { $plot{domain}="wcan" } ); AddCommand( $menu, "E Canada", sub { $plot{domain}="ecan" } ); AddCommand( $menu, "N Canada", sub { $plot{domain}="ncan" } ); AddCommand( $menu, "Mexico", sub { $plot{domain}="mex" } ); AddCommand( $menu, "Carib", sub { $plot{domain}="carib" } ); AddCommand( $menu, "C Amer", sub { $plot{domain}="camer" } ); AddCascade( $widget{domain_menu}, "N Amer", $menu ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "S Amer", sub { $plot{domain}="samer" } ); AddCommand( $menu, "Brazil", sub { $plot{domain}="brazil" } ); AddCommand( $menu, "Argent", sub { $plot{domain}="argent" } ); AddCascade( $widget{domain_menu}, "S Amer", $menu ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "Europe", sub { $plot{domain}="europe" } ); AddCommand( $menu, "WC Europe", sub { $plot{domain}="wc_eur" } ); AddCommand( $menu, "N Europe", sub { $plot{domain}="n_eur" } ); AddCommand( $menu, "NE Europe", sub { $plot{domain}="ne_eur" } ); AddCommand( $menu, "SW Europe", sub { $plot{domain}="sw_eur" } ); AddCommand( $menu, "SC Europe", sub { $plot{domain}="sc_eur" } ); AddCommand( $menu, "SE Europe", sub { $plot{domain}="se_eur" } ); AddCascade( $widget{domain_menu}, "Europe", $menu ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "E Asia", sub { $plot{domain}="easia" } ); AddCommand( $menu, "SE Asia", sub { $plot{domain}="seasia" } ); AddCommand( $menu, "N Asia", sub { $plot{domain}="nasia" } ); AddCommand( $menu, "W Asia", sub { $plot{domain}="wasia" } ); AddCommand( $menu, "Japan", sub { $plot{domain}="japan" } ); AddCommand( $menu, "SE China", sub { $plot{domain}="se_chn" } ); AddCommand( $menu, "Mid East", sub { $plot{domain}="wasia" } ); AddCascade( $widget{domain_menu}, "Asia", $menu ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "N Africa", sub { $plot{domain}="nafr" } ); AddCommand( $menu, "S Africa", sub { $plot{domain}="safr" } ); AddCascade( $widget{domain_menu}, "Africa", $menu ); $menu = AddDropMenu( $widget{domain_menu} ); AddCommand( $menu, "Australia", sub { $plot{domain}="aust" } ); AddCommand( $menu, "W Pacific", sub { $plot{domain}="wpac" } ); AddCommand( $menu, "Arctic", sub { $plot{domain}="arc" } ); AddCommand( $menu, "Antarctica", sub { $plot{domain}="antarc" } ); AddCommand( $menu, "Globe", sub { $plot{domain}="globe" } ); AddCommand( $menu, "N Hem", sub { $plot{domain}="nhem" } ); AddCommand( $menu, "S Hem", sub { $plot{domain}="shem" } ); AddCascade( $widget{domain_menu}, "Misc", $menu ); AddCommand( $widget{domain_menu}, "User Def..", \&Domain ); $widget{domain_check} = $widget{domain}->Checkbutton( -text => "LatLon", -variable => \$lalo, -background => $widget{color}, -foreground => "white", -selectcolor => $widget{color}, -activebackground => $widget{color}, -activeforeground => "white" ) ->pack( -side => "right" ); #------------------------------------------------------------------ # Type # $widget{color} = "#40c0c0"; $widget{type} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{type_menu}, $widget{type_entry} ) = AddMenuLine( $widget{type}, "Type", \$plot{type} ); # Satellite $menu = AddDropMenu( $widget{type_menu} ); AddCommand( $menu, "Nat Comp", [ \&SetType, "sat/nc", 0 ] ); AddCommand( $menu, "N Hem", [ \&SetType, "sat/nh", 0 ] ); AddCommand( $menu, "N Hem+", [ \&SetType, "sat/cf", 0 ] ); AddCommand( $menu, "E CONUS", [ \&SetType, "sat/ec", 0 ] ); AddCommand( $menu, "W CONUS", [ \&SetType, "sat/wc", 0 ] ); AddCommand( $menu, "Alaska", [ \&SetType, "sat/an", 0 ] ); AddCommand( $menu, "Hawaii", [ \&SetType, "sat/hn", 0 ] ); AddCommand( $menu, "Puerto Rico", [ \&SetType, "sat/pn", 0 ] ); AddCascade( $widget{type_menu}, "Satellite", $menu ); $menu = AddDropMenu( $widget{type_menu} ); AddCommand( $menu, "Surface", [ \&SetType, "sfc/sfc", 0 ] ); AddCommand( $menu, "Synoptic", [ \&SetType, "sfc/syn", 0 ] ); AddCommand( $menu, "Metgram", [ \&SetType, "sfc/met", 0 ] ); AddCommand( $menu, "Front", [ \&SetType, "sfc/frt", 0 ] ); AddCommand( $menu, "Fore Front", [ \&SetType, "sfc/forfrt", 0 ] ); AddCascade( $widget{type_menu}, "Surface", $menu ); $menu = AddDropMenu( $widget{type_menu} ); AddCommand( $menu, "Upper Air", [ \&SetType, "upa/upa", 0 ] ); AddCommand( $menu, "Soundings", [ \&SetType, "upa/snd", 0 ] ); AddCascade( $widget{type_menu}, "Upper Air", $menu ); $menu = AddDropMenu( $widget{type_menu} ); AddCommand( $menu, "RCM", [ \&SetType, "rad/rcm", 0 ] ); AddCommand( $menu, "MDR", [ \&SetType, "rad/mdr", 0 ] ); AddCommand( $menu, "Mosaic", [ \&SetType, "rad/mos", 0 ] ); AddCommand( $menu, "NIDS", [ \&SetType, "rad/nids", 0 ] ); AddCommand( $menu, "NLDN", [ \&SetType, "rad/nldn", 0 ] ); AddCascade( $widget{type_menu}, "Radar", $menu ); $menu = AddDropMenu( $widget{type_menu} ); AddCommand( $menu, "NGM Surface", [ \&SetType, "mos/ngm", 0 ] ); AddCommand( $menu, "AVN Surface", [ \&SetType, "mos/avn", 0 ] ); AddCommand( $menu, "MRF Surface", [ \&SetType, "mos/mrf", 0 ] ); AddCommand( $menu, "NGM Metgram", [ \&SetType, "mos/ngmmet", 0 ] ); AddCommand( $menu, "AVN Metgram", [ \&SetType, "mos/avnmet", 0 ] ); AddCommand( $menu, "MRF Metgram", [ \&SetType, "mos/mrfmet", 0 ] ); AddCascade( $widget{type_menu}, "MOS", $menu ); $menu = AddDropMenu( $widget{type_menu} ); AddCommand( $menu, "Eta", [ \&SetType, "grb/eta", 0 ] ); AddCommand( $menu, "Eta2", [ \&SetType, "grb/eta2", 0 ] ); AddCommand( $menu, "NGM", [ \&SetType, "grb/ngm", 0 ] ); AddCommand( $menu, "RUC", [ \&SetType, "grb/ruc", 0 ] ); AddCommand( $menu, "RUC4", [ \&SetType, "grb/ruc4", 0 ] ); AddCommand( $menu, "AVN/US", [ \&SetType, "grb/avn_us", 0 ] ); AddCommand( $menu, "AVN/NAmer", [ \&SetType, "grb/avn_na", 0 ] ); AddCommand( $menu, "AVN/NHem", [ \&SetType, "grb/avn_nh", 0 ] ); AddCommand( $menu, "AVN/Globe", [ \&SetType, "grb/avn", 0 ] ); AddCommand( $menu, "MRF/NAmer", [ \&SetType, "grb/mrf_na", 0 ] ); AddCommand( $menu, "MRF/NHem", [ \&SetType, "grb/mrf_nh", 0 ] ); AddCommand( $menu, "MRF/Globe", [ \&SetType, "grb/mrf", 0 ] ); AddCommand( $menu, "UKMET", [ \&SetType, "grb/ukmet", 0 ] ); AddCommand( $menu, "ECMWF", [ \&SetType, "grb/ecmwf", 0 ] ); AddCascade( $widget{type_menu}, "Model", $menu ); #------------------------------------------------------------------ # File # $widget{color} = "#40c040"; $widget{file} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{file_menu}, $widget{file_entry} ) = AddMenuLine( $widget{file}, "File", \$plot{file} ); AddCommand( $widget{file_menu}, "la", sub { $plot{file}="la" } ); AddCommand( $widget{file_menu}, "cu", sub { $plot{file}="cu" } ); $menu = AddDropMenu( $widget{file_menu} ); AddCommand( $menu, "-1", sub { $plot{file}="cu-1" } ); AddCommand( $menu, "-2", sub { $plot{file}="cu-2" } ); AddCommand( $menu, "-3", sub { $plot{file}="cu-3" } ); AddCommand( $menu, "-4", sub { $plot{file}="cu-4" } ); AddCommand( $menu, "-6", sub { $plot{file}="cu-6" } ); AddCommand( $menu, "-12", sub { $plot{file}="cu-12" } ); AddCommand( $menu, "-24", sub { $plot{file}="cu-24" } ); AddCascade( $widget{file_menu}, "Prev..", $menu ); AddCommand( $widget{file_menu}, "File..", \&GetFile ); #------------------------------------------------------------------ # Time # $widget{color} = "#c0c040"; $widget{time} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{time_menu}, $widget{time_entry} ) = AddMenuLine( $widget{time}, "Time", \$plot{time} ); SetupTimeMenu( "init", "6hr", "12hr", "18hr", "24hr", "30hr", "36hr", "42hr", "48hr", "60hr", "72hr", "3.5day", "4day", "4.5day", "5day", "5.5day", "6day", "6.5day", "7day", "7.5day", "8day", "8.5day", "9day", "9.5day", "10day" ); #------------------------------------------------------------------ # Level # $widget{color} = "#c08040"; $widget{level} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{level_menu}, $widget{level_entry} ) = AddMenuLine( $widget{level}, "Level", \$plot{level} ); SetupLevelMenu( "sfc", "1000mb", "925mb", "850mb", "700mb", "500mb", "400mb", "300mb", "250mb", "200mb", "150mb", "100mb", "70mb", "50mb", "30mb", "20mb", "10mb", "280k", "300k", "320k", "340k", "trop", "wind", "snd" ); #------------------------------------------------------------------ # Variable # $widget{color} = "#c04040"; $widget{var} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{var_menu}, $widget{var_entry} ) = AddMenuLine( $widget{var}, "Variable", \$plot{var} ); SetupVarMenu( "all", "temp", "dewp", "wdir", "wspd", "wgst", "wbrb", "slp", "alt", "wx", "vis", "cldcl", "cldcv", "ptend", "prec24", "maxt", "mint", "snwdp", "wchill", "heat", "rhum", "epot" ); #------------------------------------------------------------------ # Plot type # $widget{color} = "#c040c0"; $widget{plot} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{plot_menu}, $widget{plot_entry} ) = AddMenuLine( $widget{plot}, "Plot", \$plot{plot} ); SetupPlotMenu( "default", "plot_data", "cont_fill", "cont_line", "cont_dash", "cont_neg_dash", "grid_val", "vector", "stream" ); $widget{plot_check} = $widget{plot}->Checkbutton( -text => Loop, -variable => \$plot{loop}, -background => $widget{color}, -foreground => "white", -selectcolor => $widget{color}, -activebackground => $widget{color}, -activeforeground => "white" ) ->pack( -side => "right" ); #------------------------------------------------------------------ # Ident/Interval # $widget{color} = "#404040"; $widget{int} = $widget{main}->Frame( -background => $widget{color} ) ->pack( -side => "top", -fill => "x" ); ($widget{int_menu}, $widget{int_entry} ) = AddMenuLine( $widget{int}, "Interval", \$plot{intrvl} ); AddCommand( $widget{int_menu}, "default", [ \&SetInt, "default" ] ); #------------------------------------------------------------------ # Status bar # $statusbar = $widget{main}->Label( -relief => "sunken", -borderwidth => 1, -width => 30, -justify => "left" ) ->pack( -side => "top", -fill => "x" ); #------------------------------------------------------------------ # Tooltips, balloons # $balloon = $widget{main}->Balloon( -statusbar => $statusbar ); $balloon->attach( $widget{domain_entry}, -msg => "Enter user defined domain specs\nproj,clat,clon,dx" ); #------------------------------------------------------------------ # Initialize state # SetupState( "-level", "-time", "+var", "+plot", "+int" ); SetType( $plot{type} ); SetFilter( ); MainLoop;