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

Adam Phillips asphilli at ucar.edu
Wed Jul 15 11:49:40 MDT 2015


Hi Wei,
I just tested this method and it worked:

res at gsnDraw = False
res at gsnFrame = False
plot = gsn_map(wks,res)

; create polylines/polygons/polymarkers using gsn_add_*

draw(plot)

wmdrft(wks, xlat, xlon)   ; Draw front
...   ; draw other fronts

frame(wks)

Adam


On Wed, Jul 15, 2015 at 11:10 AM, Wei Huang <whuang at univ-wea.com> wrote:

>  Adam,
>
>
>
> That did not work.
>
>
>
> *Wei Huang*
>
>
>
> *From:* Adam Phillips [mailto:asphilli at ucar.edu]
> *Sent:* Wednesday, July 15, 2015 12:05 PM
> *To:* Wei Huang
> *Cc:* David Brown; ncl-talk at ucar.edu
> *Subject:* Re: [ncl-talk] Add polyline, polygon, and polytext to a map
> generates two PNG files.
>
>
>
> Hi Wei,
>
> Try adding:
>
> res at mpFillDrawOrder = "PreDraw*"*
>
> and let ncl-talk know if that doesn't work.
>
> Adam
>
>
>
> On Wed, Jul 15, 2015 at 11:00 AM, Wei Huang <whuang at univ-wea.com> wrote:
>
> Dave,
>
> With your suggestion, everything worked out, until we want a filled map.
>
> I am working like these
>
> ;define the resource:
>
>    res                      = True
>    res at gsnMaximize          = True
>
>    res at gsnDraw              = False
>    res at gsnFrame             = False
>
> ;define the work station
>    wks = gsn_open_wks("x11", out_flnm)
>
> ;the map
>    map_projection = "Mercator"
>
>   ;Set some map resources.
>    res at mpProjection      = map_projection   ; choose projection
>
>    res at mpLimitMode       = "LatLon"
>    res at mpMinLatF         =  -85.0
>    res at mpMaxLatF         =   85.0
>    res at mpMinLonF         = -180.0
>    res at mpMaxLonF         =  180.0
>
>       res at mpOutlineBoundarySets = "National"
>       res at mpNationalLineColor = 1
>       res at mpGridAndLimbOn     = True
>
>       res at mpLandFillColor        = "Wheat3" ; was "GoldenRod1" or "Tan"
>       res at mpOceanFillColor       = "SlateGray2" ; was "LightBlue1"
>       res at mpInlandWaterFillColor = "SlateGray2" ; was "LightBlue1"  ; was
> "PaleTurquoise3"
>
> Then I draw front as:
>   ;print("xlat = " + xlat + ", xlon = " + xlon)
>    wmdrft(wks, xlat, xlon)   ; Draw front.
> (and quite few of them)
>
> And later:
>
>    pline = gsn_add_polyline(wks, plot, xlon, xlat, p_res)
> (and may other similar)
>
> and finally:
>
> draw(map)
>  frame(wks)
>
>
> Now the front was draw first (without map), and then others draw on map,
> And covered the fronts draw on the wks before.
>
> How can adjust the order to make the front draw last on top of the map?
>
> Thanks,
>
> Wei Huang
>
>
> -----Original Message-----
> From: David Brown [mailto:dbrown at ucar.edu]
> Sent: Tuesday, July 14, 2015 1:54 PM
> To: Wei Huang
> Cc: Adam Phillips; ncl-talk at ucar.edu
> Subject: Re: [ncl-talk] Add polyline, polygon, and polytext to a map
> generates two PNG files.
>
> Wei,
> You should use a different set of resources for the poly functions from
> the ones you use for the gsn_csm_map call.
>  -dave
>
> On Tue, Jul 14, 2015 at 12:18 PM, Wei Huang <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]
> > Sent: Tuesday, July 14, 2015 1:07 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,
> >
> > 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> 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
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > 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/   303-497-1726
> >
> >
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > 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/   303-497-1726
>
>
>



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

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150715/5e98dab9/attachment.html 


More information about the ncl-talk mailing list