<div dir="ltr"><div class="gmail_default" style="font-size:small">Geeta,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Please email all follow-up questions to <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>, and do not send them to me directly.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You need to group the text strings by the color you want to render them in. So, you should be looping across the number of ranges you have, and not each value. Your code would look something like this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace"> range_bot = (/ 0.1, 2.5, 7.5/)</font></div><div class="gmail_default"><font face="monospace, monospace"> range_top = (/ 2.5, 7.5, 15.5/)</font></div><div class="gmail_default"><font face="monospace, monospace"> colors = (/"Blue", "Red", "Green"/)</font></div><div class="gmail_default"><font face="monospace, monospace"> nranges = dimsizes(range_bot)</font></div><div class="gmail_default"><span style="font-family:monospace,monospace">; </span><br></div><div class="gmail_default"><span style="font-family:monospace,monospace">; Loop through each range and get the indices of </span></div><div class="gmail_default"><span style="font-family:monospace,monospace">; all the values that fall in this range. These </span></div><div class="gmail_default"><span style="font-family:monospace,monospace">; are the values that should be drawn in the given </span><span style="font-family:monospace,monospace">; ; color.</span></div><div class="gmail_default"><span style="font-family:monospace,monospace">; </span></div><div class="gmail_default"><font face="monospace, monospace"> do n=0,nranges-1</font></div><div class="gmail_default"><font face="monospace, monospace"> ii := ind(rf.ge.range_bot(n).and.rf.lt.range_top(n))</font></div><div class="gmail_default"><font face="monospace, monospace"> if(.not.any(ismissing(ii))) then</font></div><div class="gmail_default"><font face="monospace, monospace"> txres@txFontColor = colors(n) ; set the color for this range</font></div><div class="gmail_default"><font face="monospace, monospace"> unqstr = unique_string("text") ; generate a unique id for text object</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unqstr$ = gsn_add_text(wks,plot," "+sprintf("%9.4g",rf(ii)), \</font></div><div class="gmail_default"><font face="monospace, monospace"> lon(ii),lat(ii),txres)</font></div><div class="gmail_default"><font face="monospace, monospace"> end if</font></div><div class="gmail_default"><font face="monospace, monospace"> end do</font></div><div><br></div><div><br></div><div>See the attached script, which is based on your script, but using random data.</div><div><br></div><div>--Mary</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 19, 2015 at 11:02 AM, Geeta Geeta <span dir="ltr"><<a href="mailto:geetag54@yahoo.com" target="_blank">geetag54@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div><span></span></div><div dir="ltr"><span class=""> Hi Mary. <br>I have tried three things for giving a range to the rainfall. Pls see the lines 91 to 110 of my script. <br><br><br><br>1. I tried the following. <br><br>1. print(nrf)<br> 92 colors = where(((rf.ge.0.1).and.(rf.lt.2.5)),"Blue"," ") ; This is a string variable<br> 93 colors = where(((rf.ge.2.5).and.(rf.lt.7.5)),"Red"," ")<br> 94 ; colors = where(((rf.ge.7.5).and.(rf.lt.15.5)),"Yellow"," ")<br> 95 ; colorss= stringtoint(colors)<br> <br>2nd
Method in which I have defined the colors as an array. So there is
error on line 106. Also this will give an individual color to each data.
<br>Variable: colors<br>Type: integer<br>Total Size: 16 bytes<br> 4 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [4]<br>Coordinates: <br>(0) 1<br>(1) 21<br>(2) 41<br>(3) 61<br>fatal:Subscript out of range, error in subscript #0<br>fatal:An error occurred reading colors<br>fatal:["Execute.c":8578]:Execute: Error occurred at or near line 106 in file stn-v3.ncl<br><br><a href="mailto:aditya@agniilap" target="_blank">aditya@agniilap</a>:~/geeta/ncl$ <br><br></span>can U pls suggest???I also tried combining two statements with where but that did not work. <br> Geeta. <br><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Geeta.</div></font></span></div></div></blockquote></div><br></div>