This page is a listing of the entire contents of this library for IDL. This listing is the long version. Viewing the much more compact listing may be handier.
NAME:
ACOSD
PURPOSE:
Return the inverse cosine of a value, in degrees rather then radians.
CALLING SEQUENCE:
deg = acosd(x)
INPUTS:
value cosine of angle
OPTIONAL INPUTS:
OUTPUTS:
Angle in degrees returned.
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 12/07/93
MODIFICATION HISTORY:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/acosd.pro)
ROUTINE: addpath
PURPOSE:
USEAGE: addpath,pathname,cut=cut
INPUT:
pathname Name of new path to add to this session's directory path.
if pathname is already present in !path no action is taken.
This last feature allows addpath to be repeatedly executed
(e.g., within a script) without affecting !path after the
first invocation.
KEYWORD INPUT:
cut If set and pathname is set, the element of !path that
matches pathname is removed. If pathname is not
specified, the last element of !path is removed.
OUTPUT:
DISCUSSION:
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLES:
addpath,'/home/paul/idl' ; add a path
addpath,'/local/idl/lib/wided',/cut ; remove a specific path
addpath,/cut ; remove last path element
addpath ; view !path
AUTHOR: Paul Ricchiazzi 04 Nov 97
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/addpath.pro)
ROUTINE: airmass
PURPOSE: compute airmass as a function of angle, sza, including
spherical earth effects
USEAGE: result=airmass(sza)
INPUT:
sza zenith angle
KEYWORD INPUT:
OUTPUT: relative airmass,
by definition the relative airmass = 1 for sza=0.
References:
Kasten, F 1966: A new table and approximate formula for relative
airmass. Arch. Meteor. Geophys. Bioklimatol. Ser. B, 14, 206-223
Leontieva, E.N., and K.H. Stamnes 1996: Remote sensing of cloud
optical properties from fround-based measurements of
transmittance: a feasibility study, Journal of Applied
Meteorology, 35, 2011-2022
EXAMPLE:
sza=findrng(0,89.,dx=.1)
plot,sza,1./cos(sza*!dtor),yran=[1,30]
plot,sza,cos(sza*!dtor)*airmass(sza)
AUTHOR: Paul Ricchiazzi 09 Jan 97
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/airmass.pro)
ROUTINE: armbasetime
PURPOSE: The base_time variable provided by ARM net_cdf files is the
number of seconds since jan 1, 1970 00:00:00 UTC. This
procedure converts base_time to the current date in yymmdd
format, and the number of hours since the most recent
Grenich midnight (00:00:00 UTC).
USEAGE: armbasetime,base_time,time,yymmdd,file=file
INPUT:
bt number of seconds since jan 1, 1970 00:00:00 UTC.
KEYWORD_INPUT
file name arm net_cdf file. If this quantity is set the value
of bt is set from the value read from the file.
OUTPUT:
time time since Grenich midnight of the current day
yymmdd date string in yymmdd format
EXAMPLE:
file='/home/paul/arm/iop_97/mfrsr/sgpmfrsrC1.a1.970915.000000.cdf'
armbasetime,file=file,bt,time,yymmdd
print,bt,time," ",hms(3600*time)," ",yymmdd
AUTHOR: Paul Ricchiazzi 05 Jun 98
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/armbasetime.pro)
NAME:
ASIND
PURPOSE:
Return the inverse sine of a value, in degrees rather then radians.
CALLING SEQUENCE:
deg = asind(x)
INPUTS:
value sine of angle
OPTIONAL INPUTS:
OUTPUTS:
Angle in degrees returned.
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 12/07/93
MODIFICATION HISTORY:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/asind.pro)
ROUTINE: autorange
PURPOSE: given a range of values find a good tick mark interval
and return a properly formatted tick label. This routine
can be used with the axis procedure to add additional
axis which are not linearly related to the original
axis (see example)
USEAGE: autorange,range,ntick,tickv,tickl,ntickmax=ntickmax,$
cv=cv,log=log,colors=colors
INPUT:
range array of values
keyword input
ntickmax maximum allowed number of tick marks (default=10)
cv if present and non-zero, the tick values will cover a bit
less than the full range. Otherwise tick values cover a
bit more than the full range. Set CV when you want exactly
NTICK contour levels to appear on a contour plot.
OUTPUT:
ntick number of tick marks
tickv array of tick values
tickl formatted tick labels
KEYWORD OUTPUT
colors vector of color values covering full color range and having
one less element than ntick
; EXAMPLE:
autorange,[.011,.022],ntick,tickv,tickl & print,tickl
0.010 0.012 0.014 0.016 0.018 0.020
; plot solar spectrum with wavenumber on the lower x axis
; and wavelength on the upper x-axis
solar,wn,f
plot,wn,f,xstyle=5,xrange=[10000,40000],ymargin=[4,4]
axis,xaxis=0,xstyle=1,xtitle='Wavenumber (cm-1)'
autorange,1.e7/!x.crange,ntick,tickv,tickl
axis,xaxis=1,xticks=ntick-1,xtitle='Wavelength (nm)',$
xtickv=1.e7/tickv,xtickname=tickl
REVISIONS:
author: Paul Ricchiazzi mar94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/autorange.pro)
FUNCTION: This procedure computes the AVERAGE of a the nk
fields stored in the array tab (nbcol,nblign,nk).
INPUTS : tab --> 3 dimensional array (nbcol x nblign x nk)
OUTPUTS : moy --> average of the fields (nbcol x nblign)
stdv --> standard deviation (nbcol x nblign)
nb --> number of points used in the average
USE : vertaver, array1, array2, outaver,outstdc,outelmts
CONTACT : Didier JOURDAN didier@esrg.ucsb.edu
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/average.pro)
ROUTINE: axgap,pos
PURPOSE: draw a "gap symbol" to indicate a gap in the axis number scale.
USEAGE: axgap,pos
INPUT:
pos two element vector indicating x,y data coordinates of the
axis break
KEYWORD INPUT:
one gap symbol drawn on one axis only
size size of gap symbol (default = 1, which corresponds to size
of default minor tick marks)
skew control skewness of gap symbol (default 0)
gap controls gap size (default 1)
OUTPUT:
none
DISCUSSION:
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLE:
y=smooth(randomn(iseed,100),5)
plot,y,xticks=5,xtickn=['1','2','3','4','5','20']
axgap
AUTHOR: Paul Ricchiazzi 31 Aug 95
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/axgap.pro)
ROUTINE: azimuth
PURPOSE: given a smoothly varying 2d field, AZIMUTH
computes the angle between the gradient direction
of the field and the y direction (angle measured
clockwise). This is is useful for computing the
satellite or solar azimuth angle when all you know
are the satellite or solar zenith angles. For
example the relative azimuth at each point in a
satellite image is given by
relaz=abs(azimuth(satzen,1,1)-azimuth(-sunzen,1,1))
which is the angle between the satellite unit
vector and the solar ray vector, both projected
onto the surface.
CALLING SEQUENCE:
result=azimuth(image,dx,dy)
INPUT:
image smoothly varying image quantity (e.g., solar zenith angle)
dx pixel spacing, x direction
dy pixel spacing, y direction
OUTPUT:
result angle between grad(image) and downward direction
(angle increases clockwise)
LIMITATION: the image is fit by a quadratic function of x and y
which is analytically differentiated to find the
gradient directions. An image which is not well
approximated by a quadratic function may produce
weird results.
EXAMPLE:
f=cmplxgen(400,400,/center)
tvim,f,/scale
f=abs(f)^2 ; should be perfectly fit by a quadratic function
a=azimuth(f,1,1)
loadct,5
tvim,a,scale=2,range=[-180,180,45]
author: Paul Ricchiazzi apr94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/azimuth.pro)
ROUTINE: balloon_drag
PURPOSE: compute drag on shere
USEAGE: result=balloon_drag(r,rho,v,cd)
KEYWORD INPUT:
r balloon radius in meters (default=1.0 m)
v wind velocity (mph) (default=5 m/s)
rho air density (default=1.29 kg/m3)
cd drag coefficient (default=0.2)
NOTE: 1 m/s = 3.60 km/hr = 2.23 mph = 1.94 knots
OUTPUT:
result drag force in newtons
SOURCE: Steve Robinson
NASA/MIT
stever@space.mit.edu
Drag on sphere = .5 * Cd * rho * v^2 * pi * r^2
Cd = function of sphere Reynolds number
(V*2*r)/(kinematic viscosity),
but 0.2 should be close.
EXAMPLE:
r=1. & v=10. & cd=.2
rho=rhoz(p0=1013.,t0=273.,z=1.,lr=7.)
print,balloon_drag(r,rho,v,cd)
author: Paul Ricchiazzi jan94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/balloon_drag.pro)
ROUTINE: balloon_lift
PURPOSE: compute lifting capacity of a helium balloon
USEAGE: result=balloon_lift(r,rho,kg=kg)
KEYWORD INPUT:
r balloon radius in meters (default=1.0 m)
rho air density at operating alitude (defualt=1.29 kg/m3)
result lifting capacity in newtons
(if kg is set lifting capacity is in kg)
EXAMPLE: lifting capacity of a 1 m radius helium balloon at an
altitude of 1 km.
rho=rhoz(p0=1013.,t0=273.,z=1.,lr=7.)
print,balloon_lift(1.,rho)
EXAMPLE: lifting capacity of a non-stretching 1 m radius helium
balloon at an altitude of 1 km. To prevent the balloon
from bursting at high altitude the balloon should not be
filled to full capacity with helium at sealevel. Assume
the helium retains its sealevel temperature (maybe less
than ambient).
r=1
t0 = 273.
p0 = 1013.
rho1 = rhoz(p0 = p0,t0 = t0,z = 1,lr = 7.)
rho0 = rhoz(p0 = p0,t0 = t0,z = 0,lr = 7.)
p1 = p0*(rho1/rho0)*(t0-7.)/t0
rs=r*(p1/p0)^.3333
print,balloon_lift(rs,rho1)
author: Paul Ricchiazzi jan94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/balloon_lift.pro)
ROUTINE: barplot
PURPOSE: produce a bar plot
USEAGE: barplot
INPUT:
y bar values fltarr(n)
KEYWORD INPUT:
nbar number of barplot overlays. Should only be set on the first
call to BARPLOT
over if set, overplot new bar values.
dx width of a bar (default=1). An individual bar is sized to
fill a fraction .5*DX/nn of the total plot width, where nn
is the number of elements in y. Setting DX=2 eliminates
blank space between adjacent bars.
xinc How far to move overplot bars to the left or right of the
previous bar position (in units of the bar width). Use
with NBAR and XOFF to control degree to which overplot
bars overlap previous bars. A positive value causes latter
overplots to overlap bars starting from the left and
finishing on the right. A negative value does the
opposite. (default = 0.6666)
xoff offset of bar with respect to labeled points on x-axis
(default=0). XOFF should be in the argument list and assigned
to a named variable if NBAR, DX and XINC are used to control
bar overlap in multiplots.
The xaxis labels are located at data coordinates
xlab=findgen(nn)+.5, where nn =n_elements(y)
color color index used to fill bars
xtitle string, x title of plot
ytitle string, y title of plot
title string, title of plot
xlabels vector of strings used to label bar groups
xlabvec vector of x values at which to put XLABELS.
if XLABVEC is not set, XLABELS are ploted at points
.5+findgen(n_elements(xlabels))
range of XLABVEC 0-1
grid if set, draw a y axis grid. The numerical value of grid
is used to set the grid style (1=dotted line)
yrange a two element vector specifying the y axis range
ynozero if set, y range may not include zero if all y values are
are positive.
xmargin two element vector specifies left and right margin around plot
frame in units of character width. (default = !x.margin)
ymargin two element vector specifies bottom and top margin around plot
frame in units of character height. (default = !y.margin)
OUTPUT:
DISCUSSION:
For best results try to arrange the order of overplots so that larger
values of y are ploted first. See examples.
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLE:
loadct,5
y=randomu(iseed,6)
color=[.8,.6,.3]*!d.n_colors
dx=.6
barplot,y,dx=dx,xlabels=1990+indgen(6),title='test',xtitle='Year',$
ytitle='power (Watts)',color=color(0),/grid,xoff=xoff,nbar=3
barplot,y^2,dx=dx,color=color(1),/over,xoff=xoff
barplot,y^3,dx=dx,color=color(2),/over,xoff=xoff
; A fancier example
y=randomu(iseed,5) & y=y(sort(y))
xlabels=['January','February','March','April','May']
color=[.2,.4,.6,.8]*!d.n_colors
dx=.32
barplot,y,dx=dx,xtitle='---- Month ----',$
ytitle='power (Watts)',color=color(3),yrange=[0,1.],ymargin=[5,7],$
/grid,xlabels=xlabels,charsize=1.5 ,xoff=xoff,nbar=4
barplot,y^2,dx=dx,color=color(2),/over, xoff=xoff
barplot,y^3,dx=dx,color=color(1),/over, xoff=xoff
barplot,y^4,dx=dx,color=color(0),/over, xoff=xoff
x_axis,findgen(5)+.5,1.,xtickn=(y+y^2+y^3+y^4)/4,yspace=-1.5,$
xtitle='----- Cumulative Average -----'
x_axis,findgen(5)+.5,[1,4],xtitle='Plot Title',yspace=-.5,charsize=1.2,/ext
legend,'.cSensor\\AVHRR 1\AVHRR 2\GTR-200\PSP',color=color,$
/clrbox,bg=0,/box,pos=[0.06,0.57,0.23,0.98]
; use with histogram to make nicer histogram plots
y=randomn(iseed,2000)
yy=histogram(y,binsize=.5,min=-3)
yy=yy(0:11)
xlabel=string(f='(f3.0)',findrng(-3,3,12))
;plot,findrng(-3,3,12),yy,/xsty,psym=10 ; compare to this
barplot,yy,dx=2,color=20,xlabel=['-3','-2','-1','0','1','2','3']
AUTHOR: Paul Ricchiazzi 31 Aug 95
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/barplot.pro)
NAME:
bc
PURPOSE:
wall to wall cross hairs to help read numbers off of plot
axis. The graphics function is set to 6 for eXclusive OR.
This allows the cross hairs to be drawn and erased without
disturbing the contents of the window. Hit RMB to exit
CALLING SEQUENCE:
bc
INPUTS/OUTPUTS: none
RESTRICTIONS:
Works only with window system drivers.
CATEGORY:
Interactive graphics.
author Paul Ricchiazzi April, 1993
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/bc.pro)
ROUTINE:
BOXONMAP, derived from IDL User Library Procedure BOX_CURSOR
PURPOSE:
Emulate the operation of a variable-sized box cursor (also known as
a "marquee" selector).
CATEGORY:
Interactive graphics.
CALLING SEQUENCE:
BOXONMAP, wx0, wy0, wx1, wy1 [, INIT = init] [, FIXED_SIZE = fixed_size]
INPUTS:
No required input parameters.
OPTIONAL INPUT PARAMETERS:
wx0, wy0, wx1, and wy1 give the initial location of the lower left
(wx0, wy0) and upper right (wnx, wny) corners of the box if the
keyword INIT is set. Otherwise, the box is initially drawn in the
center of the screen. Both input and output parameters are in
Longitude (X) and Latitude (Y).
KEYWORD PARAMETERS:
INIT: If this keyword is set, wx0, wy0, wx1, and wy1 contain the
initial parameters for the box.
FIXED_SIZE: If this keyword is set, the initial parameters fix the
size of the box. This size may not be changed by the user.
MESSAGE: If this keyword is set, print a short message describing
operation of the cursor.
OUTPUTS:
wx0: X value (Lon) of lower left corner of box.
wy0: Y value (Lat) of lower left corner of box.
wx1: X value (Lon) of upper right corner of box.
wy1: Y value (Lat) of upper right corner of box.
The box is also constrained to lie entirely within the window.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A box is drawn in the currently active window. It is erased
on exit.
A window for display of numeric latitude and longitude is created.
It is destroyed on exit.
RESTRICTIONS:
Works only with window system drivers.
PROCEDURE:
The graphics function is set to 6 for eXclusive OR. This
allows the box to be drawn and erased without disturbing the
contents of the window.
Operation is as follows:
Left mouse button: Move the box by dragging.
Middle mouse button: Resize the box by dragging. The corner
nearest the initial mouse position is moved.
Right mouse button: Exit this procedure, returning the
current box parameters.
MODIFICATION HISTORY:
DMS, April, 1990.
DMS, April, 1992. Made dragging more intutitive.
NFH, March, 1993, Warp box & use map coordinates,
display Lat & Lon in text box.
PJR/ESRG, March, 1994, display lat & lon in xmessage window
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/boxonmap.pro)
ROUTINE: boxpos
USEAGE:
result=boxpos()
result=boxpos(aspect=aspect,rmarg=rmarg,xpos=xpos,ypos=ypos,$
get=get,curbox=curbox,print=print)
PURPOSE: returns the 4 element position of a properly shaped data window.
output is in normalized coordinates
INPUT:
none required
keyword input:
aspect x/y aspect ratio of map (default = 1)
rmarg the amount of margin to leave on the right side of the
box. The margin is specified in units of 10 character
widths, so merely setting the RMARG parameter provides
enough space for COLOR_KEY
get if set, retrieve the position information of the last
plot drawn.
xpos two element vector specifying x position of a multi frame
plot, the first element specifies the frame number, the
second element specifies the number of frames
ypos two element vector specifying y position of a multi frame
plot, the first element specifies the frame number, the
second element specifies the number of frames
print if set, print out the normal coordinates of the box
edges in format,
pos=[x0,y0,x1,y1]
where (x0,y0) and (x1,y1) are the normal coordiates
of the lower left and upper right corners of the box
The default value of PRINT is 1 if the CURSOR keyword
is set.
OUTPUT:
result=[x1,y1,x2,y2],
where (x1,y1) and (x2,y2) are the lower left hand
and upper right hand corner of the new data window
in normalized coordinates.
EXAMPLE: Draw a map over a TVIM image
tvim,dist(200)
map_set,0,0,/orth,/cont,/grid,pos=boxpos(/get),/noerase
Draw a map of the southern hemisphere with 2:1 aspect
ratio
map_set,-90,0,/orth,/cont,/grid,pos=boxpos(aspect=2)
now try a 1:1 aspect ratio
map_set,-90,0,/orth,/cont,/grid,pos=boxpos(/aspect)
now allow room for color key, and draw color key
map_set,-90,0,/orth,/cont,/grid,pos=boxpos(/aspect,/rmarg)
color_key
Draw a multframe plot
x=findgen(100)
plot,x,x,pos=boxpos(aspect=1,ypos=[3,3])
plot,x,x^2,pos=boxpos(aspect=1,ypos=[2,3]),/noerase
plot,x,x^3,pos=boxpos(aspect=1,ypos=[1,3]),/noerase
; NOTE: the XMULTI and YMULTI proceedures (in this directory) can
; also be used to make multiframe plots and are more flexible
; than BOXPOS for positioning the individual frames.
author: Paul Ricchiazzi 25jan93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/boxpos.pro)
ROUTINE: caption
PURPOSE: CAPTION can be used to print captions above or below a
figures. The character size is determined by the number
of characters per line.
USEAGE: caption,cap,xx,ybot=ybot,yt=ytop,nchar=nchar
INPUT:
cap string used for caption. Normally all text within CAP
is line wrapped to produce a multiline caption. All
white space within CAP is preserved in the caption.
Within CAP the character "\" can be used to force a line
break (i.e., to start a new line). Extra white space
following the "\" causes the text to be indented.
t='this is a test \ junk test test'+$
' \ junk test \ \ junk: this is a test'
caption,t
PRODUCES:
this is a test
junk test test
junk test
junk: this is a test
Note that the backslash character must be surrounded by
whitespace to be recognized
xx normal coordinates of left and right edge of caption
KEYWORD INPUT:
ytop normal coordinates of top of caption
(default=!y.window(0)-.15)
nchar number of characters per line
vspace vertical space factor, controls vertical space between
lines (default = 1)
bg_color background color
color foreground color
exdent number of character positions to indent all lines except
the first. (default=0)
nowrap if set do not line wrap the input text, instead use
embedded backslash characters to control line breaks.
KEYWORD OUTPUT:
ybot normal coordinates of bottom of caption. The value of
of ybot can be used append more text with another call
to CAPTION.
DISCUSSION:
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLE:
t1='CAPTION can be used to print captions above or below a '+$
'figures. The character size is determined by the number '+$
'of characters per line. here is a list of items: \ '+$
' 1. item 1 \ '+$
' 2. item 2 \ '+$
'END OF FIRST CAPTION
t2='BEGINNING OF SECOND CAPTION \ HERE is more text to add to '+$
'the previous text. Note how the '+$
'text starts immediately below the last line of the previous '+$
'written text. The use of ybot allows concatenation of text with '+$
'different right and left margins'
w8x11 & !p.multi=[0,1,2]
plot,dist(10)
caption,t1,nchar=80,ybot=yy
xwid=.5*(!x.window(1)-!x.window(0))
xmid=.5*(!x.window(0)+!x.window(1))
caption,t2,xwid+.5*[-xwid,xwid],nchar=40,ytop=yy
;; FILL option
t= 'HERE is more sample text to demonstrate the use of CAPTION''s, '+$
'"fill" option. Note how the text is stretched to fill the '+$
'entire width of the line. It is probably a good idea not '+$
'to force linebreaks using the backslash symbol while in this '+$
'mode. The "fill" option works best when NCHAR is large'
erase
caption,t,[.1,.9],ytop=.9,/fill,nchar=80
;; CAPTION used with READ_TEXT
caption,read_text('caption.txt','Figure 1.'),nchar=60
AUTHOR: Paul Ricchiazzi 12 Mar 96
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/caption.pro)
ROUTINE: CLASSIFY
FUNCTION:
Display the physical locations of points selected on the
basis of image quantities, xa and ya. An interactive
cursor box is used to select clusters of points from the
2-d scatter plot of xa vs ya. These points are drawn on a
satellite image to indicate their actual physical
location.
CALLING SEQUENCE:
classify,xa,ya,class_out,image=image,class_in=class_in,select=select, $
n_samples=n_samples,blow_up=blow_up,title=title,ytitle=ytitle, $
xtitle=xtitle,ititle=ititle
CATEGORY:
Interactive graphics
REQUIRED INPUTS:
XA First channel parameter, x-axis of scatter plot
YA Second channel parameter, y-axis of scatter plot
OPTIONAL INPUTS (keyword parameters):
IMAGE Image of a particular satellite channel over which
points are ploted. If not supplied points are ploted
over blank plot
CLASS_IN (Byte array) Pixel color class initialization. Each
element corresponds to one pixel in the sample set
(see n_samples, below). An initial run of CLASSIFY
will generate the byte array, CLASS_OUT. This can be
used in a subsequent run of CLASSIFY with
CLASS_IN=CLASS_OUT to restart CLASSIFY in its former
state. When set, CLASS_IN overrides the effect of
SELECT and N_SAMPLES, below.
N_SAMPLES 2 element vector specifying the number of samples in the
x and y directions. E.g., if N_SAMPLES=[100,150],
then the scatter plot will consist of a 100x150
element subset of the original image. If N_SAMPLES
is not set, a default number of samples in the x and
y directions is used.
SELECT Vector of pre-selected indices (longword integers).
For example, SELECT=WHERE(XX LT 10) chooses only
those sample points for which parameter xx
is less than 10.
BLOW_UP Two element vector of specifying the image size blowup factor
TITLE Title of scatter plot
XTITLE Scatter plot x-axis label
YTITLE Scatter plot y-axis label
ITITLE Plot title of satellite image
NO_COLOR don't use color, show points with unique symbols
OUTPUTS
CLASS_OUT (Byte array) Color class of each sample point. Values
between 1 - 6 indicate different selected color
classes. Greater values indicate unselected points
which can be selected with the cursor. CLASS_OUT can
be used in another call to CLASSIFY, e.g.,
CLASSIFY,XA,YA,CLASS_OUT ; followed by,
CLASSIFY,XA,YA,CLASS_IN=CLASS_OUT
COMMON BLOCKS:
none
SIDE EFFECTS:
Two windows are created to contain the scatter plot (window 0) and
the physical image (window 2). Calls TVLCT to load a customized
color table with grey scale for byte values greater than 10 and
discreet colors for byte values between 1 and 10.
RESTRICTIONS:
Works only on window system drivers
PROCEDURE:
Points which enter into the cursor box are hi-lighted and stored
for plotting on the satellite image. The left mouse button increases
the size of the cursor box while the middle mouse button decreases it
The right mouse button stops the selection process and displays a
pop-up menu with 4 options:
(n) select a new selection class (assign a new color)
(r) reset the selection set
(d) display the selection set on the satellite image
(p) save current plot to postscript file "plot.ps"
(q) clean up displays and quit
author: Paul Ricchiazzi oct92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/classify.pro)
ROUTINE: classplt
USEAGE: classplt,xx
classplt,xx,yy,alat,alon,$
[title=title,xtitle=xtitle,ytitle=ytitle,sym=sym]
PURPOSE: Draws two seperate plots to the graphics device:
1. 2-d scatter plot of yy vs xx
2. physical position of selected classes with respect
to coastline features.
INPUT:
xx index array of selected points for a class
(class definition mode)
xx 2-D array, x quantity of scatter plot (ploting mode)
yy 2-D array, y quantity of scatter plot
alat latitude array
alon longitude array
title plot title (optional). One or two element string array
if two strings are specified the first string is used to
title the scatter plot while the second titles the mapped
plot
xtitle x title (optional)
ytitle y title (optional)
sym a vector of symbol index values. Classes are assigned symbols
in the sequence specified in SYM. (default=[1,4,7,5,6,2])
(1=+, 2=*, 3=., 4=diamond, 5=triangle, 6=square, 7=x)
PROCEDURE: At least two steps are required to make plots with CLASSPLT:
1. In class definition mode CLASSPLT is called with a single
argument one or more times to accumulate class definitions
to be used later in the ploting mode.
2. In plotting mode CLASSPLT is called with at least 4
arguments. In this mode CLASSPLT produces a scatter
plot and position plot of the previously defined classes.
EXAMPLE:
a4=congrid(avhrr4,40,30) ; reduce size of sample set
a3=congrid(avhrr3,40,30) ; could also use SUPERPIX
classplt,inside(a4,a3-a4,[3,6,5,3],[4,3,5,4]) ; define classes
classplt,where(a4 gt -6 and a3-a4 lt 8) ;
classplt,where(a4 gt -17 and a3-a4 gt 8) ;
classplt,a4,a3-a4,alat,alon ; make the plot
Here is a sequence of commands which uses the interactive graphics
procedure, INSIDE, to simplify class specifcation.
classplt,inside(a4,a3-a4)
classplt,inside(a4,a3-a4)
classplt,inside(a4,a3-a4)
classplt,a4,a3-a4,alat,alon
COMMON BLOCKS: classblk
author: Paul Ricchiazzi oct92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/classplt.pro)
ROUTINE: cloud_art
PURPOSE: draw an idealized cloud
USEAGE: cloud_art,pos,bumps=bumps
INPUT:
pos normal coordinates of cloud frame, [xll,yll,xur,yur]
where ll=lower left corner and ur=upper right corner
KEYWORD INPUT:
bumps number of bumps on upper side of cloud. (default=6)
OUTPUT:
DISCUSSION:
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLE:
w8x11
cloud_art,[.1,.8,.9,.9],bumps=8
AUTHOR: Paul Ricchiazzi 15 Mar 96
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cloud_art.pro)
ROUTINE: clstrshd
USEAGE: result=clstrshd(a, binsz)
result=clstrshd(a, binsz, /align, /compare)
PURPOSE: compute super pixel cluster shade statistical test
of a scene. the cluster shade is a test of skewness
in the greylevel histogram of each superpixel.
INPUT:
a image array
binsz A scalar specifying the number of horizontal and
vertical sub-pixels in one super pixel.
BINSZ must be an odd integer.
align If set, output arrays are REBINed back up to the
original size and output array cell centers are aligned
with input array cell centers.
compare if set, compare A and ABIN with the FLICK procedure
OUTPUT:
cluster shade value at superpixel cell centers.
AUTHOR: Paul Ricchiazzi oct92
Earth Space Research Group, UCSB
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/clstrshd.pro)
ROUTINE: cmplxgen
USEAGE: result=cmplxgen(nx,ny[,/center])
INPUT:
nx,ny dimensions of output
KEYWORD INPUT:
center if set RESULT is shifted so that the (0,0) point
is the central element of the complex array
OUTPUT:
float(result) = array of column indecies
imaginary(result) = array of row indecies
EXAMPLE: r=cmplxgen(4,3)
0 1 2 3 0 0 0 0
float(r) = 0 1 2 3 imaginary(r) = 1 1 1 1
0 1 2 3 2 2 2 2
AUTHOR: Paul Ricchiazzi oct92
Earth Space Research Group, UCSB
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cmplxgen.pro)
ROUTINE: color_bar
PURPOSE: draw a horizontal color bar
USEAGE: color_bar
INPUT:
levels
a vector of physical values (required)
colors
a vector of color values. If colors is not specified a
continuous spectrum of colors between colors values 1 and
!d.n_colors-2 are used.
KEYWORD INPUT:
pos
position of color bar in normal or subnormal coordinates
[xmin,ymin,xmax,ymax], if pos is not specified, CURBOX is
called to set the color bar position interactively.
digits
number of significant digits used in number scale label
digits=0 causes an integer format to be used. any positive value
causes a floating point format.
stride
if set, label only those intervals which have n mod stride eq 0,
where n is the number of intervals counting left to right.
subnorm
use subnormal coordinates to specify pos. subnormal coordinates
vary from 0 to 1 across the range of the last plotting window.
If not set, normalized coordinates are used.
labels a string array of labels for color values.
if nlabels eq nlevels ==> center labels under tick marks
if nlabels eq nlevels-1 ==> center labels between tick marks
otherwise ==> execution stops, error message issued
where nlabels=n_elements(labels) and nlevels=n_elements(levels)
title overall title for color bar, appears below labels
OUTPUT:
none
DISCUSSION:
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLE:
loadct,5
!y.omargin=[10,0]
!p.multi=[0,2,2]
r=randata(50,50,s=4) & r=(r-3)
levels=-9+indgen(10)
colors=findrng(20,!d.n_colors,9)
confill,r,/noscale,levels=levels,colors=colors
confill,rotate(r,1),/noscale,levels=levels,colors=colors
confill,rotate(r,2),/noscale,levels=levels,colors=colors
confill,rotate(r,3),/noscale,levels=levels,colors=colors
!y.omargin=0
labels='10!a-'+strcompress(string(8-indgen(9)),/rem)
title='ozone mass density (ug/m3)'
color_bar,levels,colors,labels=labels,title=title
; use a continuous spectrum of colors
!y.omargin=[10,0]
!p.multi=[0,2,2]
r=randata(50,50,s=4) & r=(r-3)
levels=-9+indgen(10)
colors=findrng(20,!d.n_colors,9)
tvim,r & tvim,rotate(r,1) & tvim,rotate(r,2) & tvim,rotate(r,3)
!y.omargin=0
color_bar,indgen(10),labels=labels,title=title
AUTHOR: Paul Ricchiazzi 09 Feb 96
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/color_bar.pro)
ROUTINE: color_frame
PURPOSE: draw a color background on which to overlay plots
USEAGE: result=color_frame(color,pos=pos,xmargin=xmargin,ymargin=ymargin)
INPUT:
color
the background color of the plot frame
KEYWORD INPUT:
pos
4 element vector specifying the lower left and upper right
normalized coordinates of the plot frame [xll,yll,xur,yur]
xmargin
2 element vector specifying the left and right margins in character
width units
ymargin
2 element vector specifying the lower and upper margins in character
height units
bg_color
back ground color used outside of plot frame
;
OUTPUT:
result
4 element vector specifying the lower left and upper right
normalized coordinates of the plot frame [xll,yll,xur,yur]
DISCUSSION:
COLOR_FRAME can be used to produce color backgrounds within plot
frames. Since COLOR_FRAME itself calls PLOT to obtain the
default frame position, it is necessary to include the NOERASE
keyword in the PLOT call that actually draws the plot. When this
option is used new plots called with color_frame will not erase
the screen even when !p.multi(0)=0. Thus, in order to start a
new page the user must explicitly erase the page using the ERASE
command. See examples.
LIMITATIONS:
COMMON BLOCKS:
SIDE EFFECTS:
EXAMPLE:
!p.multi=[0,1,2]
loadct,5
xx=findrng(-2.5,2.5,200)
yy=exp(-xx^2)
yc=cos(xx*10)
plot,xx,yy,pos=color_frame(50),/noerase
plot,xx,yc*yy,pos=color_frame(70),/noerase
erase
plot,xx,yc^2*yy,pos=color_frame(90),/noerase
plot,xx,yc^3*yy,pos=color_frame(110),/noerase
;; multi-frame plot
loadct,5
!p.multi=[0,1,2]
plot,xx,yy,pos=color_frame(100,ymargin=ymulti(p,np=2)),/noerase
plot,xx,yc*yy,pos=color_frame(60,ymargin=ymulti(p)),/noerase
;; plot within a plot
loadct,5
polyfill,[0,1,1,0,0],[0,0,1,1,0],color=bg_color,/norm
!p.multi=0
plot,xx,yy*yc,pos=color_frame(50),/noerase
plot,xx,yy,pos=color_frame(100,pos=boxpos(/cur)),/noerase
AUTHOR: Paul Ricchiazzi 23 Feb 96
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/color_frame.pro)
ROUTINE: COLOR_KEY
PURPOSE: draws a numbered color scale.
NOTE: COLOR_KEY is intended to replace PUT_COLOR_SCALE
USEAGE:
COLOR_KEY,pos=pos,ysize=ysize,range=range,inc=inc,$
charsize=charsize,barwidth=barwidth,step=step,$
labels=labels,title=title,colors=colors,nbotclr=nbotclr
PURPOSE: Draws a numbered color scale
INPUT: no required input
OPTIONAL KEYWORD INPUT:
pos 2 element vector, x and y device coordinates of lower
left hand corner of color bar. If POS is not set the
color bar will be placed one character width to the
right of the lower right corner of the last defined
data window
xoff x offset of color bar from right edge of plot frame in
units of default character with. (default=1) xoff is
disabled when pos is set.
range array which contains full range of physical values,
The number scale limits are computed fron min(range) and
max(range). (default=0-255)
inc increment step of the number scale in physical units
If INC is not set the number scale increment is set
automatically
step if set to one, the color table is modified with STEP_CT.
The color scale is stepped at the number scale intervals.
colors a vector of discreet colors selected from the original
color table. In this case the original color table is
not modified and the number of elements of COLORS
is used to find the number scale increments. This
option should be used with devices that do not accept
user specified color tables (such as the Apple Laser
Writers). BEWARE: when the COLORS option is used with
TVIM's SCALE option care must be taken to ensure that
COLOR_KEY's number scale matches the quantity values.
Unlike the STEP option, this is not automatic (see
example below)
nbotclr number of reserved colors at the bottom of the color
table. these colors will not appear in the color key.
charsize character size on number scale
ysize vertical size of color bar in device units.
if ysize is negative, the abs of ysize is interpreted
as the normalized z coordinate of the top of the bar.
barwidth width of color bar (default=1)
labels a vector of strings used to label the color key levels
if not set the default color key number labels are
used. If the number of elements in LABELS is the same
as the number of elements in COLORS then the labels
will appear in the middle of a given color band
instead of at the boundary between colors.
title color scale title drawn to the right of the color key
slevels selected levels at which to mark vertical scale. If LABELS
is also set, the number of elements in LABELS should be
equal to either nsl, or nsl-1 where nsl is the number of
elements in SLEVELS. The SLEVELS input does not work when
COLORS is also specified.
rct if set, reverse direction of grey scale increase. This
keyword can be used on black & white printers to allow
large field values to be represented by dark colors.
KEYWORD OUTPUT
clevels physical values at the color key tic marks
SIDE EFFECTS:
if STEP is set COLOR_KEY calls STEP_CT to discreetize
the color scale. To return to original color table
enter STEP_CT,/OFF
EXAMPLE:
; on devices which allow user defined color tables:
loadct,0
TVIM,dist(200),/scale
COLOR_KEY,range=dist(200),inc=20,/step ; change the color scale
COLOR_KEY,range=dist(200),inc=40,/step ; change it again
; on devices with a single hard-wired color table:
d=dist(200)+20.
inc=step_size(d) ; finds good step size
dmin=fix(min(d)/inc)*inc
dmax=fix(max(d)/inc)*inc
nclrs=(dmax-dmin)/inc
colors=!p.color*indgen(nclrs)/(nclrs-1)
TVIM,colors((d-dmin)/inc),/scale,/c_map
color_key,range=[dmin,dmax],colors=colors
; draw one big color key which applies to all tvim images on frame
!p.multi=[0,2,2]
loadct,5
im1=randata(128,128,s=3)
im2=rotate(im1,5)
im3=rotate(im1,7)
im4=rotate(im1,2)
range=[min(im1,max=mx),mx]
!x.omargin=[0,20]
tvim,im1,range=range
tvim,im2,range=range
tvim,im3,range=range
tvim,im4,range=range
color_key,range=range,xoff=10,ysize=-.97
; logarithmic scales
im=randata(128,128)
im=abs(im) & im=3*(im/max(im) > .001)
tvim,im,/rmarg ; here we assume im is the log10 of some plot quantity.
ndec=3 ; number of decades
slevels=[1.] ; starting value
for i=0,ndec-1 do slevels=[slevels,(findgen(9)+2)*10.^i]
slevels=alog10(slevels)
labels=strarr(n_elements(slevels))
labels(indgen(ndec+1)*9)=string(f='("10!a",i1,"!b")',indgen(ndec+1))
color_key,range=im,slevels=slevels,labels=labels
AUTHOR: Paul Ricchiazzi jan93
Earth Space Research Group, UCSB
REVISIONS:
20sep93: put in LABELS option
21sep93: use pure white blankout color for postscript
22sep93: put in COLORS option
09sep96: put in SLEVELS option
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/color_key.pro)
ROUTINE: color_pal AUTHOR: Terry Figel, ESRG, UCSB 10-21-92 CALLING SEQUENCE: color_pal PURPOSE: Displays Color palette in a seperate window
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/color_pal.pro)
ROUTINE: compass
USEAGE compass, lat0,lon0,alat,alon,rng,az
compass, lat0,lon0,rng,az,alat,alon,/to_latlon
PURPOSE: Given the geographical coordinates of an array of points
on the on the earth's surface, compute the great-circle
distance and compass heading from the central point.
Distances and azimuth angles about the central point are
provided in KM and Degrees.
If TO_LATLON is set, convert the specified range and
azimuth values to lat, lon coordinates
INPUT:
lat0 geographic latitude (degrees) of central point
lon0 geographic longitude (degrees) of central point
INPUT/OUTPUT
alat geographic latitudes
alon geographic longitudes
rng great circle distances (km) from (lat0,lon0) to (alat,alon)
az azimuth angles (degrees), azimuth is measured clockwise
from due north (compass heading)
KEYWORD INPUT:
to_latlon if set, rng, az input converted to lat, lon
EXAMPLE:
;; plot family of great circles passing though lat,lon=(0,0)
rng=findrng(0,2*!pi*6371.2,400)
map_set,/cyl,/cont,/grid
for az=0,90,15 do begin &$
compass,0,0,rng,az,alat,alon,/to_latlon & oplot,alon,alat & endfor
;; find the range and az of Janus Island from Palmer Station
lat0=-64.767 & lon0=-64.067 & alat=-64.78 & alon=-64.11
compass,lat0,lon0,alat,alon,rng,az
compass,lat0,lon0,rng,az,nlat,nlon,/to_latlon
print,f='(6a13)','alat','alon','rng','az','nlat','nlon' &$
print,alat,alon,rng,az,nlat,nlon
author: Paul Ricchiazzi jan93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/compass.pro)
ROUTINE: confill
PURPOSE: display a contour plot with filled contours
USEAGE: confill,z,x,y,xrange=xrange,yrange=yrange,charsize=charsize,$
title=title,stitle=stitle,xtitle=xtitle,ytitle=ytitle,$
aspect=aspect,colors=colors,range=range,nlevels=nlevels,$
rmarg=rmarg,pcharsize=pcharsize,lcharsize=lcharsize,$
c_thick=c_thick,c_label=c_label,c_charsize=c_charsize,$
c_orientation=c_orientation,c_spacing=c_spacing,$
downhill=downhill,xtype=xtype,ytype=ytype,$
c_color=c_color,labels=labels,position=position,$
levels=levels,rgb_data=rgb_data,noscale=noscale
INPUT:
z
array of field values
x
one or two dimensional array of x axis points
y
one or two dimensional array of y axis points
IF z,x, and y are all one dimensional vectors and all the same
size, it is assumed that irregularly grided data is being
supplied. In this case the routine TRIANGULATE is called to get
the Delaunay triangulation of the data. The triangulation info
is then passed on to CONTOUR
KEYWORD INPUT:
title
plot title
xtitle
x axis title
ytitle
y axis title
stitle
color key title (drawn to the right of color scale)
noscale
if set, no color key will be drawn
rmarg
right margin expansion factor to provide more room for extra wide
color scale annotation (default=1)
xrange
x axis range. (default = [0,x_dimension-1])
yrange
y axis range. (default = [0,y_dimension-1])
range
two element vector indicating physical range over which
to distribute contour levels.
nlevels
maximum number of contour levels. If LEVELS is not set the
actual number of contour levels is determined automatically by
AUTORANGE. NLEVELS sets the maximum allowed number of levels,
the actual number of levels may be less.
levels
contour level values (vector). The default contour levels are
set by AUTORANGE. The automatically selected levels chosen by
AUTORANGE can be retrieved by setting LEVELS to a named variable
which is initially undefined or set to zero.
labels
a vector of strings used to label the color key levels. If not
set the default color key number labels are used. If the number
of elements in LABELS is the same as the number of elements in
COLORS then the labels will appear in the middle of a given
color band instead of at the boundary between colors. If COLORS
is not set, the number of elements in LABELS should be at least
as large as the number of color key segments plus one.
colors
an array of color indicies used to fill contours. The number of
color values should be one less than the number of levels. The
default colors are chosen to be uniformally distributed over the
full color table. The automatically selected colors chosen by
CONFILL are: colors=fix((!d.n_colors-2)*(1+findgen(nclr))/nclr),
where nclr=n_elements(levels)-1. If COLORS is set to a negative
number these automatically chosen colors are reversed so that dark
colors are used to represent high intensity areas.
NOTE: The default color indicies generated by CONFILL never
include color index 0 or !d.n_colors-1. These indicies are
reserved for the overall plot background and foreground colors.
For best results, color index 0 and !d.n_colors-1 should
correspond to pure black and white respectively, which is
usually the case in the predefined color tables supplied by RSI.
A predefined color table that doesn't follow this rule can be
redefined using TVLCT to put black and white in these slots,
without affecting any of the filled contours used in the CONFILL
plot: tvlct,0,0,0,0 & tvlct,255,255,255,!d.n_colors-1
c_label
integer array indicating which contour lines to label. For
example, c_label=[0,0,0,1,0,1] indicates that the contour lines
which correspond to levels(3) and levels(5) are to be labeled.
The number of C_LABELs should be the same as the number of
LEVELS. By default no contour lines are labeled.
c_thick
thickness of contour lines (may be a vector of values),
Default is 1.
c_color
color of contour lines (may be a scalor or vector of values).
If c_color is negative then the color of contour lines is chosen
to maximize contrast with adjacent fill colors. The default is
not to drawn contour lines. This keyword must be set to get
contour lines.
NOTE: The number of contour levels is determined automatically
if LEVELS is not set. Hence, it may not be possible to guess
how many values of LABELS, COLORS, C_LABEL, C_THICK or C_COLOR
should be specified. It is probably safer not to include these
parameters unless LEVELS is also specified.
c_orientation
If the FILL keyword is set, this keyword can be set to the angle,
in degrees counterclockwise from the horizontal, of the lines
used to fill contours. If neither C_ORIENTATION or C_SPACING are
specified, the contours are solid filled.
c_spacing
If the FILL keyword is set, this keyword can be used to control
the distance, in centimeters, between the lines used to fill the
contours.
xtype
Set this keyword to specify a logarithmic X axis.
ytype
Set this keyword to specify a logarithmic Y axis.
downhill
Set this keyword to label each contour with short, perpendicular
tick marks that point in the "downhill" direction, making the
direction of the grade readily apparent. If this keyword is set,
the contour following method is used in drawing the contours.
NOTE: Due to a bug in IDL_3.6, the concurrent use of C_LABEL and
DOWNHILL causes an IDL session crash. For this reason the
DOWNHILL option is disabled on IDL_3.6.
aspect
the x over y aspect ratio of the output image. If not set, the
aspect ratio is adjusted to fill the available plotting area.
position
specifies the lower left and upper right CONFILL frame position in
normal coordinates. When set POSITION overides the setting of
ASPECT.
pcharsize
character size of numbers along x and y axis and the title
(default is !p.charsize if non-zero, 1 otherwise)
NOTE: The character size of the x and y-axis number scale
annotation may be independently controlled by the !x.charsize or
!y.charsize system variables. For example, the x and y axis
number scale characters may be made invisible by setting these
variables to a very small non-zero number before calling CONFILL.
Remember to restore normal character sizes by setting !x.charsize
and !y.charsize to 1 or zero after the call to CONFILL.
lcharsize
character size of color key number or labels (default is
pcharsize if set, otherwise !p.charsize if non-zero, 1 otherwise)
barwidth
width of color key which appears to right of contour plot (default=1).
rgb_nodata
if set, regions with field values less then the minimum of LEVELS
or RANGE will be colored with the RGB values specified in
RGB_NODATA (a scalor or three element vector). Color index 1 is
used for the nodata color. When RGB_NODATA is set don't use
color index 1 in the COLORS input vector.
NOTE: RGB_NODATA has no effect unless either RANGE or LEVELS is
set. This is because the default contour levels are set so that
the minimum level is less than the minimum field value.
overplot if set, current field is super imposed over a previous
confill plot this option only works when z,x, and y are all one
dimensional vectors and all the same size, in which case it is
assumed that irregularly grided data is being supplied. In this
case the routine TRIANGULATE is called to get the Delaunay
triangulation of the data. The triangulation info is then passed
on to CONTOUR.
DEPENDENCIES: COLOR_KEY, AUTORANGE
SIDE EFFECTS: if RGB_NODATA is set the rgb value of color index 1
is modified
EXAMPLES:
loadct,5
n=128
zz=randata(n,n,s=4)
xx=findrng([-120,-100],n)
yy=findrng([20,50],n)
confill,zz,xx,yy,title='Plot title',xtitle='x-axis',ytitle='y-axis',$
stitle='contour levels',c_color=-1
confill,zz,xx,yy,title='Plot title',xtitle='x-axis',ytitle='y-axis',$
stitle='contour levels',c_color=-1,rgb_nodata=!p.color/2
; labeled regions
levels=-3+findgen(6)*2
labels=[' ocean',' rain!c forrest',' sand',$
' old!c snow',' real!c new!c snow']
confill,zz,xx,yy,title='Plot title',xtitle='x-axis',ytitle='y-axis',$
stitle='surface types',labels=labels,levels=levels,barwidth=.5
; contour irregularly grided data
loadct,5
w8x11
n=128
z=randata(n,n,s=4)
x=findgen(n)
y=findgen(n)
!p.multi=[0,1,2]
confill,z,x,y,title='Regularly Grided',c_color=-1
ii=randomu(iseed,200)*(n*n-1) ; random sample points
zz=z(ii) ; random samples
xx=ii mod n ; (zz,xx,yy are vectors)
yy=ii / n
confill,zz,xx,yy,title='Randomly Sampled',c_color=-1
oplot,xx,yy,psym=4,color=1,symsize=.4 ; show locations of sample points
; overlay three irregular regions in one confill plot
loadct,5
w8x11
n=128
z=randata(n,n,s=4)
ii=randomu(iseed,200)*(n*n-1) ; random sample points
zz=z(ii) ; random samples
xx=ii mod n ; (zz,xx,yy are vectors)
yy=ii / n
confill,zz,xx,yy,xrange=[0,300]
confill,zz^2,xx+150,yy/2,/overplot
confill,sqrt(zz>0),xx+150,70+yy/2,/over
AUTHOR: Paul Ricchiazzi 24 May 95
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/confill.pro)
routine: connected
useage: connected,image,nstring,view=view
purpose: The bi-level image is searched for all pixels which are
are part a continous set of adjacent pixels. Those pixel
groupings which contain fewer than NSTRING "on" pixels are
set to zero.
input:
image a bi-level image array (2d)
nstring the number of "on" pixels required for a given cluster of
adjacent pixels to survive.
output:
image a bi-level image with islands composed of fewer than nstring
pixels removed.
EXAMPLE:
r=randata(128,128,s=2) gt 7
connected,r,3,/view
WARNING: this procedure can take a lot of time for large images.
for images larger than 64 x 64 computation times goes
something like
time=c * (NX x NY)^2
for a DecStation 5000/240, c=7.4e-8, and
a 256x256 image takes about 5 minutes.
author: Paul Ricchiazzi Nov93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/connected.pro)
ROUTINE: contlev
PURPOSE: find a good set of contour levels
USEAGE: result=contlev(a)
INPUT:
a an array
KEYWORD INPUT:
maxlev maximum number of levels on the plot. Setting this keyword to,
say, 5 does not mean you will get 5 levels. It just means no
more than 5 levels will be generated.
OUTPUT:
result a vector of contour levels
EXAMPLE: contour,dist(20),levels=contlev(dist(20),maxlev=8)
author: Paul Ricchiazzi feb94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/contlev.pro)
NAME:
COSD
PURPOSE:
Return the cosine of an angle specified in degrees rather than radians.
CALLING SEQUENCE:
x = cosd(deg)
INPUTS:
angle angle in degrees
OPTIONAL INPUTS:
OUTPUTS:
Cosine of angle returned.
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 12/07/93
MODIFICATION HISTORY:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cosd.pro)
NAME:
COSSCATANG
PURPOSE:
Return the scattering angle of the incident and emerging rays.
NOTE: the scattering angle is defined as 180 degrees when
sza = vza = 0 and phi = 180.
CALLING SEQUENCE:
cos_omega = cosscatang(cossza, cosvza, phi)
INPUTS:
cossza cosine of solar (or incident) zenith angle
cosvza cosine of viewing (or emergin or satellite) zenith angle
phi relative azimuth angle; this is defined as the difference
between the solar azimuth angle and the viewing azimuth
angle; when sat, sun are in the same position in
the sky, phi = 0
OPTIONAL INPUTS:
OUTPUTS:
The scattering angle is returned.
EXAMPLE:
IDL> print,acosd(cosscatang(cosd(60),cosd(60),0))
0.00000
IDL> print,acosd(cosscatang(cosd(60),cosd(60),180))
120.000
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 1/04/94
MODIFICATION HISTORY:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cosscatang.pro)
################################## program calculates the coefficiency of var1 and var2 ################################## Gang He ESRG Jan. 1, 1993 ro cov,var1, var2 std1=mstdev(var1,mean1) std2=mstdev(var2,mean2)
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cov.pro)
ROUTINE: crystal
PURPOSE: compute the radius of an mie-sphere with scattering
properties equivalent to a irregular crystal shape.
USEAGE: crystal,type,area,volumn,nsph,rsph,geom=geom
INPUT:
type crystal type description Geom parameters
------------ ----------- ----------
1 hollow column L,a,d
2 bullet rosette L,a,t
3 dendrite on plate L,a,bb,bt
4 capped column L1,L2,L3,a1,a2,a3
KEYWORD INPUT:
;
g1,g2... geometry parameters in order given above, The geometry
parameters may be an array of values, in which case the
the output is also an array.
L g1 column length (1,2) or disk thickness (3) (um)
a g2 hexagonal face width (1,2,3) (um)
d g3 cavity depth at each end of column (1) (um)
t g3 conical pyramid height on bullet rosettes (2) (um)
bb g3 base width of dendrite (3) (um)
bt g4 length of dendrite (3) (um)
L1 g1 cap thickness (4) (um)
L2 g2 column length (4) (um)
L3 g3 other cap thickness (4) (um)
a1 g4 cap hexagonal face width (4) (um)
a2 g5 hexagonal face width of column (4) (um)
a3 g6 other cap hexagonal face width (4) (um)
OUTPUT:
rsph radius of equivalent Mie spheres (um)
nsph number of equivalent Mie spheres (not required for mie
parameter calculation)
area area in um^2
volume volume in um^3
DISCUSSION:
According to Warren and Grenfeld, the scattering
parameters of an irregular the crystal can be
approximated by those of the set of equivalent Mie
spheres, such that the both the area and volume of the
set of spheres match those of the original crystal.
Say the density of a given crystal type is N per unit volume
the extinction coefficient, kappa, (per unit distance) is
given by,
kappa = N * Q * A / 4
where Q is the unknown extinction efficiency and the factor
of 4 is to turn area into average cross-sectional area.
According to W&G, kappa is approximately given by,
kappa = N * Q_mie(rsph) * (nsph * pi rsph^2)
= N * Q_mie(rsph) * A/4
The single scattering albedo and asymmetry factor are given by,
omega = omega_mie(rsph)
g = g_mie(rsph)
EXAMPLE:
;
l=findrng(50,200,100)
crystal,1,r,g1=l,g2=50,g3=50
plot,l,r
REVISIONS:
AUTHOR: Paul Ricchiazzi 27 Jul 95
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/crystal.pro)
INPUTS:
x1,x2,y1,y2
coordinates of box edges. If XWIN,YWIN,XRNG,YRNG are set, then
input is in data coordinates, otherwise in normalized coordinates.
KEYWORD PARAMETERS:
init
If this keyword is set, the initial position of the cursor
is given by X1,X2,Y1,Y2
message
If this keyword is set, print a short message describing
operation of the cursor.
xwin,ywin
two element vectors giving normalized x and y coordinates of window
subregion, for example that given by !x.window or !y.window
xrng,yrng
two elements vectors giving data range of window subregion, for
example, as given by !x.crange or !y.crange. When CURBOX is used
with TVIM (and XRANGE and YRANGE are not used with TVIM), XRNG
and YRNG represent the total index range of the displayed
image. X1,X2,Y1,Y2 will then be the array subrange of the
selected region.
index
if set, the XRNG,YRNG,XWIN,YWIN parameters are set to the values of
the last data window, i.e., !x.crange,!y.crange, !x.window, and
!y.window respectively. Setting INDEX causes X1,X2,Y1,Y2 to be
interpreted as index range coordinates.
inc
increment by which to change cursor box size when right or left
mouse button is pressed. Specified in data index coordinates (i.e.,
array index coordinate) when XWIN,YWIN,XRNG,YRNG are set, otherwise
in normalized coordinates. The x and y increments may be specified
separately by providing INC as a two element array.
label
a string which is used to label the selected region. The string is
centered within the region and is sized to ensure that it fits within
the box. If LABEL is set the box is not erased after CURBOX returns
color
color used to label regions
charsize
character size used for region labels
fill
color used to fill box region, only effective when LABEL is set
OUTPUTS:
x1,x2,y1,y2
normalized coordinates coordinates of box edges. Howvever, if
xwin, ywin, xrng, and yrng are set, output is in data index
coordinates, i.e., x1,x2,y1,y2 provide the index range of the
boxed region of the image.
If xwin,ywin,xrng,yrng are set, the output range is clipped to be
within the limits of xrng and yrng.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A box is drawn in the currently active window. It is erased
on exit.
RESTRICTIONS:
Works only with window system drivers.
PROCEDURE:
The graphics function is set to 6 for eXclusive OR. This
allows the box to be drawn and erased without disturbing the
contents of the window.
Operation is as follows:
Left mouse button: reduce box size
Middle mouse button: increase box size
Right mouse button: Exit this procedure, returning the
current box parameters.
NOTE: CURBOX is designed for applications in which the aspect
ratio of the cursor box is fixed. However, if the
aspect ratio must be adjusted do the following: jam the
box against one of the window borders. If you force
the box against the left or right borders (while
keeping the cursor pointer within the window) box size
is constrained to change only in the height. Similarly
the box can be made fatter or thiner by pushing the box
against the top or bottom. As usual the LMB decreases
size and the MMB increases size.
; EXAMPLE
;
; use curbox to interactively select subregions from a TVIM image
w8x11
!p.multi=[0,1,2]
f=randata(128,128,s=3)
tvim,f,/interp
xw=!x.window & xr=!x.crange
yw=!y.window & yr=!y.crange
x1=60 & x2=80 & y1=60 & y2=80
!p.charsize=2
!p.multi=[4,2,4]
curbox,x1,x2,y1,y2,xw,yw,xr,yr,/init,inc=4,/mess,label='region 1'
confill,f(x1:x2,y1:y2),title='region 1'
curbox,x1,x2,y1,y2,xw,yw,xr,yr,/init,inc=4,/mess,label='region 2'
confill,f(x1:x2,y1:y2),title='region 2'
curbox,x1,x2,y1,y2,xw,yw,xr,yr,/init,inc=4,/mess,label='region 3'
confill,f(x1:x2,y1:y2),title='region 3'
curbox,x1,x2,y1,y2,xw,yw,xr,yr,/init,inc=4,/mess,label='region 4'
confill,f(x1:x2,y1:y2),title='region 4'
; use CURBOX to find the normalized coordinates of a window region
; of given aspect ratio
x1=.4 & x2=x1+.3 & y1=.4 & y2=y1+.1
curbox,x1,x2,y1,y2,/init,/mess
print,x1,x2,y1,y2
author Paul Ricchiazzi April, 1993
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/curbox.pro)
ROUTINE: cursim
USEAGE: cursim,a,yy,xx,range=range
PURPOSE: Use the graphics cursor to interrogate a TVIM image for
pixel values and positions.
INPUT:
a image array, same size as used in TVIM image
yy, xx 2-D arrays of "vertical" and "horizontal" position
in the geographical case these would be lat and lon arrays
If these arrays are not supplied the x and y data
coordinates are used instead.
OPTIONAL INPUT:
point if set, CURSIM will print the range and azimuth
of the cursor from this point. (Palmer = [-64.767,-64.067] )
When this option is used the lat,lon coordinates must
be available either in the data coordinates of the plot
(i.e., as specified by the XRANGE and YRANGE parameter
in the TVIM call) or explicitly as the YY and XX parameters
in CURSIM
EXAMPLE:
tvim,hanning(200,200),xrange=[-180,180],yrange=[-90,90]
map_set,0,0,/cont,/grid,pos=boxpos(/get),/noerase
cursim,hanning(200,200),point=[35,-120]
author: Paul Ricchiazzi sep92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cursim.pro)
ROUTINE: cursx
USEAGE: cursx,xx,yy,verbose=verbose
PROCEDURE: Use the graphics cursor to find xy point on plot.
xy point is written to pop-up widget.
If a single argument is supplied (XX) it is interpreted
as an image or z value which will be evaluated when
the LMB is pressed. This option works with TVIM images
or plots drawn with CONTOUR.
if two arguments are supplied (XX and YY) they are
interpreted as the x and y values of a curve in the xy
plane. The y value of the function is evaluated when
the LMB is pressed. This option works with plots drawn
with PLOT
Hit and drag LMB to retrieve coordinates and values
Hit MMB to quit and retain pop-up display
Hit RMB to quit and destroy pop-up
INPUT:
xx x coordinate or image array
yy if present this parameter indicates CURSX should be run
in curve follow mode (CFM). In this mode the y value at a
x coordiate point is indicated with a drawn symbol. The
symbol position follows the shape of the drawn curve as
the cursor is dragged across the plot.
Keyword input
psym symbol used to mark xy point in plot follow mode.
symsize symbol size
color color of symbol
silent if set, pop up window will not contain operating instructions
interpolate if set and non-zero, interpolate between defined x and y
points in plot follow mode
EXAMPLE:
plot,dist(20)
cursx
; display value at a point
f=randata(100,100,s=3)
tvim,f,xra=[100,120],yra=[30,50],xtitle='longitude',ytitle='latitude',/scale
cursx,f
; pick values off a plot using curve follow mode
x=findgen(200)
y=randf(200,1.5)
plot,x,y
loadct,5
thick,2
cursx,x,y,psym=1,symsize=2,color=100
thick,1
author: Paul Ricchiazzi sep92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/cursx.pro)
ROUTINE: daverage
USEAGE: daverage,lat,sza,yy
PURPOSE:
finds the daylight hour average of yy at each latitude
point. Average values are for spring or fall equinox
INPUT:
lat array of latitude points
sza solar zenith angle array
yy function of solar zenith angle
OUTPUT:
result average of yy over 12 hours (daylight)
EXAMPLE:
lat=indgen(10)*10
sza=acos((indgen(11))*.1)/!dtor
yy=90-sza
!p.multi=[0,1,2]
plot,sza,yy
plot,lat,daverage(lat,sza,yy)
procedure: At the spring or fall equinox the solar zenith angle at
a given latitude is given by,
cos(sza)=cos(lat)*cos(phi)
where phi is the phase angle of the earth's rotation
[= 2 pi*(time-12)/24)]
thus for each value of lat we have
yave=integral(phi,yv)/!pi
where,
yv=interpol(yy,mu,cos(lat*!dtor)*cos(phi*!dtor))
mu=cos(sza*!dtor)
AUTHOR: Paul Ricchiazzi 24 Aug 95
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/daverage.pro)
REQUIRED INPUTS:
mon ranges from 1-12
day ranges from 1-31
year
OUTPUTS:
julday Julian day, ranges from 1-365(366)
AUTHOR:
Jeff Hicke
DATE:
11/16/93
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/day2jul.pro)
ROUTINE: dayave
PURPOSE: convert quantities which depend on sza to daily averages for
given values of day_of_year and latitude
USEAGE: result=dayave(doy,lat,sza,xx)
INPUT:
doy the day of year (vector)
lat latitude (vector)
sza a vector of solar zenith angles (degrees) monitonic increasing
xx a vector of a quantity which varies with SZA. If
max(sza) lt 90 then it is assumed that xx=0 when
(cos(sza) le 0). If this is not the case, then data
values for the full SZA angle range [-90,90] must be
supplied.
KEYWORD INPUT
dt averaging interval in hours (default=0.25 hours)
zenith zenith angles at each time, doy and lat (24/dt,nday,nlat)
(returned by first call of DAYAVE, see below)
if zero or absent, DAYAVE recomputes the zenith angle at
each point in the (DOY # LAT) input grid. This can be
fairly time consuming when there are lots of grid points.
By supplying a zero filled named variable to DAYAVE you
can retrieve the ZENITH grid for the next call to DAYAVE.
night if set, the interpolated value of xx is not set to zero
when sza is greater than 90. This should be used for
physical quantities which maintain non-zero values even
after sunset
OUTPUT:
result the integral of xx(t) dt for the given days and latitudes
EXAMPLE:
!p.multi=[0,1,2]
doy=findgen(365/30+1)*30
lat=findgen(90/10+1)*10
sza=findgen(90/10)*10
xx=cos(sza*!dtor)
zenith=0. ; zero filled named variable to
; retrieve zenith angle grid
yy=dayave(doy,lat,sza,xx,zenith=zenith)
tvim,yy,xrange=doy,yrange=lat,xtitle='day of year',ytitle='latitude',$
title='daily integral of sup(cos(sza),0)',/scale,/interp
xx2=xx^2
yy2=dayave(doy,lat,sza,xx2,zenith=zenith)
tvim,yy2,xrange=doy,yrange=lat,xtitle='day of year',ytitle='latitude',$
title='daily average of sup(cos(sza)!a2!n,0)',/scale,/interp
author: Paul Ricchiazzi aug94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/dayave.pro)
ROUTINE dcolors
USEAGE dcolors
dcolors,r=r,g=g,b=b,pickc=pickc,squeeze=squeeze,view=view
INPUT: none
Keyword input:
pickc if set, call pickc to adjust discreet colors
squeeze if set, original color table is resampled to fit
in remaining color table index space.
view if set, draw palette of discreet colors to separate window
r,g,b red, green and blue values of discreet color table.
default colors:
r = [ 0, 255, 0, 150, 255, 196, 3, 0, 150, 98, 0]
g = [ 0, 0, 255, 150, 2, 126, 148, 175, 0, 94, 0]
b = [ 0, 0, 0, 255, 212, 0, 186, 0, 100, 150, 255]
OUTPUT: none
PURPOSE: loads custom colors in lower part of current color
scale. If SQUEEZE is set pre-existing color scale
is squeezed to fit between color index n_elements(r)
and !d.n_colors.
author: Paul Ricchiazzi jan93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/dcolors.pro)
FUNCTION degrade
PURPOSE: degrade image resolution by a factor of two
USEAGE: result=degrade(array)
INPUT:
array an image array of dimension NX x NY, where both nx
ny are divisible by 2. If nx or ny are not divisible by
2 a subimage is extracted that leaves off the last row
or column and is divisible by 2 in both directions.
KEYWORD INPUT:
min if set the returned value for each superpixel is the min
of each of the four subpixels
max if set the returned value for each superpixel is the max
of each of the four subpixels
output:
result image array of dimension NX/2 x NY/2 composed of 2 x 2
superpixel averages of u (except if MIN or MAX keyword is
set, see above)
AUTHOR: Paul Ricchiazzi 26 May 95
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/degrade.pro)
ROUTINE dens2d,x,y,g,nbins=nbins,xrange=xrange,yrange=yrange,$
title=title,xtitle=xtitle,ytitle=ytitle,psym=psym,$
grid=grid,tvim=tvim,scale=scale,contur=contur
PURPOSE Compute and/or display the density function of a 2-d scatter
of points with coordinate x and y
INPUTS:
x array of values
y array of values (same size as x)
OUTPUTS:
g 2-d histogram array of size nbins(0) x nbins(1)
OPTIONAL INPUTS (keyword parameters):
nbins 1 or 2 element vector, number of bins in x and y direction
default is (20,20)
xrange 2 element vector, binning range in x direction
yrange 2 element vector, binning range in y direction
charsize character size
title plot title
xtitle x axis label
ytitle y axis label
psym symbol used for scatter plot, if negative don't plot points
grid if set, show binning grid
contur if set, draw in density contours (default)
confill if set, use CONFILL is used to draw contours
tvim if set, use TVIM to display the point density function
if tvim is set to 1 image is smoothed
if tvim is set to 2 image is not smoothed
scale if set, draw in a color scale
0=> no color scale
1=> regular color scale (default)
2=> stepped color scale
EXAMPLE
x=randomn(is,2000)
y=4*randomn(is,2000) + x^3
dens2d,x,y,g,/tvim,/grid
dens2d,x,y,/tvim,/contur
dens2d,x,y,psym=-1,/contur
AUTHOR: Paul Ricchiazzi, Earth Space Research Group, sep92
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/dens2d.pro)
ROUTINE: digitize
PURPOSE: digitize hardcopy graphical information.
USEAGE: digitize,x,y
INPUT: none
KEYWORD INPUT:
xr x axis range of hardcopy plot, prompted for if not supplied
yr y axis range of hardcopy plot, prompted for if not supplied
OUTPUT:
x vector of x coordinate values
y vector of y coordinate values
PROCEDURE: 1. make a photo copy of the graph on tranparency film.
2. run DIGITIZE and enter the x and y axis range.
3. align the hard copy graph onto the axis drawn by DIGITIZE
and use scotch tape to stick the film onto your screen
4. click with LMB on the axis end points (will prompt)
5. trace over the plot with cursor, LMB adds points, MMB
erases points and RMB exits the program
NOTE: Because the outer glass surface of the screen is not
on the same plane as the displayed image their is a
slight parallax effect between the tranparency and the
DIGITIZE grid. The parallax error is minimized by
keeping your line of sight normal to the screen.
EXAMPLE:
digitize,x,y ; try it
plot,x,y
REVISIONS:
author: Paul Ricchiazzi sep93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/digitize.pro)
ROUTINE: doc
PURPOSE: find and display help for a named procedure
USEAGE: doc,'name'
INPUT:
name name of idl .pro file. Asterisk characters, "*", in NAME
specify wild card matches to 1 or more arbitrary characters.
PROCEDURE: DOC searches through the files /local/idl/help/*.help
trying to find matches for the file specification, NAME.
if there are no matches a brief failure message is displayed
and control returns to the terminal
if 1 match is found, help for the specified procedure is
displayed and control returns to the terminal
if 2 or more matches are found a menu is generated
from which selections can be made. Control returns to
the terminal when the DONE button of the MENUW widget
is pressed.
EXAMPLE:
doc,'legend' ; exact match found in ESRG_LOCAL
doc,'tv*' ; many matches found, browse through
; choices. Notice that all procedure
; libraries are searched
author: Paul Ricchiazzi may94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/doc.pro)
ROUTINE: dockey
PURPOSE: display help documententation of file headers which
contain matches for specified keywords
USEAGE: dockey,'name',keyword=keyword,all=all,minmatch=minmatch
INPUT:
keywords keyword string. Keywords withing the KEYWORDS must be
separated by blanks.
KEYWORD_INPUT
minmatch the minimum number of keyword hits required for a procedure
to be listed in the hit-list menu.
PROCEDURE: DOCKEY searches through the helpfiles in subdirectory
/local/idl/help, trying to find matches for the keywords.
If more than one file match is found a menu of procedure
names is displayed from which the desired procedure
can be selected. The parenthisized number next to each
procedure name is the number of keyword matches, which
can vary between one to the total number of keywords in
KEYWORDS.
MAN_PROC is used to display the text
EXAMPLE:
dockey,'simpson rule integration'; pick group 'numerical'
dockey,'polar orthographic' ; pick group 'esrg'
dockey,'color key image',m=2 ; pick group 'color'
;
author: Paul Ricchiazzi may94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/dockey.pro)
ROUTINE: dydx
PURPOSE: compute numerical derivative accurate to second order.
In most cases this should be more accurate than the
IDL userlib procedure DERIV.
USEAGE: dydx(x,y)
INPUT:
x vector of independent variable (monitonic)
y vector of dependent variable
KEYWORD INPUT:
lin_end if set, use a one sided linear approximation for end points
OUTPUT: numerical derivative dy/dx
EXAMPLE:
!p.multi=[0,1,2]
x=[0.,1.,3.,8.,10.,13.,17.,19.,22.,25.]
y=x*(25-x) & yp=25-2*x & labels=['analytic','dydx','deriv']
plot,x,y,title='quadratic [dydx(x,y) is exact in this case]'
plot,x,yp & oplot,x,dydx(x,y),psym=2 & oplot,x,deriv(x,y),psym=4
legend,labels,li=[0,0,0],psym=[0,2,4],pos=[0.5,0.7,0.75,0.98]
x=[0.0,0.5,1.5,2.,3.,3.6,4.0,5.,6.,6.3]
y=sin(x) & yp=cos(x)
plot,x,y,title='sin(x)'
plot,x,yp & oplot,x,dydx(x,y),psym=2 & oplot,x,deriv(x,y),psym=4
legend,labels,li=[0,0,0],psym=[0,2,4],pos=[0.25,0.7,0.50,0.98]
x=[-2.,-1.,-.7,-.3,-.1,0.,.1,.3,.7,1.,2]
y=exp(-x^2) & yp=-2*x*y
plot,x,y,title='gausian'
plot,x,yp & oplot,x,dydx(x,y),psym=2 & oplot,x,deriv(x,y),psym=4
legend,labels,li=[0,0,0],psym=[0,2,4],pos=[0.5,0.7,0.75,0.98]
REVISIONS:
author: Paul Ricchiazzi jan94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/dydx.pro)
NAME:
EARTHDIST
PURPOSE:
Calculate the great circle distance (in km) based on lats and lons.
CALLING SEQUENCE:
dist = earthdist(lat1,lon1,lat2,lon2)
INPUTS:
lat1 latitude of first point
lon1 longitude of first point
lat2 latitude of second point
lon2 longitude of second point
KEYWORD INPUTS:
OPTIONAL INPUTS:
OUTPUTS:
Distance along great circle returned.
OPTIONAL OUTPUTS:
EXAMPLE:
print,earthdist(0,0,0,1)
111.189
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 4/05/94
MODIFICATION HISTORY:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/earthdist.pro)
NAME:
EI
PURPOSE:
Set the system variable to allow for large pasting of data using
X. Only necessary for the alphas. This has the side effect of
not allowing use of the editing (arrow) keys. This procedure
toggles this ability on and off. NOTE: This is probably a bug
in IDL and therefore the need for this procedure will disappear in
the near future.
CALLING SEQUENCE:
ei
INPUTS:
OPTIONAL INPUTS:
OUTPUTS:
EXAMPLE:
ei
... paste in large amts of data ...
ei
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 1/04/94
MODIFICATION HISTORY:
Added change of prompt Jeff Hicke 05/20/94
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/ei.pro)
NAME:
ENDPS
PURPOSE:
close postscript file, reopen display
CALLING SEQUENCE:
ENDPS
INPUTS:
KEYWORD INPUTS:
notime don't timestamp
OPTIONAL INPUTS:
OUTPUTS:
OPTIONAL OUTPUTS:
EXAMPLE:
PROCEDURE
COMMON BLOCKS:
None.
NOTES
REFERENCES
AUTHOR and DATE:
Jeff Hicke Earth Space Research Group, UCSB 9/22/92
MODIFICATION HISTORY:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/endps.pro)
ROUTINE: expint
PURPOSE: compute the exponential integral of x.
the exponential integral of index n is given by
integral( exp(-tx)/x^n dx)
range of integration is 1 to infinity
USEAGE: result=expint(ind,x)
INPUT:
ind order of exponential integral, for example use ind=1
to get first exponential integral, E1(x)
x argument to exponential integral ( 0 < x < infinity)
OUTPUT:
result exponential integral
SOURCE: Approximation formula from Abromowitz and Stegun (p 231)
author: Paul Ricchiazzi 9DEC92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/expint.pro)
ROUTINE: eye
PURPOSE: draw an eye symbol to show observer position and look direction
USEAGE: eye,x0,y0,angle=angle,size=size,color=color,icolor=icolor,$
data=data,device=device
INPUT:
x0,y0 coordinates of eye symbol position (normal coordinates by default)
KEYWORD INPUT:
angle angle of symbol wrt due right alignment
size symbol size
color color index used to draw eye outline
icolor color index used to draw iris
data if set, x0,y0 in data coordinates
device if set, x0,y0 in device coordinates
EXAMPLE:
plot,[0,1],/nodata
arrow,0,1,.5,.5,/data
eye,.55,.45,/data,size=3,angle=135
; here is a interactive method to place the eye symbol
!err=0 & angle=0 & x=.5 & y=.5
tvcrs,.5,.5,/norm & while !err ne 4 do begin &$
!err=0 &$
eye,x,y,angle=angle,size=5,color=0 &$
cursor,x,y,/norm,/nowait &$
if !err eq 1 then angle=angle-5 &$
if !err eq 2 then angle=angle+5 &$
eye,x,y,angle=angle,size=5 &$
wait,.05 &$
endwhile
cmdstr=string(f='("eye,",2(g10.3,","),"angle=",g10.3)',x,y,angle)
print,strcompress(cmdstr,/remove_all)
AUTHOR: Paul Ricchiazzi 10 Dec 96
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/eye.pro)
routine: fignum
useage: fignum,fig=fig,charsize=charsize,font=font
input: none
keyword input:
fig
if FIG is set to an integer greater than zero figure numbering
is enabled and the initial figure number is set to FIG. If FIG
is set to zero figure numbering is disabled. If FIG is set to a
string scalar then that string will be appended to "Figure" and
written to as usual. For example fignum,fig="4a" writes "Figure 4a".
output: none
PURPOSE:
automatical increment a figure number index and draw the number
on a sequence of plots.
COMMON BLOCKS: fignum_blk
EXAMPLE:
plot,dist(20)
fignum,fig=1,font='!3',charsize=2
for i=1,4 do begin & plot,dist(20) & fignum & pause & end
author: Paul Ricchiazzi 22sep92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/fignum.pro)
ROUTINE: fill_arr
USEAGE: fill_arr,a,ii
fill_arr,a,ii,niter=niter,omega=omega,tol=tol,po=po
PURPOSE: fill in undefined regions of a 2-d array by interpolation
INPUT:
a array with some undefined points
ii index array of good image points,
E.G., ii=where(aa ne 999)
KEYWORD INPUT
tol maximum tolerance to achieve before stopping iteration
(default=0.001)
niter number of smoothing iterations (default=100)
po if set print diagnostic print out every PO iterations
OUTPUT:
a image array with initially undefined points replaced
with values that vary smoothly in all dimensions
Initially defined points are unchanged.
PROCEDURE: repeat this sequence
asave=a(ii)
a=smooth(a,3)
a(ii)=asave
AUTHOR Paul Ricchiazzi 29oct92
Earth Space Research Group UCSB
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/fill_arr.pro)
ROUTINE: fill_image
USEAGE: fill_image,a,ii
PURPOSE: fill in undefined regions of a 2-d array by interpolation
INPUT:
a image array with some undefined points
ii index array of bad image points,
E.G., ii=where(aa eq 999)
keyword input
extrapolate if set extrapolation is used to fill in bad values outside
of region covered by convex hull of good points.
OUTPUT:
a image array with initially undefined points replaced
with values that vary smoothly in both the horizontal and
vertical directions. Initially defined points are
unchanged.
PROCEDURE: Use TRIANGULATE and TRIGRID to establish a linear
interpolation function which is used to fill in
the undefined regions. The points used to
generate the triangulation are immediately
adjacent to the undefined regions. "Good data" regions
are unchanged. Execution time is increased if a
large fraction of the image is undefined.
EXAMPLE:
a=fltarr(16,16)
x=[4,11,4,11]
y=[4,4,11,11]
a(x,y)=[1,2,4,3.]
fill_image,a,where(a eq 0.),/extra
tvim,a,/scale
print,a(x,y)
; create a test pattern, splatter on some "no data"
; and fix it back up with FILL_IMAGE
; compare original data with fixed up data
w8x11
!p.multi=[0,2,2]
loadct,5
a=randata(256,256,s=3) & a=a-min(a) & aa=a
tvim,a>0,/scale,title='Original Data',clev=clev
contour,a>0,/overplot,levels=clev
a(where(smooth(randomu(iseed,256,256),21) gt .51))=-999.; bad values
tvim,a>0,/scale,title='Missing Data'
fill_image,a,where(a eq -999)
tvim,a>0,/scale,title='Restored data'
contour,a>0,/overplot,levels=clev
confill,aa-a,levels=[-1,-.1,-.01,.01,.1,1],title='Difference',/asp,c_thic=0
AUTHOR Paul Ricchiazzi 29oct92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/fill_image.pro)
ROUTINE: findex
PURPOSE: Compute "floating point index" into a table for use with
INTERPOLATE.
USEAGE: result = findex(u,v)
INPUT:
u a monitically increasing or decreasing 1-D grid
v a scalor, or array of values
OUTPUT:
result Floating point index. Integer part of RESULT(i) gives
the index into to U such that V(i) is between
U(RESULT(i)) and U(RESULT(i)+1). The fractional part
is the weighting factor
V(i)-U(RESULT(i))
---------------------
U(RESULT(i)+1)-U(RESULT(i))
DISCUSSION:
This routine is used to expedite one dimensional
interpolation on irregular 1-d grids. Using this routine
with INTERPOLATE is much faster then IDL's INTERPOL
procedure because it uses a binary instead of linear
search algorithm. The speedup is even more dramatic when
the same independent variable (V) and grid (U) are used
for several dependent variable interpolations.
EXAMPLE:
; In this example I found the FINDEX + INTERPOLATE combination
; to be about 60 times faster then INTERPOL.
u=randomu(iseed,200000) & u=u(sort(u))
v=randomu(iseed,10) & v=v(sort(v))
y=randomu(iseed,200000) & y=y(sort(y))
t=systime(1) & y1=interpolate(y,findex(u,v)) & print,systime(1)-t
t=systime(1) & y2=interpol(y,u,v) & print,systime(1)-t
print,f='(3(a,10f7.4/))','findex: ',y1,'interpol: ',y2,'diff: ',y1-y2
AUTHOR: Paul Ricchiazzi 21 Feb 97
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/findex.pro)
useage: findrng,x1,x2,x3
purpose: generates x3 floating point numbers
spanning range x1 to x2
KEYWORD
dx if set ignor x3 and compute number of elements with 1+(x2-x1)/dx
where dx is the increment
author: Paul Ricchiazzi jan93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/findrng.pro)
FUNCTION finterp
USEAGE result=finterp(table,uvar)
PURPOSE: Compute the floating point interpolation index of
UVAR(i,j,k...) into TABLE(*,i,j,k...) or TABLE(*).
For example, if uvar(i,j) is half way between
table(4,i,j) and table(5,i,j) then result(i,j)=4.5.
NOTE: If TABLE is a vector the action of FINTERP is
the same as INTERPOL(findgen(n),TABLE,UVAR). However,
FINTERP should be much faster whenever UVAR is large
and the number of TABLE values (first dimension of
TABLE) is small.
INPUT
table A matrix or vector. If TABLE is not a vector, the
first dimension of TABLE is interpreted as a vector
of values that correspond to each element of UVAR.
If TABLE is a vector, the action of FINTERP is the
same as INTERPOL(findgen(n),TABLE,UVAR)
uvar a matrix of field values.
OUTPUT:
result the floating point interpolation index of UVAR(i,j,k...)
into TABLE(*,i,j,k,...).
; EXAMPLE:
a=[[5.1,8.4],[6.7,3.1]]
tbl=fltarr(5,2,2)
tbl(*,0,0)=3+findgen(5)
tbl(*,1,0)=4+findgen(5)
tbl(*,0,1)=4+findgen(5)*2
tbl(*,1,1)=findgen(5)
fi=finterp(tbl,a)
print,f='(8a9)',' ','UVAR','/---','----','TBL','----','---\','FI' &$
print,f='(a9,7f9.2)','(0,0):',a(0,0),tbl(*,0,0),fi(0,0) &$
print,f='(a9,7f9.2)','(1,0):',a(1,0),tbl(*,1,0),fi(1,0) &$
print,f='(a9,7f9.2)','(0,1):',a(0,1),tbl(*,0,1),fi(0,1) &$
print,f='(a9,7f9.2)','(1,1):',a(1,1),tbl(*,1,1),fi(1,1)
; EXAMPLE:
Map surface albedo over some area, given satellite
radiance measurement on a 2d grid. Assumptions:
1. ff(m,i,j) = irradiance predictions at each point
in a 2d grid. The m index is over different
values of surface albedo. The table values vary
from point-to point (the i and j indecies) due to
changes in satellite and solar viewing angles as
well as surface albedo.
2. salb(m) = a vector of different surface albedos
used in the model caculations.
3. aa(i,j) = actual measured values of radiance
on the same grid.
To retrieve the optical surface albedo at each point
in the image use INTERPOLATE to compute the surface
albedo at each point:
salb_map=interpolate(salb,finterp(ff,aa))
or if logrithmic interpolation is desired
fndx=finterp(ff,aa)
salb_map=interpolate(alog(salb_map+1),fndx)
salb_map=exp(salb_map)-1.
PROCEDURE: uses WHERE to identify regions for interpolation.
a separate call to WHERE is used for each table interval.
The floating point index may extrapolate beyond the
limits of the TABLE. Hence UVAR values less-to or
greater-than the corresponding TABLE entries will
produce return values which are outside the TABLE
subscript range (INTERPOLATE knows how to handle this).
RESTRICTIONS: Table entries (first index of TABLE) must be monitonically
increasing. If the table is not monitonically increasing
FINTERP only finds solutions for that part of the table
which is monitonically increasing. In this case, the return
value for UVAR elements less than the relative minimum of
TABLE is set to -9999.
author: Paul Ricchiazzi apr93
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/finterp.pro)
NAME:
FLICKER
PURPOSE:
Flicker between two output images
CATEGORY:
Image display, animation.
CALLING SEQUENCE:
FLICKER, A, B
INPUTS:
A: Byte image number 1, scaled from 0 to 255.
B: Byte image number 2, scaled from 0 to 255.
if a and b are not supplied FLICKER will enter interactive mode
wherin the user will be asked to select two windows (by a LMB
click inside the chosen window). These two windows will be read
using tvrd() and compared.
KEYWORD PARAMETERS:
None.
OUTPUTS:
No explicit outputs.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Sunview: Modifies the display, changes the write mask.
X and Windows: uses two additional pixmaps.
RESTRICTIONS:
None.
PROCEDURE:
SunView:
Image A is written to the bottom 4 bits of the display.
Image B is written to the top 4 bits.
Two color tables are created from the current table, one that
shows the low 4 bits using 16 of the original colors, and one
that shows the high 4 bits. The color table is changed to
switch between images.
Other window systems:
two off screen pixmaps are used to contain the images.
on exit image A is left on the display
MODIFICATION HISTORY:
DMS, 3/ 88.
DMS, 4/92, Added X window and MS window optimizations.
PJR/ESRG, 1/94, "flicker" control by mouse
PJR/ESRG, 1/94, put in tvrd() of windows for interactive use
EXAMPLE:
window,0,xs=200,ys=200 & plot,sin(dist(10))
window,1,xs=200,ys=200 & plot,sin(dist(10)+.05)
window,2,xs=200,ys=200 & plot,sin(dist(10)+.1)
window,3,xs=200,ys=200 & plot,sin(dist(10)+.15)
flicker ; choose two windows to compare
author: Paul Ricchiazzi jan94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/flicker.pro)
ROUTINE: flight_angle
PURPOSE: compute zenith and azimuth of a unit vector pointing "up"
in coordinate system attached to an aircraft.
USEAGE: flight_angle,pitch,roll,heading,zenith,azimuth
INPUT:
pitch pitch angle (degrees) positive values indicate nose up
roll roll angle (degrees) positive values indicate right wing down
heading compass direction aircraft is pointed. Positive values
represent clockwise, with respect to true North. NOTE:
This heading is the direction the airplane is pointed, not
the direction it is moving
KEYWORD_INPUT
radians if set all input and output angles are in radians
OUTPUT:
zenith zenith angle of "up" unit vector
azimuth azimuth angle of "up" unit vector. Positive values
represent clockwise, with respect to true North.
EXAMPLE:
; compute the solar zenith angle of a airbourne sensor given
; (roll,pitch,heading) = (2,3,45) degrees at 10 am today
doy=julday()-julday(1,0,1994)
zensun,doy,12,34.456,-119.813,z,a,/local
print,f='(6a13)','z','a','sunzen','sunaz','sunmu','corrected'
flight_angle,2.,2.,45.,zen,az
print,zen,az,z,a,cos(z*!dtor),muslope(z,a,zen,az)
flight_angle,2.,-2.,45.,zen,az
print,zen,az,z,a,cos(z*!dtor),muslope(z,a,zen,az)
flight_angle,2.,0.,0.,zen,az
print,zen,az,z,a,cos(z*!dtor),muslope(z,a,zen,az)
AUTHOR: Paul Ricchiazzi 25 Feb 97
Institute for Computational Earth System Science
University of California, Santa Barbara
paul@icess.ucsb.edu
REVISIONS:
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/flight_angle.pro)
ROUTINE: fonts
userage: fonts,greek=greek,math=math,gothic=gothic,script=script,$
italic=italic,all=all
PURPOSE: display available fonts in a new window
INPUTS: none
author: Paul Ricchiazzi jan94
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/fonts.pro)
ROUTINE: fordata
USEAGE: fordata,name,v,format=format,margin=margin,ng=ng,append=append
PURPOSE: print a fortran data statement to file "junk"
defining variable NAME with data values v
input:
name name of variable or string to placed between the fortran
"data" and "/" keywords, as in
data NAME / ...
v vector of values
keyword input
format format specifier (string) of the form
x# or x## x#.# x##.# where x = { i, g, f, e }
and # is a digit (default = 'g10.4'). Note that
the format string does not include parenthesis.
append append to file "junk"
margin number of leading blanks (margin=0 starts at column 7)
(default=2)
ng number of elements written in an implied fortran loop
for example ng=5 in the following snippit of fortran
data (v(i),i=1,5)/10,12,24,11,22/
data (v(i),i=6,10)/13,44,45,22,33/
The default value is chosen to produce 20 fortran
continuation statements. pick a smaller value if
the number of continuations allowed on your fortran
compiler is less than 20. Set ng to a large number
if no implied loops are desired.
output: none
Side effects: writes data statement to file "junk"
EXAMPLE:
v=sin(findgen(200))
fordata,'(v(i),i=1,100)',v(0:99),f='f12.6'
fordata,'(v(i),i=101,200)',v(100:199),f='f12.6',/append
; automatically put in fortran implied do list to avoid an excessive
; number of continuation statements
fordata,'v',v
author: Paul Ricchiazzi jun92
Institute for Computational Earth System Science
University of California, Santa Barbara
(See /host/bluemoon/usr2/idllib/contrib/esrg_ucsb/fordata.pro)
ROUTINE: fordatin
PURPOSE: read fortran data statements
USEAGE: result=fordatin(file,varname)
INPUT:
file name of fortran source file containing target
data statement (string)
varname name of fortran variable initialized in data statement
(string)
KEYWORD INPUT:
pu the name of