# What's New in IDL 8.0

IDL 8.0 provides some ground-breaking functionality to make data visualization and IDL programming easier than ever. The new graphics functions allow you to create visualizations on the fly or within a program. You can also use create graphics singly or in batches and save the output files. The language enhancements make IDL programming more intuitive and straightforward.

These features, along with a simplified IDL Workbench, will streamline the workflows you use to visualize and analyze your data. And most importantly, IDL 8.0 maintains backward compatibility for your existing IDL code.

# Graphics Functions

IDL 8.0 provides new graphics functions to easily visualize your data. Rather than writing a program, you can quickly type just a few lines to display a plot, map, image or other visualization. For example, type or paste the following into the IDL command line:

; Define the data set.

data1 = SIN((FINDGEN(15)+1)/15*!PI/2)

data2 = data1 + COS((FINDGEN(15))/15*!PI/2)

data3 = data2 + 0.25 + RANDOMU(1,15)

; Plot three bars, stacked.

b1 = BARPLOT(data1, BOTTOM_COLOR="white")

b2 = BARPLOT(data2, BOTTOM_VALUES=data1, $

FILL_COLOR='yellow', BOTTOM_COLOR="white", /OVERPLOT)

b3 = BARPLOT(data3, BOTTOM_VALUES=data2, $

FILL_COLOR='red', BOTTOM_COLOR="white", /OVERPLOT)

; Add a title.

b1.TITLE='$sin(\omega\pi/2) + cos(\omega\pi/2) + \nu$'

; Save to a PDF file.

b1.SAVE, 'barplot.pdf', /LANDSCAPE

With the new graphics functions, it is easy to create complex plots, modify the graphics on the fly, and then output to multiple file formats. These new graphic functions are designed to replace the use of Direct Graphics and iTools (although those procedures still exist).

See the Graphics examples for many ways you can use the new graphics functions.

Graphics functions include: PLOT BARPLOT ERRORPLOT POLARPLOT PLOT3D IMAGE CONTOUR SURFACE MAP VECTOR STREAMLINE WINDOW WIDGET_WINDOW | These graphics helper functions enhance graphics: MAPGRID MAPCONTINENTS LEGEND COLORBAR TEXT POLYGON POLYLINE AXIS ELLIPSE GETWINDOWS

Features of the new graphics include:

- Dot notation - easily change graphics properties using the dot “.” and structure notation from the command line after graphics are created
- Display multiple visualizations in one graphics window
- Use mathematical and Greek symbols and other special characters in graphics
- Add annotations such as text, lines and arrows, circles and polygons
- Save as PDF from graphics

# Language Enhancements

IDL 8.0 provides major language enhancements that are intuitive and easy to use.

## !NULL

Use !NULL or empty brackets [ ] to create an empty array that can be used for array concatenation. Other uses include comparison with undefined variables or to test for null objects or pointers. !NULL or empty braces { } can also be used for structure concatenation. Finally, !NULL can be used to assign to variables or function results to free memory.

## Garbage collection

Automatic garbage collection eliminates the complexities of manual object and pointer memory management. IDL now performs automatic garbage collection on all data types so that when a variable is destroyed or goes out of scope, the variable’s memory is automatically reclaimed. The HEAP_REFCOUNT routine was added to facilitate working with automatic garbage collection. It returns the current reference count for a pointer or object reference.

## LIST

A list is a compound data type that can contain elements of any IDL data type, including scalars, arrays, structures, pointers, object references, and other lists.

Lists have the following properties:

- Elements in a list are ordered, and are indexed in one dimension.
- Lists can change their size, growing and shrinking as elements are added or deleted, with no performance penalty or copying.
- Individual list elements can change their value and data type without performance penalty.

See the new LIST function for more information.

## HASH

A hash is a compound data type that contains key-value pairs of different data types, including any mixture of scalars, arrays, structures, pointers, object references, lists, and other hashes.

Hashes have the following properties:

- Elements in a hash are unordered, and are indexed by a scalar key (either a number or a string).
- Hashes can change their size, growing and shrinking as elements are added or deleted, with no performance penalty or copying.
- Individual hash elements can change their value and data type without performance penalty.

See the new HASH function for more information.

## FOREACH operator

Use the FOREACH operator to iterate through the values of an array, list, or hash. The FOREACH statement executes one or more statements for each element of a variable. Within the FOREACH loop, the element’s value and (optionally) the key or index to which the element corresponds are available.

## Negative Array Indices

When subscripting an array using scalar subscript values, you can use negative integers to index the array from the last element of the dimension being indexed. For example, the statement

PRINT, array[-1]

is a simple way to select the last element of array without knowing how many elements array contains. The above statement is equivalent to:

PRINT, array[N_ELEMENTS(array)-1]

Similarly, to select the third element from the end of a the array:

PRINT, array[-3]

You can select an element of a multidimensional array using negative subscript values. For example:

mdstrarr = [['row1_col1', 'row1_col2', 'row1_col3'], $

['row2_col1', 'row2_col2', 'row2_col3'], $

['row3_col1', 'row3_col2', 'row3_col3']]

The following two statements print the same element in mdstrarr:

PRINT, mdstrarr[-3,-2]

PRINT, mdstrarr[0,1]

IDL Prints:

row2_col1

row2_col1

For more information, see Using Scalar Values as Array Subscripts.

## Variable Type Functions

The ISA function tests for valid variables, types, structure names, object names, or whether an element is an array. The TYPENAME function returns information about a variable's type, structure name, or object class.

## Object Syntax

The object syntax has been simplified for all IDL object classes, making it more like standard programming languages.

- To create an object, you need to use only the name of the class as though it were a function. For example, instead of using OBJ_NEW("Classname"), the new syntax looks like the following:

myContainer = IDL_Container( )

- To call methods on an object, you can now use "." instead of "->". For example:

myContainer.Add, IDLgrModel()

print, myContainer.Count()

- To destroy objects, instead of calling OBJ_DESTROY, obj, you can now do:

myContainer.Cleanup

## IDL_Object and Property Access

The new IDL_Object class is designed to be the base class for all user-defined classes. By subclassing from IDL_Object, you gain the benefits of the new object syntax, as well as the potential for operator overloading (described below). In addition, you can use a simplified "." syntax to automatically call your GetProperty and SetProperty methods. For example,

myObject = MyClass()

print, myObject.COLOR

myObject.COLOR = "red"

Here, we are creating the object using the new syntax. In the second line, the COLOR property is being retrieved. IDL will automatically call your GetProperty method on MyClass with the COLOR keyword. For the third line, IDL will automatically call your SetProperty method with the COLOR keyword.

## Operator Overloading

Operator overloading is an advanced feature to perform a specific object method when an operator is performed on that object. For example, you might want to define the "+" operator, such that when two objects are added together, it combines the internal properties in a predetermined manner and returns a third object with the results. By subclassing from IDL_Object, you can override all of IDL's standard math operators, as well as the logical operators, true/false, N_ELEMENTS and SIZE, HELP and PRINT, array indexing, and the FOREACH statement.

See the list of operators that can be overloaded.

# Simplified IDL Workbench User Interface

The Workbench consists of three basic views for an uncluttered work space. Just the project explorer, editor and console/command line are shown.

- The toolbar contains larger icons for file management, editor and debugging features
- Code templates are available from the editor or the workbench source menu
- The current working directory is displayed and can be changed from the Workbench

## Save to PDF

IDL 8.0 allows you to save visualizations in Adobe Acrobat's portable document format (PDF). This functionality supports saving multiple pages and gives you the option to save as vector or bitmap graphics. Use the new IDLgrPDF object class or save from the graphics window.

# Scientific Data Formats

- Updates to HDF5 1.8.4 and NetCDF 4.1 libraries, and CDF library (version 3.3)
- Added the following new NetCDF routines:
- NCDF_DIMIDSINQ
- NCDF_FULLGROUPNAME
- NCDF_GROUPDEF
- NCDF_GROUPNAME
- NCDF_GROUPSINQ
- NCDF_GROUPPARENT
- NCDF_NCIDINQ
- NCDF_VARIDSINQ

# Help

The online help has been reorganized to make common items easily accessible. Some documentation is available in PDF format in the `help/pdf` directory of your IDL installation.

This material includes material on connectivity bridges, application and object programming, external development, and scientific data format examples.

# Miscellaneous

- The Workbench provides a preference to control "on top" behavior of the graphics windows.
- Updated the IDL Workbench to Java JRE 1.6.
- IDLgrSymbol now supports filled symbols. There are also 15 new plot symbols.
- IDLffDICOM read now supports Windows 64-bit and Mac Intel 64-bit.
- READ_CSV and WRITE_CSV now allow multiple rows in the header.
- RESTORE now automatically compiles class and structure definitions within the save file.
- !COLOR system variable contains all 147 web colors.
- MAP and MAP_PROJ_INIT functions: Added Cylindrical Equal Area map projection, and ellipsoid support for Lambert Azimuthal.
- New DIMENSION keyword to KURTOSIS, MOMENT, STDDEV, MEAN, VARIANCE, SKEWNESS.
- FOR loops now automatically promote loop variable to larger integer type if necessary.