It is important to choose the best data storage for your application. A good list of all IDL data types is given here:
http://www.exelisvis.com/docs/IDL_Data_Types.html
I am organizing this page in terms of data storage elements.
Array (vector)
Arrays can be made from several data types such as bytes, integers, floats and doubles.
see:
http://michaellapsley.blogspot.com/2015/03/idl-notebook-arrays.html
Arrays are very useful for mathematical calculations typical for solving linear systems. Arrays can take advantage of matrix algebra and transformations.
The size of the array must be defined at its creation. The size can change but changing the size of an array in a loop can cause issues. Arrays must remain rectangular (All rows are the same length; All columns are the same length).
List
Lists (
http://www.exelisvis.com/docs/LIST.html) can be made from any data type, but a single list can only contain elements of one data type. Lists are one dimensional
Lists are useful because their length must not be defined. This is useful in cases where you might not know how long the list will become. For example, if you are writing a loop to search for the number of times a event occurs when that number is initially unknown.
First, initialize the list:
IDL> list1 = list()
Then add stuff to the list:
IDL> list1.add,1
IDL> list1.add,10
IDL> list1.add,100
IDL> list1.add,2
IDL> print, list1
1
10
100
2
Then convert the list to an array:
IDL> array1 = list1->toarray()
IDL> print,array1
1 10 100 2
There are lots of other list operations (
http://www.exelisvis.com/docs/LIST.html)
Structures
Structures (
http://www.exelisvis.com/docs/Creating_and_Defining_St.html) are useful because you can sort different types of elements in a structure. Elements of structures can be in of different data types and different sizes. This allows flexible data management in IDL.
IDL> structure1 = {item1:list1,item2:array1,item3:'[1,2,3,4,5]', item4:['fish','duck']}
IDL> print,structure1
{<ObjHeapVar5(LIST)> 1 10 100 2
[1,2,3,4,5]
fish duck
}
IDL> print,structure1.item1
1
10
100
2
There are many ways to define and alter structures. Structures can even store other structures, giving the user the ability to create multi-dimensional data structures.
IDL> structure2 = {thing1:structure1,thing2:structure1}
IDL> print,structure2
{{<ObjHeapVar5(LIST)> 1 10 100 2
[1,2,3,4,5]
fish duck
}{<ObjHeapVar5(LIST)>
1 10 100 2
[1,2,3,4,5]
fish duck
}}
The user can immediately access any level of a multidimensional structure.
IDL> print,structure2.thing1.item1
1
10
100
2
Enjoy
Objects
http://hesperia.gsfc.nasa.gov/rhessidatacenter/complementary_data/objects/objects.html