Below are a few basic, useful IDL commands:
; it is necessary to declare the arrays first and then copy into them from a ; variable since IDL won't let you read from a file into an array directly ; this example is for an ASCII file, but you can read in binary, too stuff = strarr(45) ; assumes 45 or fewer characters per line newarr = fltarr(num lines in file); if you don't know num lines, you can open nextarr = fltarr(num lines in file); the file and count the number of lines and close it openr,unit no`um, "filename" WHILE NOT EOF (unitnum) readf,unitnum, stuff newarr(counter) = strmid(stuff,0,10) ; the first ten chars are the first array nextarr(counter) = strmid(stuff,10,5); the rest of the line goes in this array ENDWHILE close, unitnum
plot,x,y,keywords - for a linear-linear plot
plot_io, x, y, keywords - for a linear-log plot
plot_oo, x,y, keywords - for a log-log plot
surface, x,y,z, keywords - for a 3-D surface plot
contour, x,y, keywords - for a contour plot
tv, x,y,keywords - for an image display
image_cont - overlays a contour plot over a tv image
*note- the contour doesn't lay right over the image.
See my routine quickpic.pro for another way
to do this
To plot more than one panel per page, type in:
!p.multi=[x,y,z] ; this is for num plots in x,y,and z
Then type in your plot commands. Remember to reset your
values of [x,y,z] to [0,0,0]when you're done.
To display to a postscript file rather than to the screen, type in:
set_plot,'ps' device,/landscape,filename='theanswer.ps'; for a landscape plot--portrait is the default
After issuing the desired display commands, type in:
device,/close
openw,unitnum, "filetofill" printf,unitnum, variable close,unitnum,"filetofill"
IDL> .run fun
To execute the file, type in:
IDL> fun
Alternatively, you can create a make file that will automatically reset all your variables recompile everything. When you are editing several files at once, this is a handy way to go to avoid having to remember exactly where you've made changes since the last execution. Here's what the make.pro file looks like:
retall .run main_driver .run fun .run sleep .run dontDoThesis .run neverGraduate
Then to compile everything and call the main driver, type in:
IDL> @make
IDL> main_driver
Bidushi Bhattacharya
Dept of Atmos Sciences
UCLA
19 April 1998
bhattach@atmos.ucla.edu