[ncl-talk] list array?
Dennis Shea
shea at ucar.edu
Wed Apr 13 09:45:37 MDT 2016
WK ... thx for replying
One minor alternative .... Rather than
delete(intensity)
delete(duration)
delete(center_lon)
delete(center_lat)
You can delete multiple variables via
delete([/intensity, duration, center_lon, center_lat/])
On Wed, Apr 13, 2016 at 9:40 AM, Walter Kolczynski <
walter.kolczynski at noaa.gov> wrote:
> Yongil,
>
> Unfortunately, NCL doesn't support custom structures. The best way might
> be to create a list for the intensity with duration and location as
> attributes. Something like this:
>
> intensityList = NewList("fifo")
> do i=0, nEvents-1, 1
> <read in data>
> intensity at duration = duration
> intensity at center_lon = center_lon
> intensity at center_lat = center_lat
> ListPush( intensityList, echo(intensity) )
> delete(intensity)
> delete(duration)
> delete(center_lon)
> delete(center_lat)
> end do
>
> Where echo is a function I often use with lists that returns an anonymous
> copy so the list retains the variable if it is deleted:
>
> if isdefined("echo") then undef("echo") end if
> function echo(variable)
> local variable2
> begin
> variable2 = variable
> return variable2
> end ; echo
>
> The downside to this method is that you can't have metadata on the
> duration or locations. The other option is to create a list for each
> variable, which breaks their connection but allows you to keep the metadata.
>
> - Walter
>
>
> On 2016-04-13 11:24, Sitan Heyl wrote:
>
> Hi, All
> I want to create an array of blocking event, every event contains
> intensity, duration, center_lon(duration), center_lat(duration). because
> center_lon depends on the duration, so I wonder if there is one method to
> create an array, in which every member is a list to include variable
> (intensity, duration) and array(center_lon,center_lat). I think this is
> similar to structure in C/C++ Language. Any help is welcoming.
>
> Best,
> Yongli
>
>
> _______________________________________________
> ncl-talk mailing listncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=oa-2200-c> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=oa-2200-c>
>
> _______________________________________________
> 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/20160413/87b2dcaa/attachment.html
More information about the ncl-talk
mailing list