; WAVE Version 4.20 (IRIX mipseb)
; Journal File for dfj@sgi2.gvu.gatech.edu
; Working directory: /remote/sgi4/usr/local/pvi/wave/data
; Date: Tue Oct 18 15:35:29 1994


; ************* 2-D Plots **************

; create array of 1000 floats whose value equals their index 
x = findgen(1000)

; display information on 'x'
info, x

; print the values of 'x'
print, x

; create a sin wave
y = sin(x / 5.)

; plot 'y'
plot, y

; plot 'y' from index 0 to index 100
plot, y(0:100)


; ************* Reading a Data File *************

; print the system variable for the pv-wave home directory
print, !dir

; read the file /usr/local/pvi/wave/data/wd_pike_elev.dat
; get the first 3 columns of data and store in 'lat', 'long', and 'elev'
status = dc_read_free(!dir + '/data/wd_pike_elev.dat', lat, long, $
elev, /column, get_column = [1, 2, 3])

; display the 'status' of the read
print, status

; display info and values of the 'lat' array
info, lat
print, lat

; reform the arrays into 2-D arrays of 60x40
; note that the number and values of elements remains the same
lat = reform(lat, 60, 40)
long = reform(long, 60, 40)
elev = reform(elev, 60, 40)


; ************** Contour Plots ***************

; create a contour plot of the elevation data in 'elev'
; 'long' is a 2-D array that contains the x coordinate for each element
; similarly, 'lat' contains the y coordinate of each element
contour, elev, long, lat

; change the number of contour levels
contour, elev, long, lat, nlevels = 30

; assign particular levels and add titles
level = [6000,7000,8000,9000,10000,11000,12000]
contour, elev, long, lat, levels = level, xtitle = 'longitude', $
ytitle = 'latitude'

; load a color with 32 values, similar to the Tektronix color table
tek_color

; examine and manipulate color table
palette

; specify color table indices to color the contours
color = [1,2,3,4,5,6,7,8]
contour, elev, long, lat, levels = level, xtitle = 'longitude', $
ytitle = 'latitude', c_colors = color

; change the style of the x axis to span the data set exactly
contour, elev, long, lat, levels = level, xtitle = 'longitude', $
ytitle = 'latitude', c_colors = color, /xstyle

; other useful keywords for contour: follow, spline, thick, T3D

; **************** Surface Plots **************

; make a surface plot of the same data
surface, elev, long, lat, xtitle = 'longitude', ytitle = 'latitude', $
ztitle = 'elevation', /xstyle, /ystyle

; other useful keywords for surface: ax, az, horizontal

; load the black/white linear color table
loadct, 0

; create a light-source shaded surface
shade_surf, elev, long, lat, /xstyle, /ystyle

; read in the fourth column of /usr/local/pvi/wave/data/wd_pike_elev.dat
; into 'snow'
status = dc_read_free(!dir + '/data/wd_pike_elev.dat', snow, /column, $
get_columns = [4])

; display info and values of 'snow'
info, snow
print, snow

; reform snow
snow = reform(snow, 60, 40)

; scale the values in 'snow' to a byte array from 0-255, to do shading of 
; the surface
shade = bytscl(snow)

; create a shaded surface of the data
shade_surf, elev, long, lat, shades = shade, /xstyle, /ystyle



; ****************** Fonts ****************

; add titles and labels in software fonts (software fonts are used
; when P.Font = -1)
shade_surf, elev, long, lat, shades = shade, /xstyle, /ystyle, $
title = "Pike's Peak Snow Cover", xtitle = "Longitude", ytitle = $
"Latitude", ztitle = "Elevation"

; change software fonts
shade_surf, elev, long, lat, shades = shade, /xstyle, /ystyle, $
title = "!13Pike's Peak !17Snow Cover!3", xtitle = "Longitude", ytitle = $
"Latitude", ztitle = "Elevation"

; switch to hardware fonts
!p.font = 0

; redo plot
shade_surf, elev, long, lat, shades = shade, /xstyle, /ystyle, $
title = "Pike's Peak Snow Cover", xtitle = "Longitude", ytitle = $
"Latitude", ztitle = "Elevation"

; switch hardware fonts for X display
device, font = "8x13"

; redo plot
shade_surf, elev, long, lat, shades = shade, /xstyle, /ystyle, $
title = "Pike's Peak Snow Cover", xtitle = "Longitude", ytitle = $
"Latitude", ztitle = "Elevation"

; return to software fonts
!p.font = -1


; *************** Output **************

; set plot device (default filename is wave.ps)
set_plot, 'ps'

; set font and filename
device, /times
device, filename = "peak.ps"

; do contour plot, which will be written to file
contour, elev, long, lat, title = "Pike's Peak Contour"

; close file
device, /close_file

; print 
$lpr -Pscivis-ps peak.ps

; reset device to X windows
set_plot, 'X'



; *************** Multiple Plots **************

; show the contour, surface, and image of 'elev'
show3, elev

; reform 'snow' into a 2-D array which can be used as an image
snow = reform(snow, 60, 40)

; show the contour, surface, and 'snow' image
show3, elev, bot_image = snow

; smooth the surface plot
show3, smooth(elev, 3), bot_image = snow

; rotate the z axis
show3, smooth(elev, 3), bot_image = snow, az = 210

; erase the viewport
erase


; ************** Images **************

; open the file /usr/local/pvi/wave/data/head.img for reading
openr, 1, !dir + '/data/head.img'

; associate a 512x512 byte array with the file
head = assoc(1, bytarr(512, 512))

; display the image with values scaled to the display range
tvscl, head(0)

; load another color table
loadct, 3

; create a sequence of image arrays, each rotated 72 degrees
head_array = bytarr(512, 512, 5)
for i = 0, 4 do head_array(*, *, i) = rot(head(0), i*72)

; show a movie of the images
movie, head_array