|
This utility routine is a pop-up dialog widget that allows the user to select one
or more "names" from a string array of names. I use it to give the user a list of scientific
data sets inside an HDF file. This program is similar to
Name_Selector, but I find it easier to use and
make selections when you have a large number of selections.

|
|
|
Creates a transparent image either from a supplied image or from an IDL graphics
window. The transparent "color" can be specified as the name of a color or as a
color triple. Optionally, the transparent image can be saved as a transparent PNG
file.
Here is an example of some commands that display a transparent histogram plot
on top of an image.
IDL> cgHistoplot, cgDemoData(7), /FILL, AXISCOLOR='yellow', $
THICK=3, CHARSIZE=1.5, CHARTHICK=2
IDL> transparentImage = Make_Transparent_Image(COLOR='white')
IDL> cgImage, cgDemoData(7)
IDL> cgImage, transparentImage, Position=[0.5, 0.5, 0.95, 0.95]
|

|
|
|
This utility program allows you to obtain the maximum size of an unobstructed graphics
window in a device independent way. A graphics window constructed of this size is about
as large as the display, but is not obstructed by tool bars, task bars, start bars, etc.
|

|
|
|
This utility program allows the user to to print the maximum and minimum of a variable.
|

|
|
|
This utility routine is a pop-up dialog widget that allows the user to select one
or more "names" from a string array of names. I use it to give the user a list of scientific
data sets inside an HDF file. I will read and display the selected scientific data sets from
the file. This program is similar to
List_Selector.
|

|
|
|
This utility routine converts a number to a string. I use it primarily to convert numbers
I wish to display in a text widget. It allows you to specify how many decimal places you would
like to have in the output. This is much more flexible than IDL's normal string formatting functions,
and it works with all types of numerical values. |

|
|
|
This simple utility just copies the contents of an IDL direct graphics window
and sends it directly to the default printer, represented by the PRINTER device.
Care is taken to preserve the aspect ratio of the window and to create as large
an image as possible on the output page.
|

|
|
|
This is a utility routine that allows you to distribute IDL program libraries and find
application sub-directories relative to the directory containing the program that is currently
running. In other words, your end-users need only include directories relative to the
main program directory. You won't care where on their hard drive they place them!
If your directory structure looks like this:
.../myapp
.../myapp/data/resources
You can find your icon resources file, myicon.icn, like this:
filename = Filepath(Root_Dir=ProgramRootDir(), Subdirectory=['data','resources'], 'myicon.icn)
This program is a must if you distribute IDL program libraries.
|

|
|
|
This simple object implements a "progress bar". If you compile the program manually,
you will find an example program
at the bottom of the file that will show you how to operate the ProgressBar object.
This program requires
several programs from the Coyote Library, which you can
download
as a zip file if you like.
|

|
|
|
Unless you are careful in IDL, your random numbers may not be all that random.
(See Random Numbers Are...Uh, Repeating.)
This RandomNumberGenerator object will protect your random number seed so that you
can continue to generate random number sequences from any of your program modules.
Perhaps the best way to make random numbers available to your IDL programs is to
make this random number generator object a system variable that can be accessed by
any IDL program module.
IDL> DefSysV, '!RNG', Obj_New('RandomNumberGenerator')
IDL> randomNumbers = !RNG -> GetRandomNumbers(3)
IDL> Print, randomNumbers
0.089239137 0.77428782 0.069180504
Any keywords and parameters appropriate for the IDL RandomU function can be used
with this object.
|

|
|
|
This utility program returns the range ([minimum, maximum]) of a vector or array.
|

|
|
|
This utility program replicates or tiles a 2D matrix or array by an integer number
of colums and rows. It is similar to the MatLab RepMat command.
|

|
|
|
When save objects are restored, they are almost always restored without their methods.
That is to say, the object code has not yet been compiled when an object is restored, so
it is not possible to call a method on a restored object without encountering an error. This
Resolve_Object program solves the problem in an efficient way by compiling object and superclass
object methods only if they need to be compiled. Simply restore your object, and then pass it to
Resolve_Object and you are ready to use your object normally.
|

|
|
|
Given the reverse indices vector obtained from the Histogram command and an index number, this
routine will return the indices as a result of the function. A COUNT keyword will tell you how
many indices are available. The function makes it much easier to use the reverse indices vector.
IDL> h = Histogram(cgDemoData(7), REVERSE_INDICES=ri)
IDL> bin5Indices = ReverseIndices(ri, 5, COUNT=count)
|

|
|
|
This utility program allows the user to save or export a variable to the main IDL level (normally
where IDL commands are typed) from within a procedure or function. I use it when debugging code
and I want to save an image to the main IDL level for further inspection with other interactive
programming tools.
|

|
|
|
This simple utility routine allows you to scale all the points in a vector
between a minimum and maximun value. The minimum value of
the vector (or array) is set equal to the minimun data range. And
the maximun value of the vector (or array) is set equal to the
maximun data range. The program is useful for scaling latitude and
longitude vectors for contour plots on map projections, for example. |

|
|
|
This program is
more or less a drop-in replacement for the Window command in IDL, with this significant
difference: if the requested graphics window size is larger than the display size, the
graphics window is returned in a scrollable base widget so the user can scroll around
in the larger graphics window. I find this program useful when I need to create
large windows on my desktop machine, but still want to be able to see the full-resolution
output on my laptop, which has a lower resolution display. |

|
|
|
This program set the current color decomposition state of a graphics device in
a device-independent and version-independent manner. An output keyword, CurrentState, is availabe to
return the current color decomposition state of the device at the time it is set. This avoids a problem
with UNIX machines obtaining the state in a different way than Windows machines.
|

|
|
|
This utility program sets the default values for positional and
keyword arguments to IDL commands.
|

|
|
|
This utility program finds the difference between two sets of integers. In other words,
it return the integers that are found in set A, but are missing from set B.
IDL> set_a = [1,2,3,4,5]
IDL> set_b = [4,5,6,7,8,9,10,11]
IDL> Print, SetDifference(set_a, set_b)
1 2 3
|

|
|
|
This utility program finds the intersection between two sets of integers. In other words,
it return the integers that are found in both set A and set B.
IDL> set_a = [1,2,3,4,5]
IDL> set_b = [4,5,6,7,8,9,10,11]
IDL> Print, SetIntersection(set_a, set_b)
4 5
|

|
|
|
This utility program finds the union between two sets of integers. In other words,
it return the integers that are found in set A and set B combined.
IDL> set_a = [1,2,3,4,5]
IDL> set_b = [4,5,6,7,8,9,10,11]
IDL> Print, SetUnion(set_a, set_b)
1 2 3 4 5 6 7 8 9 10 11
|

|
|
|
The purpose of this program is to allow the user to browse a very narrow
selection of shapefiles. Namely, those containing geographical shapes
in latitude and longitude coordinates. In other words, shapefiles
containing maps. File attributes are listed in the left-hand list
widget. Clicking on a file attribute, will list all the entity
attributes for that file attribute in the right-hand list. Clicking
an entity attribute with list the type of entity, and the X and Y
bounds of that entity (shown as LON and LAT, respectively), in the
statusbar at the bottom of the display.
Knowing the attribute and entity names of a shapefile will give
you insight into how to read and display the information in the file.
For examples, see the Coyote Library programs DrawCounties and DrawStates.
|

|
|
|
The purpose of this program is to provide an efficient algorithm for sorting an array by individual
rows. The program, described by JD Smith, the author, “as a friend to HIST_ND”, was the result of a
long discussion on this topic on the IDL newsgroup. This was the most efficient algorithm of several
that were offered and discussed. It is offered here with JD's permission.
|

|
|
|
This function allows you to calculate a character size for a particular
string, so that the string width is close to a specified target width
in the current graphics window. The function is particularly useful
with respect to sizing strings in resizeable graphics windows. The target
width is specified in normalized units.
|

|
|
|
This function provides a way of specifying 44 different plotting symbols
for use with graphics commands such as PLOT and OPLOT. The return value of the
function is used as input to the PSYM keyword. For example, to display a plot with
hourglass symbols (symbol number 19), you would type this:
Plot, findgen(11), SymSize=2, PSym=SYMCAT(19)
|

|
|
|
This small utility program can take a long line of text and break it into a string array at
some arbitrary maximum length. I find it useful for breaking up a long error message produced
with MESSAGE into a string array suitable for display in DIALOG_MESSAGE.
|

|
|
|
This utility routine simply returns the names of the months in various formats. It is useful for
labeling graphics displays and so forth. The user can ask for a specific month by giving a month index.
Formats, in addition to the normal months, include all capital letters, three-letter abbreviations, and single letters. |

|
|
|
This utility routine creates a time stamp in one of 11 different formats. Optionally,
a sequence of any number of random digits can be appended to the time stamp. Local or
UTM time can be specified. And the time stamp can be formatted in a way that is appropriate
for use in an IDL variable name.
IDL> FOR j=0,10 DO Print, TimeStamp(j)
_sun_feb_07_21:24:54_2010
_Sun_Feb_07_21:24:54_2010
_07_02_2010_21:24:54
_07022010_21:24:54
_07022010
_07Feb2010_21:24:54
_07feb2010_21:24:54
_07FEB2010_21:24:54
_02_07_2010_21:24:54
_02072010_21:24:54
_02072010
|

|
|
|
There has been extensive discussion lately on the IDL newsgroup about the most efficient
method for rotating volumetric data. Several algorithms were tried and discussed. This algorithm,
by Martin Downing in the UK, is the current favorite. It processes the volume in "chunks", which
could, in theory, make it suitable for parallelization.
|

|
|
|
This is a simple utility program
to delete or undefine a variable from within an IDL program. It is a more powerful
version of DelVar, which can only be used at the main IDL level.
|

|
|
|
This small utility program can determine if a specified IDL graphics window is currently open
and available to receive graphics commands.
|

|
|
|
This simple utility routine for changing directories is written
by Paul Sorenson and included here with his permission. It works on VMS and Windows
machines only. This is one of those incredibly useful programs that make you think:
"Now how come I didn't think of that!" It is an
excellent example of how to write a widget program with an object-oriented design.
All the programs you need are available in this zip file.
|

Version of IDL used to prepare this article: IDL 7.0.1.


Copyright ©
1996–2012 Fanning Software Consulting, Inc.
Last Updated: 21 March 2011
|