<div dir="ltr"><div><div><div><div><div>Hi Wei,<br></div>I have created a sample test script that draws a blank map, and adds a polyline, polymarker, and some text to a specific location on the map. I've attached the script and resulting png. <br><br></div>Note that with all the gsn_add_* functions you have to keep the resulting output array from the gsn_add_* functions. From the gsn_add_polyline documentation:<br><br>"The value(s) returned from this function must be assigned to a unique
variable. This is necessary so that the polyline(s) "live" for the
duration of the NCL script. This is especially imperative if the call
to <strong>gsn_add_polyline</strong> is inside a
function or procedure."<br><a href="https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polyline.shtml">https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polyline.shtml</a><br><br></div>In my test script I assigned the output to dum0, dum1 and dum2. I could have created an array: dum = new(3,graphic) and assigned the output to dum(0), dum(1) and dum(2).. Either way, I cannot delete or overwrite the output arrays (dum or dum0, dum1, dum2)..<br><br></div>Hope that all makes sense!<br></div>Adam<br><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 14, 2015 at 12:18 PM, Wei Huang <span dir="ltr"><<a href="mailto:whuang@univ-wea.com" target="_blank">whuang@univ-wea.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Adam,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I used gsn_add_* suite for the polylines, polygons, polytexts.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">If I set:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> res = True<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> res@gsnDraw = False<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> res@gsnFrame = False<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It can turn off (eliminate) the blank map, but later, there are a whole bunch of warning msgs,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">warning:gsnDraw/gsnFrame is not a valid resource in graphic_style at this time.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This make it hard to read other msgs.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><b><span style="font-size:17.0pt;font-family:"Lucida Handwriting";color:#1f497d">Wei Huang</span></b><span style="font-size:9.5pt;font-family:"Lucida Handwriting";color:#222222"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Adam Phillips [mailto:<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>]
<br>
<b>Sent:</b> Tuesday, July 14, 2015 1:07 PM<br>
<b>To:</b> Wei Huang<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] Add polyline, polygon, and polytext to a map generates two PNG files.<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Hi Wei,<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">It depends on what functions/procedures you are using to draw your polylines/markers/text.. In all cases you should set gsnFrame = False in your res resource list.
<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I prefer the gsn_add_* suite of functions to do what you are doing as it allows paneling. For those functions you also need to add gsnDraw = False to your res resource list.<u></u><u></u></p>
</div>
<p class="MsoNormal">If you are just using gsn_text/gsn_polygon/gsn_polygon you can get away with not setting gsnDraw as is shown in polygon example #8 here:<br>
<a href="https://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">Hope that helps!<u></u><u></u></p>
</div>
<p class="MsoNormal">Adam<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Jul 14, 2015 at 10:05 AM, Wei Huang <<a href="mailto:whuang@univ-wea.com" target="_blank">whuang@univ-wea.com</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">I am trying to add polyline, polygon, and polytext to a map, steps as below:<br>
<br>
res = ...<br>
wks = ...<br>
map = gsn_csm_map(wks, res)<br>
<br>
;add lots of polylines, polygons, and polytexts to map<br>
<br>
draw(map)<br>
frame(wks)<br>
<br>
It generates two PNG files. With the first just a map.<br>
<br>
How can I remove the first blank map?<br>
<br>
Thanks,<br>
<br>
Wei Huang<br>
<a href="mailto:whuang@univ-wea.com" target="_blank">whuang@univ-wea.com</a><br>
<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><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><u></u><u></u></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:#888888">Adam Phillips </span><u></u><u></u></p>
</div>
<p class="MsoNormal"><span style="color:#888888">Associate Scientist, Climate and Global Dynamics Laboratory, NCAR</span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> <a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a>
</span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>