<pre>Clay,<br>In your original thread post, you asked how to plot a consistent range and set of colors for each time slice of data you want to<br>display.  Is that correct?  If so, then all you need to do is use the &quot;set clevs&quot; and &quot;set ccols&quot; commands before you display the<br>
data.  Unless you want to adjust the range of contours and colors so that they fit the maximum and minimum value in the domain<br>each time you display data, then it really is that simple.  Simple code to do this would be:<br>
<br>&#39;set dbuff on&#39;<br>t = 1<br>&#39;set gxout shaded&#39;<br>while (t &lt;= 5)<br>  &#39;set t &#39;t<br>  &#39;draw title Temperature&#39;<br>  &#39;set clevs A B C D E F G H I ...&#39;<br>  &#39;set ccols 17 18 29 20 21 22 23 ...&#39;<br>
  &#39;d t&#39;  <br>  &#39;cbar&#39;<br>  &#39;swap&#39;<br>  t = t + 1<br>endwhile<br><br>This example assumes you have defined color numbers 17, 18, 19, ... and so on using the &quot;set rgb&quot; command prior to this section<br>
of code.  It might be easier just to write a separate script file that defines the colors, then issues the &quot;set clevs&quot; and <br>&quot;set ccols&quot; command.  Then you could replace some of the code above with something like<br>
<br>&#39;set dbuff on&#39;<br>t = 1<br>&#39;set gxout shaded&#39;<br>while (t &lt;= 5)<br>  &#39;set t &#39;t<br>  &#39;draw title Temperature&#39;<br>  &#39;run <a href="http://mycolorscript.gs">mycolorscript.gs</a>&#39;<br>
  &#39;d t&#39;  <br>  &#39;cbar&#39;<br>  &#39;swap&#39;<br>  t = t + 1<br>endwhile<br><br>where you created the script called <a href="http://mycolorscript.gs">mycolorscript.gs</a>.  I have sample animated gifs stored at <a href="http://www.meteor.iastate.edu/~jdduda/sfc_div.gif">http://www.meteor.iastate.edu/~jdduda/sfc_div.gif</a><br>
and <a href="http://www.meteor.iastate.edu/~jdduda/radar3.gif">http://www.meteor.iastate.edu/~jdduda/radar3.gif</a> that show how I used those command lines and a while loop to create the<br>frames necessary for an animation, then used gifsicle to make the animated gif.  Gifsicle is another way to make animations, <br>
but you have to use it outside of Grads, and you&#39;d need to make the images first (i.e., the frames of the animation).<br><br>I hope this clarifies things.<br><br>Jeff Duda<br></pre><br><div class="gmail_quote">On Wed, Mar 23, 2011 at 10:42 AM, Clay Blankenship <span dir="ltr">&lt;<a href="mailto:clay.b.blankenship@nasa.gov">clay.b.blankenship@nasa.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;">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 <a href="http://dd.gs" target="_blank">dd.gs</a> (a script to plot, specify a range, and make a color bar) and <a href="http://ani.gs" target="_blank">ani.gs</a> (animation) do not plot the full color bar when I specify the range with script arguments.  I can&#39;t figure out what&#39;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 &#39;q shades&#39;?</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>****<a href="http://dd.gs" target="_blank">dd.gs</a>***********</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=&#39;&#39;</div>
<div>ccmin=&#39;&#39;</div><div>ccmax=&#39;&#39;</div><div>string=&#39;&#39;</div><div>space=&#39; &#39;</div><div>n=2</div><div><br></div><div>while(n&lt;9)</div><div>idx=subwrd(args,n)</div><div>opt=subwrd(args,n+1)</div>
<div>if(idx=&#39;&#39;);break;endif</div><div>if(idx=&#39;-cint&#39;);ccint=opt;endif</div><div>if(idx=&#39;-cmin&#39;);ccmin=opt;endif</div><div>if(idx=&#39;-cmax&#39;);ccmax=opt;endif</div><div>if(idx=&#39;-string&#39;);string=opt;endif</div>
<div>n=n+2</div><div>endwhile</div><div><br></div><div>&#39;c&#39;</div><div>&#39;set gxout shaded&#39;</div><div>if(ccint!=&#39;&#39;); &#39;set cint &#39;ccint;endif</div><div>if(ccmin!=&#39;&#39;); &#39;set cmin &#39;ccmin;endif</div>
<div>if(ccmax!=&#39;&#39;); &#39;set cmax &#39;ccmax;endif</div><div>if(ccmin!=&#39;&#39;); if(ccmax!=&#39;&#39;); &#39;set rbrange &#39;ccmin &#39; &#39;ccmax; endif;endif</div><div><br></div><div>*CBB 3/22/11 set the levels</div>
<div>&#39;make_clevs &#39; cmin cmax cint</div><div><div>&#39;d &#39;variable</div><div><br></div><div>*Add date and user-input string</div><div>&#39;q time&#39;</div><div>say result</div><div>cctime=subwrd(result,3)</div>
<div>coln=substr(cctime,3,1)</div><div>if coln = &#39;:&#39;</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>* &#39;draw title &#39;dmy space string</div><div> &#39;draw title &#39;day space my space string</div><div><br></div>
<div>&#39;q shades&#39; </div><div><br></div><div>&#39;cbar2&#39; </div><div><br></div></div><div>****END***********</div><div><br></div><div>***<a href="http://ani.gs" target="_blank">ani.gs</a>************</div><div><br>
</div><div><div>* Display animation </div><div>*     ga&gt; 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&gt; run ani t-t.2 -ci 0.1 -mn -0.5 -I 5 -cmax 0.3</div><div>*          &gt;&gt;&gt;&gt; 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=&#39;&#39;</div><div>ccint=&#39;&#39;</div><div>ccmin=&#39;&#39;</div><div>ccmax=&#39;&#39;</div><div>cbar=&#39;&#39;</div><div>n=2</div><div><br></div>
<div>while(n&lt;10000)</div><div>idx=subwrd(args,n)</div><div>opt=subwrd(args,n+1)</div><div>if(idx=&#39;&#39;);break;endif</div><div>if(idx=&#39;-I&#39;);slow=opt;endif</div><div>if(idx=&#39;-Int&#39;);slow=opt;endif</div>
<div>if(idx=&#39;-cint&#39;);ccint=opt;endif</div><div>if(idx=&#39;-cmin&#39;);ccmin=opt;endif</div><div>if(idx=&#39;-cmax&#39;);ccmax=opt;endif</div><div>if(idx=&#39;-ci&#39;);ccint=opt;endif</div><div>if(idx=&#39;-mn&#39;);ccmin=opt;endif</div>
<div>if(idx=&#39;-mx&#39;);ccmax=opt;endif</div><div>n=n+2</div><div>endwhile</div><div><br></div><div>defaultslow=10</div><div>if(slow=&#39;&#39;); slow=defaultslow;endif</div><div><br></div><div>&#39;q dims&#39;</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>&#39;set dbuff on&#39;</div><div>while (it &lt;=tmax)</div><div> &#39;set t &#39;it</div><div>i=0</div><div>while (i &lt;slow)</div><div>if(ccint!=&#39;&#39;); &#39;set cint &#39;ccint;endif</div><div>if(ccmin!=&#39;&#39;); &#39;set cmin &#39;ccmin;endif</div>
<div>if(ccmax!=&#39;&#39;); &#39;set cmax &#39;ccmax;endif</div><div>if(ccmin!=&#39;&#39;); if(ccmax!=&#39;&#39;); &#39;set rbrange &#39;ccmin &#39; &#39;ccmax; endif;endif</div><div><br></div><div>*CBB 3/22/11 setting max min clevs</div>
<div>&#39;make_clevs &#39; cmin cmax cint</div><div><br></div><div> &#39;display &#39;variable</div><div><br></div><div> &#39;run <a href="http://date.gs" target="_blank">date.gs</a>&#39;</div><div><br></div><div><br></div>
<div><br></div><div> &#39;query shades&#39;</div><div>shdinfo = result</div><div>if(subwrd(shdinfo,1)!=&#39;None&#39;);&#39;run <a href="http://fcbar.gs" target="_blank">fcbar.gs</a>&#39;;endif</div><div><br></div><div>&#39;swap&#39;</div>
<div>i=i+1</div><div>endwhile</div><div> it=it+1</div><div>endwhile</div><div> &#39;set t &#39; tmin &#39; &#39; 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><blockquote type="cite"> <div style="word-wrap: break-word;"> <div dir="ltr" align="left">
<font color="#0000ff" face="Arial" size="2"><span>I see in my original note I mislead you .. when I said I do my <a href="http://make_clevs.gs" target="_blank">make_clevs.gs</a> 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 &quot;display&quot; and &quot;make_clevs&quot;.</span></font></div>
 <div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span></span></font> </div> <div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span></span></font> </div> <div dir="ltr" align="left">
<font color="#0000ff" face="Arial" size="2"><span></span></font> </div> <div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span>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 &quot;set rgb&quot; (one entrie per colour) and rbcols (to set the order of the colours).   You don&#39;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 color="#0000ff" face="Arial" size="2"><span></span></font> </div> <div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span></span></font> </div> <div dir="ltr" align="left">
<font color="#0000ff" face="Arial" size="2"><span>ron</span></font></div><br> <div dir="ltr" lang="en-us" align="left"> <hr> <font face="Tahoma" size="2"><b>From:</b> <a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a> [<a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">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 &#39;d&#39; 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&#39;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&#39;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&#39;t figure out how to see the current values of ccols and clevs.</div>
 <div>cbar is getting its ccols and clevs from &#39;q shades&#39;, but it doesn&#39;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> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; font-size: medium;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<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" target="_blank">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></div></span><br></div></span><br>
</div></span><br> </div><br></div></div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jeff Duda<br>Iowa State University<br>Meteorology Graduate Student<br>3134 Agronomy Hall<br><a href="http://www.meteor.iastate.edu/~jdduda">www.meteor.iastate.edu/~jdduda</a><br>