<div dir="ltr"><div>Also ...<br><br><a href="http://www.ncl.ucar.edu/Applications/text.shtml">http://www.ncl.ucar.edu/Applications/text.shtml</a><br></div>Example 4<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 18, 2014 at 10:41 AM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">First, there are a couple of things wrong with your script:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">1) You have 0.0 as a _FillValue, which will not work when contouring with NCL.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can fix this with:</div><div class="gmail_default" style="font-size:small">







<p>   var@_FillValue = default_fillvalue(typeof(var))</p><p>2) You shouldn&#39;t set the &quot;lat2d&quot; and &quot;lon2d&quot; attributes, because your data is rectilinear, and already has coordinate arrays via &quot;lat&quot; and &quot;lon&quot;.</p><p>3) To add text strings, you want to use gsn_add_text.  Since you have missing values in &quot;var&quot;, it might be easier to convert &quot;var&quot; to 1D using ndtooned, and then conform the lat and lon coordinate arrays to be the same size as &quot;var&quot;, using a combination of conform and ndtooned.  You can then use &quot;ind&quot; to get the index locations in &quot;var1d&quot; where the values are not missing, and use the lat1d and lon1d as the locations of these strings:</p><p><font face="courier new, monospace">;<br>; Create 1D arrays of lat,lon,var values so we can <br>; put a text string at each value that is not missing.<br>;<br>  lat1d = ndtooned(conform(var,var&amp;lat,0))<br>  lon1d = ndtooned(conform(var,var&amp;lon,1))<br>  var1d = ndtooned(var)<br>  ii    = ind(.not.ismissing(var1d))<br>  ntext = dimsizes(ii)<br><br>  txres               = True<br>  txres@txFontHeightF = 0.008<br>  txres@txJust        = &quot;CenterCenter&quot;<br></font></p><p><font face="courier new, monospace">  txid = gsn_add_text(wks,plot,&quot;&quot;+var1d(ii),lon1d(ii),lat1d(ii),txres)</font></p><p><font face="courier new, monospace">  draw(plot)<br>  frame(wks)  </font></p><p>I&#39;ll attach the full script so you can run it.</p><p>--Mary</p></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sat, Oct 18, 2014 at 8:39 AM, LI Qi <span dir="ltr">&lt;<a href="mailto:liqi123sh@qq.com" target="_blank">liqi123sh@qq.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div>Dear NCL,</div><div><br></div><div>I&#39;d like to ask how to add values on the grid cells like the right figure shown below?</div><div><br></div><div><img src="cid:B3691800@89A38E5D.B27B4254.jpg">     <img src="cid:BE5E7705@89A38E5D.B27B4254.jpg" style="line-height:1.5"></div><div><br></div><div><br></div><div><br></div><div>Attached are the script and data.</div><div><br></div><div>Any advice will be greatly appreciated!</div><span><font color="#888888"><div><br></div><div>Qi Li</div></font></span><br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>