<--Back to IDL Decal

How to Interpret Function and Procedure Listings in Alphabetical IDL





Why do we need Alphabetical IDL?

Lets say that you know you need to use a certain procedure or function to do something, but you're not sure how to implement it. For example, someone tells us we need to use CONGRID to resize an image array. We've never heard of CONGRID, so we look it up! A great place to look up IDL functions and procedures is: Alphabetical IDL. We can scroll through the alphabetical listings and find CONGRID.

Syntax

First, is CONGRID a function or procedure? This will determine how we use it and the proper syntax to use. The first line in the CONGRID description reads, "The CONGRID function shrinks or expands the size of an array by an arbitrary amount.". So, clearly it is a function. We can also tell by looking at the SYNTAX section.

"Result = CONGRID( Array, X, Y, Z [, /CENTER] [, CUBIC=value{-1 to 0}] [, /INTERP] [, /MINUS_ONE] )".

It takes the form RESULT = FUNCTION( INPUT, [[ /KEYWORD ], [ KEYWORD=KEYWORD ]])
as opposed to PROCEDURE, INPUT, [[ /KEYWORD ], [ KEYWORD=KEYWORD ]]

Here are the important things that tell us how to use CONGRID:

Returned Value

Result = CONGRID( Array, X, Y, Z [, /CENTER] [, CUBIC=value{-1 to 0}] [, /INTERP] [, /MINUS_ONE] )

First is RESULT (described under the RETURNED VALUE heading). This is the OUTPUT of CONGRID. We type a variable name for this.
Example: NEW_ARRAY = CONGRID( ... )

Arguments

Result = CONGRID( Array, X, Y, Z [, /CENTER] [, CUBIC=value{-1 to 0}] [, /INTERP] [, /MINUS_ONE] )

Next is ARGUMENTS (the inputs of the function). These are usually mandatory unless otherwise specified in the ARGUMENTS description. Notice how they are not in square brackets. Square brackets denote optional inputs.

Keywords

Result = CONGRID( Array, X, Y, Z [, /CENTER] [, CUBIC=value{-1 to 0}] [, /INTERP] [, /MINUS_ONE] )

KEYWORDS are specified either by typing /KEYWORD or KEYWORD=VALUE. The are usually not mandatory, and when specified, they should follow the arguments. Some times KEYWORDS depend on eachother, and can be listed with nested square brackets, like so: [ KEYWORD1, [ KEYWORD2 ] ]. This implies that KEYWORD2 should only be specified if KEYWORD1 is specified, and also that KEYWORD1 is optional, and if listed, KEYWORD2 is optional.

Examples

Probably the most useful part of the function listing is the EXAMPLES section. It shows clearly how to use the basic feature of the function.

The CONGRID listing reads:

"Given vol is a 3-D array with the dimensions (80, 100, 57), resize it to be a (90, 90, 80) array
vol = CONGRID(vol, 90, 90, 80)"

Meaning, if we type the above at the IDL> prompt, the VOL array will be resized to the specified dimensions.



Update: Paul Higgins - January 15, 2007 - UG Astro, Department of Astronomy, University of California at Berkeley