<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:16px"><div id="yui_3_16_0_1_1445250909914_25844"><span id="yui_3_16_0_1_1445250909914_26337">Thanks Alan and Mary for your help. <br></span></div><div dir="ltr" id="yui_3_16_0_1_1445250909914_26338"><span id="yui_3_16_0_1_1445250909914_26337">Thanks Alan. I have tried your way of defining the colors. It worked but with some warnings. <br></span></div><div id="yui_3_16_0_1_1445250909914_26482" dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337">I am getting warning message because txFontColor is an integer while I am passing a string variable I guess. <br></span></div><div id="yui_3_16_0_1_1445250909914_26483" dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337">ariable: colors<br class="" id="yui_3_16_0_1_1445250909914_26494">Type: string<br class="" id="yui_3_16_0_1_1445250909914_26496">Total Size: 24 bytes<br class="" id="yui_3_16_0_1_1445250909914_26498">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 values<br class="" id="yui_3_16_0_1_1445250909914_26500">Number of Dimensions: 1<br class="" id="yui_3_16_0_1_1445250909914_26502">Dimensions and sizes:&nbsp;&nbsp;&nbsp; [6]<br class="" id="yui_3_16_0_1_1445250909914_26504">Coordinates: <br class="" id="yui_3_16_0_1_1445250909914_26506">Number Of Attributes: 1<br class="" id="yui_3_16_0_1_1445250909914_26508">&nbsp; _FillValue :&nbsp;&nbsp;&nbsp; missing<br class="" id="yui_3_16_0_1_1445250909914_26510">(0)&nbsp;&nbsp;&nbsp; Red<br class="" id="yui_3_16_0_1_1445250909914_26512">(1)&nbsp;&nbsp;&nbsp; <br class="" id="yui_3_16_0_1_1445250909914_26514">(2)&nbsp;&nbsp;&nbsp; Blue<br class="" id="yui_3_16_0_1_1445250909914_26516">(3)&nbsp;&nbsp;&nbsp; Red<br class="" id="yui_3_16_0_1_1445250909914_26518">(4)&nbsp;&nbsp;&nbsp; Yellow<br class="" id="yui_3_16_0_1_1445250909914_26520">(5)&nbsp;&nbsp;&nbsp; <br class="" id="yui_3_16_0_1_1445250909914_26522">fatal:CvtStringToColorIndex: Unable to convert string "" to requested type<br class="" id="yui_3_16_0_1_1445250909914_26524">warning:Error retrieving resource txFontColor from args - Ignoring Arg<br class="" id="yui_3_16_0_1_1445250909914_26526">fatal:CvtStringToColorIndex: Unable to convert string "" to requested type<br class="" id="yui_3_16_0_1_1445250909914_26528">warning:Error retrieving resource txFontColor from args - Ignoring Arg<br class="" id="yui_3_16_0_1_1445250909914_26530">aditya@agniilap:~/geeta/ncl$&nbsp;</span></div><div id="yui_3_16_0_1_1445250909914_27115" dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337">Pls clarify this Point (txFontColor = integer)<br class="" id="yui_3_16_0_1_1445250909914_26532"></span></div><div id="yui_3_16_0_1_1445250909914_26485" dir="ltr"><br><span id="yui_3_16_0_1_1445250909914_26337"></span></div><div id="yui_3_16_0_1_1445250909914_26765" dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337">Mary the script runs fine.&nbsp; Thank you. <br></span></div><div id="yui_3_16_0_1_1445250909914_26779" dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337">I did not intend to send a message to you directly but since many tabs were open. It happened by mistake. <br></span></div><div dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337"><br></span></div><div dir="ltr"><span id="yui_3_16_0_1_1445250909914_26337">Thanks</span></div><div id="yui_3_16_0_1_1445250909914_25842">&nbsp;</div><div id="yui_3_16_0_1_1445250909914_25840" class="signature">Geeta.</div>  <br><div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;"> <div dir="ltr"> <font face="Arial" size="2"> On Tuesday, 20 October 2015 12:32 AM, Mary Haley &lt;haley@ucar.edu&gt; wrote:<br> </font> </div>  <br><br> <div class="y_msg_container"><div id="yiv4470089533"><div><div dir="ltr"><div class="yiv4470089533gmail_default" style="font-size:small;">Geeta,</div><div class="yiv4470089533gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv4470089533gmail_default" style="font-size:small;">Please email all follow-up questions to <a rel="nofollow" shape="rect" ymailto="mailto:ncl-talk@ucar.edu" target="_blank" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>, and do not send them to me directly.</div><div class="yiv4470089533gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv4470089533gmail_default" style="font-size:small;">You need to group the text strings by the color you want to render them in.&nbsp; 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="yiv4470089533gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv4470089533gmail_default" style="font-size:small;"><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; range_bot = (/ &nbsp; 0.1, &nbsp; 2.5, &nbsp; &nbsp; &nbsp;7.5/)</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; range_top = (/ &nbsp; 2.5, &nbsp; 7.5, &nbsp; &nbsp; 15.5/)</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; colors &nbsp; &nbsp;= (/"Blue", "Red", "Green"/)</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; nranges &nbsp; = dimsizes(range_bot)</font></div><div class="yiv4470089533gmail_default"><span style="font-family:monospace, monospace;">;&nbsp;</span><br clear="none"></div><div class="yiv4470089533gmail_default"><span style="font-family:monospace, monospace;">; Loop through each range and get the indices of &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></div><div class="yiv4470089533gmail_default"><span style="font-family:monospace, monospace;">; all the values that fall in this range. These &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></div><div class="yiv4470089533gmail_default"><span style="font-family:monospace, monospace;">; are the values that should be drawn in the given &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-family:monospace, monospace;">; ; color.</span></div><div class="yiv4470089533gmail_default"><span style="font-family:monospace, monospace;">; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; do n=0,nranges-1</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; ii := ind(rf.ge.range_bot(n).and.rf.lt.range_top(n))</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; if(.not.any(ismissing(ii))) then</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; txres@txFontColor = colors(n) &nbsp; &nbsp; ; set the color for this range</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; unqstr = unique_string("text") &nbsp; &nbsp;; generate a unique id for text object</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; plot@$unqstr$ = gsn_add_text(wks,plot," "+sprintf("%9.4g",rf(ii)), \</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lon(ii),lat(ii),txres)</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; &nbsp; end if</font></div><div class="yiv4470089533gmail_default"><font face="monospace, monospace">&nbsp; end do</font></div><div><br clear="none"></div><div><br clear="none"></div><div>See the attached script, which is based on your script, but using random data.</div><div><br clear="none"></div><div>--Mary</div><div><br clear="none"></div></div></div><div class="yiv4470089533yqt7336234235" id="yiv4470089533yqt68931"><div class="yiv4470089533gmail_extra"><br clear="none"><div class="yiv4470089533gmail_quote">On Mon, Oct 19, 2015 at 11:02 AM, Geeta Geeta <span dir="ltr">&lt;<a rel="nofollow" shape="rect" ymailto="mailto:geetag54@yahoo.com" target="_blank" href="mailto:geetag54@yahoo.com">geetag54@yahoo.com</a>&gt;</span> wrote:<br clear="none"><blockquote class="yiv4470089533gmail_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="yiv4470089533">&nbsp;Hi Mary. <br clear="none">I have tried three things for giving a range to the rainfall. Pls see the lines 91 to 110 of my script. <br clear="none"><br clear="none"><br clear="none"><br clear="none">1.&nbsp; I tried the following. <br clear="none"><br clear="none">1. print(nrf)<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp; 92&nbsp;&nbsp; colors = where(((rf.ge.0.1).and.(rf.lt.2.5)),"Blue","&nbsp;&nbsp; ")&nbsp; ; This is a string variable<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp; 93&nbsp;&nbsp; colors = where(((rf.ge.2.5).and.(rf.lt.7.5)),"Red","&nbsp;&nbsp; ")<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp; 94 ;&nbsp; colors = where(((rf.ge.7.5).and.(rf.lt.15.5)),"Yellow","&nbsp;&nbsp; ")<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp; 95 ;&nbsp; colorss= stringtoint(colors)<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp; <br clear="none">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 clear="none">Variable: colors<br clear="none">Type: integer<br clear="none">Total Size: 16 bytes<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 values<br clear="none">Number of Dimensions: 1<br clear="none">Dimensions and sizes:&nbsp;&nbsp;&nbsp; [4]<br clear="none">Coordinates: <br clear="none">(0)&nbsp;&nbsp;&nbsp; 1<br clear="none">(1)&nbsp;&nbsp;&nbsp; 21<br clear="none">(2)&nbsp;&nbsp;&nbsp; 41<br clear="none">(3)&nbsp;&nbsp;&nbsp; 61<br clear="none">fatal:Subscript out of range, error in subscript #0<br clear="none">fatal:An error occurred reading colors<br clear="none">fatal:["Execute.c":8578]:Execute: Error occurred at or near line 106 in file stn-v3.ncl<br clear="none"><br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:aditya@agniilap" target="_blank" href="mailto:aditya@agniilap">aditya@agniilap</a>:~/geeta/ncl$ <br clear="none"><br clear="none"></span>can U pls suggest???I also tried combining two statements with where but that did not work. <br clear="none">&nbsp;Geeta. <br clear="none"><span class="yiv4470089533HOEnZb"><font color="#888888"><br clear="none"></font></span></div><span class="yiv4470089533HOEnZb"><font color="#888888"></font></span><div>Geeta.</div></div></div></blockquote></div><br clear="none"></div></div></div></div><br><br></div>  </div> </div>  </div></div></body></html>