Clay,<br>That is simply how grads behaves. If you look through the grads documentation index for the set ccols (e.g., <a href="http://www.iges.org/grads/gadoc/gradcomdsetccols.html">http://www.iges.org/grads/gadoc/gradcomdsetccols.html</a>) and set clevs commands, you'll notice they say things like "this is reset by a display command". You will have to issue the commands each time before you display a variable. This shouldn't be a problem if you are using a while loop to create your animation, though.<br>
<br>Jeff<br><br><div class="gmail_quote">On Wed, Mar 23, 2011 at 1:22 PM, Clay Blankenship <span dir="ltr"><<a href="mailto:clay.b.blankenship@nasa.gov">clay.b.blankenship@nasa.gov</a>></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;">Yes, that is correct. Ideally, I would specify the range and not have to pick the exact colors. (I'll go back and do that later if necessary.) Just specifying<div>clevs initially works fine on my first plot. If I 'd' the variable, and then 'cbar', I get the range of values I want. However if I advance the time one step,</div>
<div>and do the 'd var' and 'cbar' again, I get a different value range. It appears that I have to set clevs every time I do a plot. How is it getting reset? </div><div>(And I still haven't figured out how to print out the current clevs and ccols.)</div>
<div><br></div><div>Clay </div><div><br></div><div><br></div><div><div><br></div><div><br></div><div><br><div><div>On Mar 23, 2011, at 11:23 AM, Jeffrey Duda wrote:</div><br><blockquote type="cite"> <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 "set clevs" and "set ccols" 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>'set dbuff on'<br>t = 1<br>'set gxout shaded'<br>while (t <= 5)<br> 'set t 't<br> 'draw title Temperature'<br> 'set clevs A B C D E F G H I ...'<br> 'set ccols 17 18 29 20 21 22 23 ...'<br>
'd t' <br> 'cbar'<br> 'swap'<br> t = t + 1<br>endwhile<br><br>This example assumes you have defined color numbers 17, 18, 19, ... and so on using the "set rgb" 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 "set clevs" and <br>"set ccols" command. Then you could replace some of the code above with something like<br>
<br>'set dbuff on'<br>t = 1<br>'set gxout shaded'<br>while (t <= 5)<br> 'set t 't<br> 'draw title Temperature'<br> 'run <a href="http://mycolorscript.gs" target="_blank">mycolorscript.gs</a>'<br>
'd t' <br> 'cbar'<br> 'swap'<br> t = t + 1<br>endwhile<br><br>where you created the script called <a href="http://mycolorscript.gs" target="_blank">mycolorscript.gs</a>. I have sample animated gifs stored at <a href="http://www.meteor.iastate.edu/%7Ejdduda/sfc_div.gif" target="_blank">http://www.meteor.iastate.edu/~jdduda/sfc_div.gif</a><br>
and <a href="http://www.meteor.iastate.edu/%7Ejdduda/radar3.gif" target="_blank">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'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"><<a href="mailto:clay.b.blankenship@nasa.gov" target="_blank">clay.b.blankenship@nasa.gov</a>></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'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>****<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=''</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>***<a href="http://ani.gs" target="_blank">ani.gs</a>************</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 <a href="http://date.gs" target="_blank">date.gs</a>'</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 <a href="http://fcbar.gs" target="_blank">fcbar.gs</a>';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><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 "display" and "make_clevs".</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 "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 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 '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> <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" target="_blank">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/%7Ejdduda" target="_blank">www.meteor.iastate.edu/~jdduda</a><br>
<span><ATT00001.txt></span></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>