<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.17095" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>Hi Clay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>(I was typing when I saw Jeffrey's note .. so modified my
answer but ...)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>Its like he said - you don't need the "set rbrange" for
what you want.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>The only reason I use my make_clevs.gs script is because I
often want to programatically determine the clevs based upon "whatever" ..
rather than hard-code it. And .. even if I was hardcoding - I don't like
having to type in a huge</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>number of entries.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>I almost never use ccols because I define my own colours
and do a 'set rbcols' at the beginning so I have my own rainbow
colours.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>I do what Jeffrey has when I have clevs that are not
equally spaced (such as for precipitation amounts) and when the colours don't
vary smoothly (so I have to pick-and-choose discrete numbers from my defined
colours rather than letting GrADS default to the rainbow
colours).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2>I've attached my "setup.gs" script which does the 'set
rbcols' and a slightly fiddled version of the grads-script-library
"colors.gs" (fiddled only to give the colours I want). I execute this
script just once .. before any other scripts that use my "standard"
colour table. If I want to change colour tables .. I have other files that
assign the rgb values and do the rbcols in a similar fashion (like when
I need grey-scale imagery).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN><SPAN class=534041216-23032011><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=534041216-23032011></SPAN><FONT face=Arial
color=#0000ff size=2><SPAN class=534041216-23032011>For animation -- I have a
couple of scripts that are similar to the standard xanim.gs - but use widgets
instead of the keyboard to control the animation (eg .. step forward or
back). I can send you those if you want .. but it might only confuse you
more.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=534041216-23032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=534041216-23032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=534041216-23032011>ron</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=534041216-23032011></SPAN></FONT> </DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> gradsusr-bounces@gradsusr.org
[mailto:gradsusr-bounces@gradsusr.org] <B>On Behalf Of </B>Clay
Blankenship<BR><B>Sent:</B> March 23, 2011 9:43 AM<BR><B>To:</B> GrADS Users
Forum<BR><B>Subject:</B> Re: [gradsusr] Setting color bar for
animation<BR></FONT><BR></DIV>
<DIV></DIV>OK, from the command line I can use make_clevs to specify any range
of levels and plot and get the color bar. But both of my scripts dd.gs (a
script to plot, specify a range, and make a color bar) and ani.gs (animation) do
not plot the full color bar when I specify the range with script arguments.
I can't figure out what's going on...
<DIV><BR></DIV>
<DIV>Also, I am still looking for a way to display the current ccols and clevs.
Do you have to use 'q shades'?</DIV>
<DIV><BR></DIV>
<DIV>One more thing, this animation script regulates its speed by redrawing the
plot a certain number of times; is there a better way to do that?</DIV>
<DIV><BR></DIV>
<DIV>Thanks,</DIV>
<DIV>Clay</DIV>
<DIV><BR></DIV>
<DIV>****dd.gs***********</DIV>
<DIV>
<DIV>function dd (args)</DIV>
<DIV>*Plot a variable and its color scale.</DIV>
<DIV>* dd variable [ -cmin minimum value ]</DIV>
<DIV>* [ -cmax maximum value ]</DIV>
<DIV>* [ -cint color scale ]</DIV>
<DIV><BR></DIV>
<DIV>variable=subwrd(args,1)</DIV>
<DIV><BR></DIV>
<DIV>ccint=''</DIV>
<DIV>ccmin=''</DIV>
<DIV>ccmax=''</DIV>
<DIV>string=''</DIV>
<DIV>space=' '</DIV>
<DIV>n=2</DIV>
<DIV><BR></DIV>
<DIV>while(n<9)</DIV>
<DIV>idx=subwrd(args,n)</DIV>
<DIV>opt=subwrd(args,n+1)</DIV>
<DIV>if(idx='');break;endif</DIV>
<DIV>if(idx='-cint');ccint=opt;endif</DIV>
<DIV>if(idx='-cmin');ccmin=opt;endif</DIV>
<DIV>if(idx='-cmax');ccmax=opt;endif</DIV>
<DIV>if(idx='-string');string=opt;endif</DIV>
<DIV>n=n+2</DIV>
<DIV>endwhile</DIV>
<DIV><BR></DIV>
<DIV>'c'</DIV>
<DIV>'set gxout shaded'</DIV>
<DIV>if(ccint!=''); 'set cint 'ccint;endif</DIV>
<DIV>if(ccmin!=''); 'set cmin 'ccmin;endif</DIV>
<DIV>if(ccmax!=''); 'set cmax 'ccmax;endif</DIV>
<DIV>if(ccmin!=''); if(ccmax!=''); 'set rbrange 'ccmin ' 'ccmax;
endif;endif</DIV>
<DIV><BR></DIV>
<DIV>*CBB 3/22/11 set the levels</DIV>
<DIV>'make_clevs ' cmin cmax cint</DIV>
<DIV>
<DIV>'d 'variable</DIV>
<DIV><BR></DIV>
<DIV>*Add date and user-input string</DIV>
<DIV>'q time'</DIV>
<DIV>say result</DIV>
<DIV>cctime=subwrd(result,3)</DIV>
<DIV>coln=substr(cctime,3,1)</DIV>
<DIV>if coln = ':'</DIV>
<DIV>dmy =substr(cctime,7,9)</DIV>
<DIV>else</DIV>
<DIV>dmy =substr(cctime,1,12)</DIV>
<DIV>day =substr(cctime,1,3)</DIV>
<DIV>my =substr(cctime,4,9)</DIV>
<DIV><BR></DIV>
<DIV>*dmy =substr(cctime,4,9) *cbb changed </DIV>
<DIV>endif</DIV>
<DIV><BR></DIV>
<DIV>* 'draw title 'dmy space string</DIV>
<DIV> 'draw title 'day space my space string</DIV>
<DIV><BR></DIV>
<DIV>'q shades' </DIV>
<DIV><BR></DIV>
<DIV>'cbar2' </DIV>
<DIV><BR></DIV></DIV>
<DIV>****END***********</DIV>
<DIV><BR></DIV>
<DIV>***ani.gs************</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>* Display animation </DIV>
<DIV>* ga> run ani variable [ -I slowness (default=10) ]</DIV>
<DIV>*
[ -cint, -ci contour interval ]</DIV>
<DIV>*
[ -cmin, -mn minimum contour level ]</DIV>
<DIV>*
[ -cmax, -mx maximum contour level ]</DIV>
<DIV>* ex. ga> run ani t-t.2 -ci 0.1 -mn -0.5 -I 5 -cmax 0.3</DIV>
<DIV>* >>>> plot (t-t.2) with
slowness=5, contour_interval=0.1</DIV>
<DIV>* minimum contour
level=-0.5, maximum contour level=0.3</DIV>
<DIV>*</DIV>
<DIV>*
Nov. 9, 1999 Masami Nonaka</DIV>
<DIV>*</DIV>
<DIV>function ani (args)</DIV>
<DIV><BR></DIV>
<DIV>variable=subwrd(args,1)</DIV>
<DIV><BR></DIV>
<DIV>slow=''</DIV>
<DIV>ccint=''</DIV>
<DIV>ccmin=''</DIV>
<DIV>ccmax=''</DIV>
<DIV>cbar=''</DIV>
<DIV>n=2</DIV>
<DIV><BR></DIV>
<DIV>while(n<10000)</DIV>
<DIV>idx=subwrd(args,n)</DIV>
<DIV>opt=subwrd(args,n+1)</DIV>
<DIV>if(idx='');break;endif</DIV>
<DIV>if(idx='-I');slow=opt;endif</DIV>
<DIV>if(idx='-Int');slow=opt;endif</DIV>
<DIV>if(idx='-cint');ccint=opt;endif</DIV>
<DIV>if(idx='-cmin');ccmin=opt;endif</DIV>
<DIV>if(idx='-cmax');ccmax=opt;endif</DIV>
<DIV>if(idx='-ci');ccint=opt;endif</DIV>
<DIV>if(idx='-mn');ccmin=opt;endif</DIV>
<DIV>if(idx='-mx');ccmax=opt;endif</DIV>
<DIV>n=n+2</DIV>
<DIV>endwhile</DIV>
<DIV><BR></DIV>
<DIV>defaultslow=10</DIV>
<DIV>if(slow=''); slow=defaultslow;endif</DIV>
<DIV><BR></DIV>
<DIV>'q dims'</DIV></DIV>
<DIV>
<DIV>
<DIV>
<DIV> say result</DIV>
<DIV>aline=sublin(result,5)</DIV>
<DIV>cctime1=subwrd(aline,11)</DIV>
<DIV>cctime2=subwrd(aline,13)</DIV>
<DIV>tmin=substr(cctime1,1,9)</DIV>
<DIV>tmax=substr(cctime2,1,9)</DIV>
<DIV>it=tmin</DIV>
<DIV>'set dbuff on'</DIV>
<DIV>while (it <=tmax)</DIV>
<DIV> 'set t 'it</DIV>
<DIV>i=0</DIV>
<DIV>while (i <slow)</DIV>
<DIV>if(ccint!=''); 'set cint 'ccint;endif</DIV>
<DIV>if(ccmin!=''); 'set cmin 'ccmin;endif</DIV>
<DIV>if(ccmax!=''); 'set cmax 'ccmax;endif</DIV>
<DIV>if(ccmin!=''); if(ccmax!=''); 'set rbrange 'ccmin ' 'ccmax;
endif;endif</DIV>
<DIV><BR></DIV>
<DIV>*CBB 3/22/11 setting max min clevs</DIV>
<DIV>'make_clevs ' cmin cmax cint</DIV>
<DIV><BR></DIV>
<DIV> 'display 'variable</DIV>
<DIV><BR></DIV>
<DIV> 'run date.gs'</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV> 'query shades'</DIV>
<DIV>shdinfo = result</DIV>
<DIV>if(subwrd(shdinfo,1)!='None');'run fcbar.gs';endif</DIV>
<DIV><BR></DIV>
<DIV>'swap'</DIV>
<DIV>i=i+1</DIV>
<DIV>endwhile</DIV>
<DIV> it=it+1</DIV>
<DIV>endwhile</DIV>
<DIV> 'set t ' tmin ' ' tmax</DIV></DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>
<DIV>****END***********</DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV></DIV>
<DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR>
<DIV>
<DIV>On Mar 22, 2011, at 5:23 PM, Goodson,Ron [Edm] wrote:</DIV><BR
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite">
<DIV
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011>I see in my original note I mislead you .. when I
said I do my make_clevs.gs before cbar. As was noted by Jeffrey . the
settings of clevs, ccols (all that stuff) must happen before the display of
the variable. So swap those two lines of "display" and
"make_clevs".</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011>The other thing I usually do right at the start of my
programs (and only has to be done once .. unlike settings clevs, ccols which
must be done before each display) is to setup some custom colours
through "set rgb" (one entrie per colour) and rbcols (to set the order of the
colours). You don't need to do this if you are using the GrADS
standard scheme of 16 colours.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=015501622-22032011>ron</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> gradsusr-bounces@gradsusr.org [<A
href="mailto:gradsusr-bounces@gradsusr.org">mailto:gradsusr-bounces@gradsusr.org</A>]
<B>On Behalf Of </B>Clay Blankenship<BR><B>Sent:</B> March 22, 2011 4:05
PM<BR><B>To:</B> GrADS Users Forum<BR><B>Subject:</B> Re: [gradsusr] Setting
color bar for animation<BR></FONT><BR></DIV>
<DIV></DIV>OK, that make_clevs works for me when I do a simple 'd' on my
variable, but when I try to use a little fancier script (not even an
animation, just trying to pass the range on the command line), I lose the min
and max values.
<DIV><BR></DIV>
<DIV>If I do:</DIV>
<DIV><BR></DIV>
<DIV>c</DIV>
<DIV>make_clevs 0 2 0.2</DIV>
<DIV>d soilwat5</DIV>
<DIV>cbar</DIV>
<DIV><BR></DIV>
<DIV>I get a colorbar from 0 to 2 in steps of .2, even though the variable
range is 0 to 1 (so far, so good).</DIV>
<DIV><BR></DIV>
<DIV>If I do:</DIV>
<DIV> </DIV>
<DIV>dd soilwat5 -cmin 0 -cmax 2 -cint 0.2</DIV>
<DIV><BR></DIV>
<DIV>I get a colorbar from 0 to 1 in steps of 0.2. The colors are the
same for the different ranges, it just doesn't show the ones above 1. Is
this because clevs are set and ccols are not? I was hoping ccols would
get set automatically like it does when you don't specify levels.</DIV>
<DIV><BR></DIV>
<DIV>This happens whether or not I use the make_clevs line in the following
script.</DIV>
<DIV><BR></DIV>
<DIV>BTW, this seems really basic, but I can't figure out how to see the
current values of ccols and clevs.</DIV>
<DIV>cbar is getting its ccols and clevs from 'q shades', but it doesn't
react to ccols and clevs until a plot has been made.</DIV>
<DIV><BR></DIV>
<DIV>Script follows.</DIV>
<DIV><BR></DIV>
<DIV>Thanks for the help,</DIV>
<DIV>Clay</DIV>
<DIV><BR></DIV></DIV><BR></BLOCKQUOTE></DIV><BR>
<DIV apple-content-edited="true"><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><SPAN
class=Apple-style-span
style="WORD-SPACING: 0px; FONT: medium Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><SPAN
class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Monaco; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><SPAN
class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Monaco; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<DIV
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV>
<DIV>
<DIV>
<DIV>-- </DIV>
<DIV>Clay Blankenship *
USRA Research Scientist</DIV></DIV>
<DIV>
<DIV>
<DIV>
<DIV><A
href="mailto:clay.b.blankenship@nasa.gov">clay.b.blankenship@nasa.gov</A>
* 256-961-7638</DIV></DIV></DIV></DIV>
<DIV>320 Sparkman Drive *
Huntsville, AL 35805 USA</DIV></DIV></DIV>
<DIV>National Space Science and Technology Center at
NASA-MSFC/UAH</DIV><BR></DIV></SPAN><BR
class=Apple-interchange-newline></DIV></SPAN><BR
class=Apple-interchange-newline></DIV></SPAN><BR
class=Apple-interchange-newline></DIV></SPAN><BR
class=Apple-interchange-newline></DIV><BR></DIV></DIV></BODY></HTML>