<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 class=""> var@_FillValue = default_fillvalue(typeof(var))</p><p class="">2) You shouldn't set the "lat2d" and "lon2d" attributes, because your data is rectilinear, and already has coordinate arrays via "lat" and "lon".</p><p class="">3) To add text strings, you want to use gsn_add_text. Since you have missing values in "var", it might be easier to convert "var" to 1D using ndtooned, and then conform the lat and lon coordinate arrays to be the same size as "var", using a combination of conform and ndtooned. You can then use "ind" to get the index locations in "var1d" where the values are not missing, and use the lat1d and lon1d as the locations of these strings:</p><p class=""><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&lat,0))<br> lon1d = ndtooned(conform(var,var&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 = "CenterCenter"<br></font></p><p class=""><font face="courier new, monospace"> txid = gsn_add_text(wks,plot,""+var1d(ii),lon1d(ii),lat1d(ii),txres)</font></p><p class=""><font face="courier new, monospace"> draw(plot)<br> frame(wks) </font></p><p class="">I'll attach the full script so you can run it.</p><p class="">--Mary</p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 18, 2014 at 8:39 AM, LI Qi <span dir="ltr"><<a href="mailto:liqi123sh@qq.com" target="_blank">liqi123sh@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear NCL,</div><div><br></div><div>I'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 class="HOEnZb"><font color="#888888"><div><br></div><div>Qi Li</div></font></span><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>