[ncl-talk] animation: delete polyline from plot ?
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Sat May 21 14:50:42 MDT 2016
Hi Rick,
indeed this is what I want. Thanks for the hint!
I was thinking about drawing the map every time again but I rejected the
idea because I have more than 100 flights at one time step. But I will
give it a try now. ;-)
Have a nice weekend!
Karin
Am 21.05.16 um 17:41 schrieb Rick Brownrigg:
> Hi Karin,
>
> Rather than use gns_add_polyline, which associates the line with the
> plot, what about gsn_polyline, which just graphically overlays the
> line. I think I was able to achieve something like what you are after
> with the attached script. The essence of the drawing is this:
>
> deltaLon = (lon2 - lon1) / 5.
> deltaLat = (lat2 - lat1) / 5.
> do i=0,4
> draw(plot1)
> gsn_polyline(wks, plot1, (/lon1+deltaLon*i,
> lon1+deltaLon*(i+1)/), \
> (/lat1+deltaLat*i, lat1+deltaLat*(i+1)/), \
> pres)
> frame(wks)
> end do
>
> Hope that helps...
> Rick
>
> On Fri, May 20, 2016 at 3:50 PM, Karin Meier-Fleischer
> <meier-fleischer at dkrz.de <mailto:meier-fleischer at dkrz.de>> wrote:
>
> Hi,
>
> is it possible to delete a polyline added to a simple map plot by
> gsn_add_polyline after it was drawn?
>
> I have flight trace data consisting of many segments per flight
> which I
> am animating segment by segment. This is not a problem. The idea
> now is
> to delete the first two segments after drawing 3 segments and
> further on
> to simulate a moving trace part to the end point (like a disappearing
> trail).
>
> The following snippet will cause an error:
>
> do n=0,nsegemnts-1
> str = unique_string("trace")
> map@$str$ =
> gsn_add_polyline(wks,map,(/x(n-1),x(n)/),(/y(n-1),y(n)/),pres)
>
> if(n .gt. 2) then
> trold0 = "trace"+(n-3)
> trold1 = "trace"+(n-2)
> delete([/map@$trold0$,map@$trold1$/])
> end if
>
> end do
>
> warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
> warning:TransformPostDraw: tfPolyDrawList element 1 is invalid
> warning:Attempt to reference attribute (trace1) which is undefined
>
>
> Due to the huge number of segments I would want to 'switch' the first
> segments off, if possible, and not to draw each single plot from
> scratch
> again for each flight .
>
> Bye,
> Karin
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160521/fad84270/attachment.html
More information about the ncl-talk
mailing list