[ncl-talk] NCL query

Mary Haley haley at ucar.edu
Mon Feb 29 23:02:13 MST 2016


Jatin's suggestion is a good one, because you want to be careful about
plotting single markers in this way.  You have two rather large do loops
which are plotting one marker at a time. This could be incredibly slow.

I think you could also get rid of the double do loop, if you can spare a
little extra memory usage:


z2dims = dimsizes(z2)
i_save = ndtooned(conform(z2,ispan(0,z2dims(0),1),0)
j_save = ndtooned(conform(z2,ispan(0,z2dims(1),1),1)
i_save at _FillValue = -999
j_save at _FillValue = -999

z2_1d  = ndtooned(z2)
imsg   = ind(ismissing(z2_1d).or.z2_1d.ge.0)

i_save(imsg) = i_save at _FillValue
j_save(imsg) = j_save at _FillValue
add_poly = gsn_add_polymarker(wks,plot,i_save,j_save,polyres)

draw(plot)
frame(wks)

On Mon, Feb 22, 2016 at 3:10 AM, Jatin Kala <jatin.kala.jk at gmail.com> wrote:

> Here's a suggestion:
>
> i_save = new(100000,integer)
> j_save = new(100000,integer)
> counter = 0
>
> do i=0,127
> do j=0,364
> if(.not.ismissing(z2(i,j)).and.z2(i,j).lt. 0.0)then
>       i_save(counter) = i
>       j_save(counter) = j
>       counter = counter + 1
> end if
> end do
> end do
>
> add_poly= gsn_add_polymarker(wks,plot,i_save,j_save,polyres)
> draw(plot)
> frame(wks)
>
>
> On 22/02/2016 3:10 PM, Anusha sathyanadh wrote:
>
> Dear Sir,
> (haley_at_nyahnyahspammersnyahnyah)
>
> I have seen your reply to the query
>
> *to overcome this    warning:TransformPostDraw: tfPolyDrawList element 0
> is invalid *
> *> warning:TransformPostDraw: tfPolyDrawList element 1 is invalid *
> *> warning:TransformPostDraw: tfPolyDrawList element 2 is invalid *
>
>
> like
>
>
>  a = new(3,graphic)
>    a(0) = gsn_add_polygon(wks,plot,x1,y1,gsres)
>    a(1) = gsn_add_polyline(wks,plot,x2,y2,gsres)
>    a(2) = gsn_add_polymarker(wks,plot,x3,y3,gsres)
>
> but it doesnt work for my script as I have to use loop within..Can u help
> to get out of this trouble?
>
>
> do i=0,127
> do j=0,364
> if(.not.ismissing(z2(i,j)).and.z2(i,j).lt. 0.0)then
> add_poly= gsn_add_polymarker(wks,plot,i,j,polyres)
>
> end if
> draw(plot)
> end do
> end do
> frame(wks)
>
> --
>
>
>
>
> *ANUSHA SATHYANADH Senior Research Fellow Deparment of Atmospheric and
> Space Sciences Pune university *
>
>
> _______________________________________________
> ncl-talk mailing listncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> --
> Dr. Jatin Kala
> Lecturer in Atmospheric Science
> Murdoch University,Perth, Western Australia
> Tel: (+618) 9360 6297http://www.jatinkala.com/
>
>
> _______________________________________________
> 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/20160229/7379ce0c/attachment.html 


More information about the ncl-talk mailing list