[ncl-talk] list array?

Walter Kolczynski walter.kolczynski at noaa.gov
Wed Apr 13 09:40:29 MDT 2016


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 list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160413/5de3e79a/attachment.html 


More information about the ncl-talk mailing list