[gradsusr] Colorbars

Simon Kiertscher simon.kiertscher at gmx.de
Wed Apr 6 04:47:36 EDT 2011


Thx for the script, as soon I have time, I will try this!

> I  had this same issue recently and finally figured out how it works
> with some help from this list.  What was non-intuitive to me is that
> every time you do a 'display' command you have to reset the clevs and
> ccols.  What I do is specify the cmin, cmax, and cint with script
> arguments and then set clevs using those variables each time I do a
> display.  You can set ccols if you want or just let it get set
> automatically.  Here is an animation script I am using.
>
> * Display animation 
> *     ga> run ani variable [ -I slowness (default=10) ]
> *                            [ -cint, -ci  contour interval ]
> *                            [ -cmin, -mn  minimum contour level ]
> *                            [ -cmax, -mx  maximum contour level ]
> *   ex. ga> run ani t-t.2 -ci 0.1 -mn -0.5 -I 5 -cmax 0.3
> *          >>>> plot (t-t.2) with slowness=5, contour_interval=0.1
> *               minimum contour level=-0.5, maximum contour level=0.3
> *
> *                                                  Nov. 9, 1999 Masami
> Nonaka
> *
> *            Modified by Clay Blankenship 2011
> *
> function ani (args)
>
> variable=subwrd(args,1)
>
> slow=''
> cint=''
> cmin=''
> cmax=''
> cbar=''
> n=2
>
> while(n<10000)
> idx=subwrd(args,n)
> opt=subwrd(args,n+1)
> if(idx='');break;endif
> if(idx='-I');slow=opt;endif
> if(idx='-Int');slow=opt;endif
> if(idx='-cint');cint=opt;endif
> if(idx='-cmin');cmin=opt;endif
> if(idx='-cmax');cmax=opt;endif
> if(idx='-ci');cint=opt;endif
> if(idx='-mn');cmin=opt;endif
> if(idx='-mx');cmax=opt;endif
> n=n+2
> endwhile
>
> defaultslow=10
> if(slow=''); slow=defaultslow;endif
>
>  'q dims'
>  say result
> aline=sublin(result,5)
> cctime1=subwrd(aline,11)
> cctime2=subwrd(aline,13)
> tmin=substr(cctime1,1,9)
> tmax=substr(cctime2,1,9)
> it=tmin
> 'set dbuff on'
> while (it <=tmax)
>  'set t 'it
> i=0
> while (i <slow)
>
> *CBB 3/22/11 setting max min clevs
> if((ccint!='')&(ccmin!='')&(ccmax!=''))
>   'make_clevs 'cmin' 'cmax' 'cint
> endif
> *'set ccols 1 2 3 4 5 6 7 8 9 10 11'
>
>  'display 'variable
>
>  'run date.gs'
>
>  'query shades'
> shdinfo = result
> if(subwrd(shdinfo,1)!='None');'run fcbar.gs';endif
>
> 'swap'
> i=i+1
> endwhile
>  it=it+1
> endwhile
>  'set t ' tmin ' ' tmax
>
> ****END OF SCRIPT
>
> *Here is make_clevs.gs
>
> *CBB I got this from Ron Goodson on the GRADS User Forum, 3/22/11
> *Set a min and max value for the color bar
> function main(UserInput)
> value = subwrd(UserInput,1)
> maxvalue = subwrd(UserInput,2)
> incvalue = subwrd(UserInput,3)
> space = " "
> say value space maxvalue space incvalue
> mystring = " "
> while (value <= maxvalue)
> mystring = mystring%value
> mystring = mystring%" "
> value = value + incvalue
> endwhile
> 'set clevs ' mystring
> say 'clevs are 'mystring
> return
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Apr 4, 2011, at 2:29 AM, Simon Kiertscher wrote:
>
>> Yes you can control it by set clevs, but i hoped there would be a script
>> doing all that for me. I can't use the scripts I found the way they are
>> at the moment. And doing it by my self would be very expensive. Any
>> other ideas?
>>
>> Best Regards,
>> Simon
>>> I believe you need to set the clevs so that the range in the color
>>> bar is
>>> fixed for each timestep at which the variable is plotted
>>>
>>> set clevs ...
>>>
>>> --
>>> Muhammad Rahiz
>>> Researcher & DPhil Candidate (Climate Systems & Policy)
>>> School of Geography & the Environment
>>> University of Oxford
>>>
>>> On Fri, 1 Apr 2011, Simon Kiertscher wrote:
>>>
>>>
>>>> Hi All,
>>>> I have a question about colorbars. I have already found several scripts
>>>> for drawing a colorbar under a picture (e.g. cbar.gs, xcbar.gs ...).
>>>> That works fine. My Problem is, I would like to make a video out of a
>>>> couple of pictures from one time line. The problem is that the colorbar
>>>> always shows the max and min of the current picture. Therefor my video
>>>> has a changing colorbar what is really not what I want. I want to have
>>>> fixed colorbar about the whole video length. I hope i could explain my
>>>> problem good enough. Any ideas how to do that? Are there eventually a
>>>> script which has a parameter to enter the maximum and minimum values?
>>>> Thank & Best Regards,
>>>> Simon
>>>>
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>
>>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>> http://gradsusr.org/mailman/listinfo/gradsusr
>
> -- 
> Clay Blankenship                 * USRA Research Scientist
> clay.b.blankenship at nasa.gov <mailto:clay.b.blankenship at nasa.gov>    
>  * 256-961-7638
> 320 Sparkman Drive               * Huntsville, AL 35805 USA
> National Space Science and Technology Center at NASA-MSFC/UAH
>
>
>
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110406/2a1d8504/attachment-0003.html 


More information about the gradsusr mailing list