[ncl-talk] Add polyline, polygon, and polytext to a map generates two PNG files.

Wei Huang whuang at univ-wea.com
Tue Jul 14 12:52:26 MDT 2015


Adam,

I am too lazy to use the same “res” for map and for polys,
That is where the warning msgs coming from.

Thank  you so much for the example.

Wei Huang

From: Adam Phillips [mailto:asphilli at ucar.edu]
Sent: Tuesday, July 14, 2015 1:33 PM
To: Wei Huang
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Add polyline, polygon, and polytext to a map generates two PNG files.

Hi Wei,
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.
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:

"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 gsn_add_polyline is inside a function or procedure."
https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polyline.shtml
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)..
Hope that all makes sense!
Adam


On Tue, Jul 14, 2015 at 12:18 PM, Wei Huang <whuang at univ-wea.com<mailto:whuang at univ-wea.com>> wrote:
Adam,

I used gsn_add_* suite for the polylines, polygons, polytexts.

If I set:
   res                      = True
   res at gsnDraw              = False
  res at gsnFrame             = False

It can turn off (eliminate) the blank map, but later, there are a whole bunch of warning msgs,

warning:gsnDraw/gsnFrame is not a valid resource in graphic_style at this time.

This make it hard to read other msgs.

Thanks,

Wei Huang

From: Adam Phillips [mailto:asphilli at ucar.edu<mailto:asphilli at ucar.edu>]
Sent: Tuesday, July 14, 2015 1:07 PM
To: Wei Huang
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Add polyline, polygon, and polytext to a map generates two PNG files.

Hi Wei,
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.
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.
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:
https://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl

Hope that helps!
Adam





On Tue, Jul 14, 2015 at 10:05 AM, Wei Huang <whuang at univ-wea.com<mailto:whuang at univ-wea.com>> wrote:
I am trying to add polyline, polygon, and polytext to a map, steps as below:

  res = ...
  wks = ...
   map = gsn_csm_map(wks, res)

 ;add lots of polylines, polygons, and polytexts to map

draw(map)
 frame(wks)

It generates two PNG files. With the first just a map.

How can I remove the first blank map?

Thanks,

Wei Huang
whuang at univ-wea.com<mailto:whuang at univ-wea.com>


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



--
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/<http://www.cgd.ucar.edu/staff/asphilli/>   303-497-1726<tel:303-497-1726>




--
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/<http://www.cgd.ucar.edu/staff/asphilli/>   303-497-1726

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150714/2f27c754/attachment.html 


More information about the ncl-talk mailing list