IDL Version 6.0, Mac OS X (darwin ppc m32). (c) 2003, Research Systems, Inc.
Installation number: 206920.
Licensed for use by: NASA - Goddard Space Flight Center

% Compiled module: POINTSLOPE.
% Compiled module: $MAIN$.

*****Defining Variables and Arrays*****

> x = 2 
> print, x
       2
> A = [1, 3, 4] 
> print, A
       1       3       4
> B = [ [1,2,3], [4,5,6] ] 
> print, B
       1       2       3
       4       5       6
> C = [A, A] 
> print, C 
       1       3       4       1       3       4
> C = [ [A],[A] ] 
> print, C 
       1       3       4
       1       3       4
> D = [A,B] (whoops!) 
> D = [ [A],[B] ] 
> print, D
       1       3       4
       1       2       3
       4       5       6
> testarr = 3 + A 
> print, testarr
       4       6       7
> testarr = 3*A 
> print, testarr
       3       9      12
> print, A 
       1       3       4
> print, B 
       1       2       3
       4       5       6
> print, A + B 
       2       5       7
> print, A*B
       1       6      12
*****Statistics

> max_A = max(A)
> print, max_A 
       4
> mean_A = mean(A)
% Compiled module: MEAN.
% Compiled module: MOMENT.
> print, mean_A 
      2.66667


*****TYPE CONVERSIONS*****

> print, A 
       1       3       4
> print, A/3 
       0       1       1
> print, A/3.0 
     0.333333      1.00000      1.33333
> print, float(A)/3
     0.333333      1.00000      1.33333

*****Array Operations*****

*****Indexing
> c = [ [1,2,3],[4,5,6],[7,8,9] ] 
> print, c[0,0] 
       1
> print, c[0,1] 
       4
> print, c[1,1:2] 
       5
       8
> print, c[0,*]
       1
       4
       7
> print, c[4]
       5
*****Selecting array items by criteria
> gt3 = where(c gt 3) 
> print, gt3 
           3           4           5           6           7           8
> print, c(gt3)
       4       5       6       7       8       9
*****Generating special arrays
> int_zeros = intarr(3,4) 
> print, int_zeros 
       0       0       0
       0       0       0
       0       0       0
       0       0       0
> float_zeros = fltarr(3,4) 
> print, float_zeros 
      0.00000      0.00000      0.00000
      0.00000      0.00000      0.00000
      0.00000      0.00000      0.00000
      0.00000      0.00000      0.00000
> count_int = indgen(3,4) 
> print, count_int 
       0       1       2
       3       4       5
       6       7       8
       9      10      11
> count_float = findgen(3,4) 
> print, count_float
      0.00000      1.00000      2.00000
      3.00000      4.00000      5.00000
      6.00000      7.00000      8.00000
      9.00000      10.0000      11.0000
*****Array multiplication
> a = [1,2,3] 
> b = [4,5] 
> print, a#b 
           4           8          12
           5          10          15
> b = [4,5] 
> print, b#a 
           4           5
           8          10
          12          15
> print, a##b
           4           5
           8          10
          12          15

*****Files: reading and writing******

**writing....*
> a = indgen(3,4) 
> print, a 
       0       1       2
       3       4       5
       6       7       8
       9      10      11
> openw, 1, "testfile" 
> printf, 1, a
> close, 1
**reading....*
> b = intarr(3,4) 
> print, b 
       0       0       0
       0       0       0
       0       0       0
       0       0       0
> openr, 1, "testfile" 
> readf, 1, b 
> print, b 
       0       1       2
       3       4       5
       6       7       8
       9      10      11
> close, 1

*****About Functions and Procedures*****

syntax
> value = function_name(argument1, argument2,...)
> procedure_name, argument1, argument2,....

> slopevalue = pointslope(5,3,4,6) 

*****Plotting Data*****

> x = intarr(6) 
> print, x 
       0       0       0       0       0       0
> y = x^2 
*****Plot
> plot, x, y, xrange=[2,6]
*****Contour
 > z = indgen(5,5) 
> print, z 
       0       1       2       3       4
       5       6       7       8       9
      10      11      12      13      14
      15      16      17      18      19
      20      21      22      23      24
> contour, z
> contour, z, /fill0
***** Saving graphics to JPEG or TIFF*****
> image = tvrd(true=1) 
> write_jpeg, 'filename.jpg', image, quality=100, true=1
% Loaded DLM: JPEG.
> image = tvrd(true=1) 
> write_tiff, 'filename.tif', reverse(image, 3), 1
% Compiled module: REVERSE.
% Loaded DLM: TIFF.

*****DONE*****