[ncl-talk] Question about adding location dots

Mary Haley haley at ucar.edu
Tue Dec 27 08:26:52 MST 2016


Hi Barry,

When you have an error message you don't understand, you can either check
our FAQ or our error messages page. You can find a link to both of these
pages under the "Support" menu on the black bar of any NCL web page. These
are the direct links:

http://www.ncl.ucar.edu/FAQ/#err_msgs
http://www.ncl.ucar.edu/Document/Language/error_messages.shtml

You will find a reference to this error message here:

http://www.ncl.ucar.edu/FAQ/#err_msgs_027


Whenever you add markers, text, lines, or polygons to a plot using one of
the gsn_add_xxxx functions, you need to use a unique variable name.

You currently have:

    markid = gsn_add_polymarker(wks,plot(0),lon,lat,mkres)
    textid = gsn_add_text(wks,plot(0),cities,lon,lat,txres)
    markid = gsn_add_polymarker(wks,plot(1),lon,lat,mkres)
    textid = gsn_add_text(wks,plot(1),cities,lon,lat,txres)
    markid = gsn_add_polymarker(wks,plot(2),lon,lat,mkres)
    textid = gsn_add_text(wks,plot(2),cities,lon,lat,txres)
    markid = gsn_add_polymarker(wks,plot(3),lon,lat,mkres)
    textid = gsn_add_text(wks,plot(3),cities,lon,lat,txres)

What happens is that you are reassigning markid and textid, and hence those
markers and text go away. You need to make each variable different.

You can either do something like this:

    markid0 = gsn_add_polymarker(wks,plot(0),lon,lat,mkres)
    textid0 = gsn_add_text(wks,plot(0),cities,lon,lat,txres)
    markid1 = gsn_add_polymarker(wks,plot(1),lon,lat,mkres)
    textid1 = gsn_add_text(wks,plot(1),cities,lon,lat,txres)
    markid2 = gsn_add_polymarker(wks,plot(2),lon,lat,mkres)
    textid2 = gsn_add_text(wks,plot(2),cities,lon,lat,txres)
    markid3 = gsn_add_polymarker(wks,plot(3),lon,lat,mkres)
    textid3 = gsn_add_text(wks,plot(3),cities,lon,lat,txres)

or even better, up where you define "plot", add these lines:

; define number of panel plots
  plot = new(4,graphic)
  markid = new(4,graphic)
  textid = new(4,graphic)

and then, since you are adding the same markers and text to all four plots,
you can use a loop right before you call gsn_panel:

  do n=0,3
    markid(n) = gsn_add_polymarker(wks,plot(n),lon,lat,mkres)
    textid(n) = gsn_add_text(wks,plot(n),cities,lon,lat,txres)
  end do

--Mary




On Mon, Dec 26, 2016 at 6:33 AM, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Hi:
>
> I have attached an ncl program that is suppose to add location dots.
>
> They get added to the last map, but not the first.
>
> I also want to center the time over the whole set of maps, not the first.
>
> I get this warning, which is probably relevant.
>
> Fontconfig warning: ignoring UTF-8: not a valid region tag
> warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
>
> I saw this from Mary Haley, but wasn't sure if it/how applies to my script.
>
> Thank you,
>
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108 <(914)%20432-3108>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161227/470917f7/attachment.html 


More information about the ncl-talk mailing list