[ncl-talk] Question about adding location dots
Barry Lynn
barry.h.lynn at gmail.com
Tue Dec 27 13:01:49 MST 2016
Hi:
The problem with this suggestion (I think) to loop is that I am not sure
how to include the ncities parameter.
These variables were originally defined this way.
textid = new(ncities,graphic) ; Create array to hold text objects
markid = new(ncities,graphic) ; Create array to hold marker objects
If I define and loop as you suggest below, then I get an error that the LHS
and RHS dimensions do not match (after commenting out two lines above, and
including the definitions for markid and textid similar to plot.
fatal:Dimension sizes on right hand side of assignment do not match
dimension sizes of left hand side
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 549 in
file ./wrf_gsn_loop_t_light_ave_prob.ncl
Barry
On Tue, Dec 27, 2016 at 5:26 PM, Mary Haley <haley at ucar.edu> wrote:
> 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
>>
>>
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161227/0f170d07/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_gsn_loop_t_light_ave_prob.ncl
Type: application/octet-stream
Size: 20707 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161227/0f170d07/attachment.obj
More information about the ncl-talk
mailing list