<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_1445011496741_6633" dir="ltr">I have another query further <br></div><div id="yui_3_16_0_1_1445011496741_6638" dir="ltr">Suppose I have a number of ranges (say for 1-2.5mm one color, 2.6-5.0 another, 5.1-7.5 another and so on.....)<br></div><div id="yui_3_16_0_1_1445011496741_6670"><br><span></span></div><div id="yui_3_16_0_1_1445011496741_6672" dir="ltr"><span id="yui_3_16_0_1_1445011496741_6671">then how will i use the "where" function????</span></div><div id="yui_3_16_0_1_1445011496741_6673"> </div><div id="yui_3_16_0_1_1445011496741_6674" 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 Friday, 16 October 2015 9:53 PM, Mary Haley <haley@ucar.edu> wrote:<br> </font> </div> <br><br> <div class="y_msg_container"><div id="yiv9531755877"><div><div dir="ltr"><div class="yiv9531755877gmail_default" style="font-size:small;">Geeta,</div><div class="yiv9531755877gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv9531755877gmail_default" style="font-size:small;">Your "if" statement is wrong. The condition "if any(rf.le.4.1)" is always going to resolve as True, because you are checking if *any* one of the rf values is <= 4.1. The "else" part of the statement never gets executed.</div><div class="yiv9531755877gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv9531755877gmail_default" style="font-size:small;">If you want to set a different font color for each value, then you will need a do loop, because unfortunately we don't have a "txFontColors" type of resource that allows you to set an array of colors.</div><div class="yiv9531755877gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv9531755877gmail_default" style="font-size:small;">Here's what your loop would look like:</div><div class="yiv9531755877gmail_default" style="font-size:small;"><br clear="none"></div><div class="yiv9531755877gmail_default" style="font-size:small;"><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> nrf = dimsizes(rf)</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> colors = where(rf.le.4.1,"Blue","Red")</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> text = new(nrf,graphic)</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> do n=0,nrf-1</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> txres@txFontColor = colors(n)</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> text(n) = gsn_add_text(wks,plot,sprintf("%9.4g",rf(n)),lon(n),lat(n),txres)</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> end do </font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> draw(plot)</font></div><div class="yiv9531755877gmail_default"><font face="monospace, monospace"> frame(wks)</font></div></div><div class="yiv9531755877gmail_default" style="font-size:small;"><br clear="none"></div></div><div class="yiv9531755877yqt2776536265" id="yiv9531755877yqt18513"><div class="yiv9531755877gmail_extra"><br clear="none"><div class="yiv9531755877gmail_quote">On Thu, Oct 15, 2015 at 11:49 AM, Geeta Geeta <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:geetag54@yahoo.com" target="_blank" href="mailto:geetag54@yahoo.com">geetag54@yahoo.com</a>></span> wrote:<br clear="none"><blockquote class="yiv9531755877gmail_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 dir="ltr">Yes I meant "clumsy " as the values close to the dots. <br clear="none"></div><div dir="ltr">Yes all your suggestions are working very well. <br clear="none"></div><div dir="ltr">Thanks a lot for that. <br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">I have another question. I was wondering if I can give different colours to the values. I mean if rainfall in in range of 0.1-2.4, then I write the actual value by Yellow color<br clear="none"></div><div dir="ltr">if 2.5 -10.0 say then I write the actual value by Green color</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Instead of all uniform colour like Blue I have chosen <br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">For this I tried with if statement before the Text Res like this. <br clear="none"></div><div dir="ltr"><br clear="none"> txres = True<br clear="none"> txres@txFontHeightF = 0.012<br clear="none"> txres@txFont = "helvetica-bold"<br clear="none">;<br clear="none"> if any(rf.le.4.1) then<br clear="none"> txres@txFontColor = "Blue"<br clear="none">; txres@txFontQuality = "High"<br clear="none">; txres@txJut = "TopRight "<br clear="none">else<br clear="none">if any(rf.gt.4.1) then<br clear="none">txres@txFontColor = "Red"<br clear="none">end if<br clear="none">end if<br clear="none"> <br clear="none"> text = gsn_add_text(wks,plot," "+sprintf("%9.4g",rf),lon,lat,txres)<br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">But It is plotted in Blue only. <br clear="none"></div><div dir="ltr">my input file looks like this. <br clear="none"></div><div dir="ltr">lat lon hgt rf<br clear="none"></div><div dir="ltr">12.57 77.38 919.6 5.6<span class="yiv9531755877"><br clear="none">12.3 78.18 882.2 67.<br clear="none">13.06 77.24 900 0.1<br clear="none"></span>13.26 77.24 900 4.1<br clear="none"><br clear="none"></div><div dir="ltr">If I dont use any function then I get error. <br clear="none"></div><span class="yiv9531755877HOEnZb"><font color="#888888"></font></span><div> </div><div>Geeta.</div><div><div class="yiv9531755877h5"> <br clear="none"><div><br clear="none"><br clear="none"></div><div style="display:block;"> <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 Wednesday, 14 October 2015 12:34 AM, Mary Haley <<a rel="nofollow" shape="rect" ymailto="mailto:haley@ucar.edu" target="_blank" href="mailto:haley@ucar.edu">haley@ucar.edu</a>> wrote:<br clear="none"> </font> </div> <br clear="none"><br clear="none"> <div><div><div><div dir="ltr"><div style="font-size:small;">Geeta,</div><div style="font-size:small;"><br clear="none"></div><div style="font-size:small;">I'm not sure what you mean by "messy". </div><div style="font-size:small;"><br clear="none"></div><div style="font-size:small;">You are setting txPosXF and txPosYF, but these resources are meaningless, because the "gsn_add_text" function has the X and Y positions as part of its argument list, in your case, the "lon" and "lat" arguments:</div><div style="font-size:small;">
<div> text = <span>gsn_add_text</span>(wks,plot,<span>sprintf</span>(<span>"%9.4g"</span>,rf),lon,lat,txres)</div><div>So, you should be trying to change your lon and lat values, and not txPosXF and txPosYF.</div><div>If by "messy" you mean that the text string is touching the markers in a couple of places, then there are several things you can do.</div><div>One is to simply add some extra spaces before the text strings. You can do this by changing the format in the "sprintf" call to have more fields:</div><div>
</div><div> text = <span>gsn_add_text</span>(wks,plot,<span>sprintf</span>(<span>"%11.4g"</span>,rf),lon,lat,txres)</div><div>or by adding a space:</div><div>
</div><div> text = <span>gsn_add_text</span>(wks,plot," " + <span>sprintf</span>(<span>"%9.4g"</span>,rf),lon,lat,txres)</div><div>You can also add a small delta value to the "lon" position:</div><div>
</div><div> text = <span>gsn_add_text</span>(wks,plot,<span>sprintf</span>(<span>"%9.4g"</span>,rf),lon+0.1,lat,txres)</div><div>--Mary</div><div><br clear="none"></div><div><br clear="none"></div>
<div><br clear="none"></div><div><br clear="none"></div></div></div><div><br clear="none"><div>On Mon, Oct 12, 2015 at 11:14 AM, Geeta Geeta <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:geetag54@yahoo.com" target="_blank" href="mailto:geetag54@yahoo.com">geetag54@yahoo.com</a>></span> wrote:<br clear="none"><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:16px;"><div><span>Hi. <br clear="none"></span></div><div><span>I am plotting station rainfall and my data looks like </span></div><div dir="ltr"><span>13.57 77.38 919.6 5.6<br clear="none">12.3 78.18 882.2 67.<br clear="none">13.06 77.24 900 0.1<br clear="none">13.06 77.24 900 0.1<br clear="none">~ </span></div><div dir="ltr"><span>The Rf is in the 4th Col and it gets plotted. But when I try to change the position of the text, I am unable to do it. <br clear="none"></span></div><div dir="ltr"><span>My script is attached and the Figure. </span></div><div dir="ltr"><br clear="none"><span></span></div><div dir="ltr"><span>essentially, <br clear="none"></span></div><div dir="ltr"><span> <br clear="none"></span></div><div dir="ltr"><span> txres@txPosXF = 0.775<br clear="none"> txres@txPosYF = -5.05<br clear="none">; txres@txAngleF = 40.00 </span></div><div dir="ltr"><br clear="none"><span></span></div><div dir="ltr"><span>Since I am unable to change the above two, my plot looks a little messy. <br clear="none"></span></div><div dir="ltr"><br clear="none"><span></span></div><div dir="ltr"><span>can someone suggest???<span><font color="#888888"><br clear="none"></font></span></span></div><span><font color="#888888"></font></span><div dir="ltr"><span></span></div><div> </div><div>Geeta.</div></div></div></div><br clear="none">_______________________________________________<br clear="none">
ncl-talk mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:ncl-talk@ucar.edu" target="_blank" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br clear="none">
List instructions, subscriber options, unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div></div></div></div></blockquote></div><br clear="none"></div></div></div></div><br><br></div> </div> </div> </div></div></body></html>