Program Naming Conflicts in IDL 8
QUESTION: I am having trouble getting program [Legend, Colorbar, etc.] running after I installed IDL 8. Do you have any idea why?
ANSWER: Yes I do. The IDL 8 distribution includes several programs, written in the IDL language, that conflict with programs of the same name in several popular IDL libraries. I will list the conflicts as they come to my attention and list the ways the library providers have chosen to deal with the problem. Most of the time, some kind of action will be required on your end to sort the problem out. All of these solutions are flawed in one way of the other, but there is no easy or perfect way to solve the problem.
The problem is basically this. IDL's new graphics programs in IDL 8 are written as IDL functions. Normally, there is no conflict between an intrinsic (or built-in) IDL function and a user-written procedure with the same name, or visa versa. IDL can keep a procedure and function with the same name straight. But, when the procedure and the function are both written in the IDL language, IDL can only find the first one on the IDL path (!PATH) using its automatic compilation algorithms. The conflict comes about because IDL 8's new graphics programs are not intrinsic functions, but are, instead, user-written functions. These new functions reside in the /lib/graphics sub-directory of the main IDL directory.
The problem symptom depends on which module (the procedure or the function) you wish to use, and the order in which IDL path directories are searched. Consider, for example, the conflict with the NASA Astronomy Library routine, Legend. If the IDL libraries (normally indicated in path specifications as <DEFAULT>) are on your path before the NASA Astronomy Library, then when you try to run the NASA Legend routine, you find a message like this:
IDL> legend % Compiled module: LEGEND. % Attempt to call undefined procedure/function: 'LEGEND'.
In this case, the IDL graphics function, named Legend, was compiled, and you are trying to run it as a procedure.
On the other hand, if the NASA Astronomy Library routines are on your IDL path before the default IDL directories, and you try to run the IDL Legend function, you will get an error like this:
IDL> l = legend(TARGET=[p1,p2], POSITION=[140,0.9], /DATA) % Compiled module: LEGEND. % Attempt to call undefined procedure/function: 'LEGEND'.
In this case, the NASA Legend procedure was compiled, and you are trying to run it as a function.
Here are several ways to solve the problem.
1. Order Your IDL Path to Find the Program You Want to Run
If you only want to run one or the other of these two user-written programs, but not both, the way forward is clear. Set up your IDL path so that the proper program is found first. Suppose you use a number of NASA Astronomy Library routines, but do not use the new graphics routines in IDL 8. Then, you will put the NASA Astronomy Library on your IDL path before the default IDL directories.
You could use the IDL Workbench to select your IDL path order, as in the figure below.
|Use the IDL Workbench to set your IDL path order.|
Or, you can simply set up your IDL path in an IDL start-up file, like this example, shown for a UNIX machine. (The equivalent path for Windows would use semi-colons instead of colons as the directory separators.
!PATH = Expand_Path('+~/idl/astronomy') + ':' + $ Expand_Path('+~/idl/coyote') + ':' + $ !PATH
Naturally, if you want to use the IDL 8 new graphics functions, you can just reverse the order in which directories are searched, either by moving the directories around in the IDL Workbench, or by modifying your IDL path in your start-up file.
!PATH = !PATH + ':' + $ Expand_Path('+~/idl/coyote') + ':' + $ Expand_Path('+~/idl/astronomy')
2. Compile Both the Procedure and the Function
Another solution, if you wish to have both the procedure and the function available to you, is to compile both in your IDL start-up file:
; Compile conflicting procedures and functions here. .compile ~/david/IDL/astronomy/legend .compile !IDL_DIR/lib/graphics/legend .compile ~/david/IDL/coyote/colorbar .compile !IDL_DIR/lib/graphics/colorbar
Note that not all program conflicts can be resolved this way. (See the Colorbar__Define situation below.)
3. Do a Global Search-and-Replace to New Name
In most cases, independent IDL library providers will have to bend to the will of ITTVIS and rename their library modules. Get the newly named module, replace the old module in your library, and change all your old code to reflect the new name.
Although this is a gigantic pain in the neck, it is probably the best solution for moving forward. Anything else is going to be a support nightmare for years.
Conflicts with the NASA Astronomy Library Program Legend
Wayne Landsman, the maintainer of the NASA Astronomy Library has decided to do the following with the Legend conflict.
- Added documentation to Legend to warn users to compile it in their IDL start-up files.
- Has left Legend in the Astronomy Library for now.
- Has made a copy of Legend and named it al_legend.pro. This program should be used in place of Legend going forward.
Conflicts with the Coyote Library Program Colorbar
The following changes have been made to the Coyote Library.
- The Colorbar program has been moved to a new obsolete directory that is a sub-directory of the coyote directory. This directory can be added to your IDL path or not, as you see fit.
- A new program, named cgColorbar, has been added to the Coyote Library. This has identical functionality to the Colorbar program.
- All further development and program changes will be made to the cgColorbar program.
Conflicts with the Coyote Library Program Colorbar__Define
The following changes have been made to the Coyote Library.
- The colorbar__define.pro program, which implemented a direct graphics colo rbar identical to that of the Colorbar procedure, has been renamed FSC_Colorbar Users must update all programs that use this color bar object. This is necessary because IDL 8 implements their new graphics color bar with the file colorbar__define.pro.
Version of IDL used to prepare this article: IDL 8.0
Copyright © 2010 David W. Fanning
Last Updated 26 September 2010