WARP_TRI $RSI/warp_tri.pro
[Previous] [Next]
 NAME:
	WARP_TRI

 PURPOSE:
	This function warps images using control (tie) points.

 CATEGORY:
	Image processing, geometric transformation.

 CALLING SEQUENCE:
	Result = WARP_TRI(Xo, Yo, Xi, Yi, Im_in)

 INPUTS:
	Xo, Yo:	     Vectors containing the locations of the tie points
		     in the output image.
	Xi, Yi:	     Vectors containing the location of the tie points
		     in the input image (Im_in). Xi, Yi must be the same
		     length as Xo, Y0.
	Im_in:	     The image to be warped. May be any type of data.

 KEYWORD PARAMETERS:
	OUTPUT_SIZE: A 2-element vector containing the size of the
		     output image. If omitted, the output image is the
		     same size as Im_in.
	QUINTIC:     Set this keyword to use smooth quintic interpolation.
		     Quintic interpolation is slower but the
		     derivatives are continuous across triangles,
		     giving a more pleasing result than the default
		     linear interpolation. 
	EXTRAPOLATE: Set to true to extrapolate outside the convex
		     hull of the tie points. Setting this keyword implies
		     the use of QUINTIC interpolation.
	TPS: 	     Set this keyword to use Thin Plate Spline
		     interpolation.  See GRID_TPS for a description of
		     this method, which generally gives good results.

 OUTPUTS:
	This function returns an image array with the specified
	geometric correction applied. Points at locations (Xi, Yi)
	are shifted to (Xo, Yo).

 PROCEDURE:
	The irregular grid defined by (Xo, Yo) is triangulated
	using TRIANGULATE. Then the surfaces defined by (Xo, Yo, Xi)
	and (Xo, Yo, Yi) are interpolated using TRIGRID to get
	the locations in the input image of each pixel in the output
	image. Finally, INTERPOLATE is called to obtain the result.
	Linear interpolation is used by default.  Smooth quintic
	interpolation is used if the QUINTIC keyword is set.  If TPS
	is set, Thin Plate Spline interpolation via GRID_TPS is used.

 MODIFICATION HISTORY:
	DMS, Jan, 1992.
	DMS, Jul, 1992, added quintic interpolation.


WF_DRAW $RSI/wf_draw.pro
[Previous] [Next]
 NAME:
	WF_DRAW

 PURPOSE:
	This procedure draws weather fronts of various types with
	spline smoothing.

 CATEGORY:
	Meterology.

 CALLING SEQUENCE:
	WF_DRAW, X, Y

 INPUTS:
  	X, Y:        Vectors of abcissae and ordinates defining the
		     front to be drawn.

 KEYWORD PARAMETERS:
  	COLD:	     A cold front. The default is a plain line with
		     no annotations.
  	WARM:	     A warm front.
  	OCCLUDED:    An occluded front.
  	STATIONARY:  A stationary front.
  	CONVERGENCE: A convergence line.
  	FRONT_TYPE:  Index of type of front to draw, COLD=1, WARM=2, etc.
		     Not required if plain line is desired or if an
		     explicit front type keyword is specified.
  	THICK:	     Line thickness. The default = 1.0.
  	INTERVAL:    The spline interpolation interval, in normalized
		     units. The default = 0.01. Larger values give coarser
		     approximations to curves, smaller values make more
		     interpolted points.
  	COLOR:       The color to use. The default = !P.COLOR.
  	DEVICE:      If set, X and Y are in device coordinates.
  	DATA:        If set, X and Y are in data coordinates.
  	NORM:	     If set, X and Y are in normalized coordinates.
		     This is the default.
  	PSYM:	     If set, draw a marker (index = PSYM) on each actual
		     [X, Y] data point.
  	SYM_LEN:     The length and spacing factor for front symbols,
		     in normalized units. The default = 0.15.
  	SYM_HT:      The height of front symbols, in normalized units.
		     The default = 0.02.

 OUTPUTS:
	No explicit outputs.

 CALLS: ***
	SPLINE, SPLINE_INTERP
 SIDE EFFECTS:
	Draws objects on current graphics device.

 PROCEDURE:
	Uses parametric spline interpolation to smooth the lines.
	POLYFILL is used to make the annotations on the front lines.

 EXAMPLE:
	Draw a front given 3 points:
	  WF_DRAW, [40, 20, 40], [30, 40, 25], /DATA, /COLD

 MODIFICATION HISTORY:
	DMS, RSI.   August, 1993.  Written.


WIDGET_TREE_MOVE $RSI/widget_tree_move.pro
[Previous] [Next]
 NAME:
   WIDGET_TREE_MOVE

 PURPOSE:
   Moves or copies tree widget nodes from one tree to another.  The
   source and destination trees can be the same tree.

 CALLING SEQUENCE:
   WIDGET_TREE_MOVE, wMoveNodes, wDestFolder [, INDEX = index]
     [, /COPY] [, /SELECT] [, UPDATE = value]
     [, CALLBACK_FUNC = name] [, USERDATA = value]

 POSITIONAL PARAMETERS:
   wMoveNodes: The set of nodes to move or copy.
   wDestFolder: Folder (or root) to move (or copy) the wMoveNodes.

 KEYWORD PARAMETERS:
   INDEX:    The relative position at which to insert wMoveNodes
             into the wDestFolder.  The position is zero-based and
             a value of -1 inserts at the tail.  This is the default.
   COPY:     Set this keyword to make a copy of wMoveNodes.  If
             not set then the original wMoveNodes will be destroyed.
   SELECT:   Set this keyword to select the newly moved/copied nodes.
   UPDATE:   Set this keyword to allow the trees to be visually
             updated during the operation.  The default is to turn
             updates off to prevent flickering.
   CALLBACK_FUNC: Specifies the name of a function that provides
             custom node duplication.  It is called by WIDGET_TREE_MOVE's
             internal recursive copy routine immediately after each
             node duplication for the full "wMoveNodes" hierarchies.
             If the callback returns a non-zero value then current
             node's children are also copied.
   USERDATA: Provides a value to the callback.

 DESCRIPTION:
   The WIDGET_TREE_MOVE procedure provides a convenient way to copy
   and move nodes between or within trees.

   The two parameters specifiy the widget IDs of the nodes to copy
   and the folder (or root) in which to move (or copy) them.  If the
   "wMoveNodes" contains nodes whose ancestors are also in the list,
   then those nodes will be copied more than once.  This situation can
   be avoided by using the TREE_DRAG_SELECT keyword to WIDGET_INFO,
   which removes "duplicate" nodes from a tree's current selection.

   The INDEX keyword can be used to insert the moved nodes into a
   particular position within the destination folder.  This keyword
   behaves the same as WIDGET_TREE's INDEX keyword.  The default is
   to insert the moved nodes at the end of the current list of children.

   The COPY keyword prevents deletion of the nodes specified in
   wMoveNodes.

   The SELECT keyword can be used to specify that the moved nodes
   should be selected.  If this keyword is not set then the source
   and destination trees' selection states are not altered (except a
   move operation can deslect nodes by virtue of node destruction).

   The UPDATE keyword can be used to intentionally allow tree widget
   updates during the move/copy.  If this keyword is not set, then
   the default is to turn updates off to prevent flickering.

   The CALLBACK_FUNC keyword allows for customized node duplication.
   This is possible because the internal node duplication procedure
   invokes the callback immediately after each source node is duplicated.
   The callback must be defined as follows:

     FUNCTION Name, wOriginalNode, wNewNode, USERDATA = value

   If user data was supplied to WIDGET_TREE_MOVE, then it will be
   passed to the callback.  Before the callback is invoked, the new
   node is created with all of the commonly used widget properties of
   the original node.  The callback can be used to change these
   values (e.g. UVALUE that references a significant amount of memory).
   The callback's return value indicates whether or not copying should
   continue for the current node.  A non-zero value means "continue"
   and a value of zero means "stop".  Always returning zero produces a
   "flat copy", with no recursive traversal to children.

   The following properites are automatically inherited by new nodes:

     FOLDER, EXPANDED
     BITMAP, MASK
     DRAGGABLE, DRAG_NOTIFY, DROP_EVENTS
     VALUE, UVALUE, UNAME
     EVENT_FUNC, EVENT_PRO

   The NO_COPY keyword is set when moving, but not when copying.  This
   allows for an efficient transfer of large data during a move.  The
   following tree widget properties are not transfered:

     FUNC_GET_VALUE, PRO_SET_VALUE
     NOTIFY_REALIZE, KILL_NOTIFY

   If these keywords must be set then the new node should be destroyed
   and recreated in the callback (with the same parent and index).
   An alternative is to write a fully custom version of WIDGET_TREE_MOVE.

 CALLS: ***
	REVERSE, WIDGET_TREE_COPY_TREE, WIDGET_TREE_DUPLICATE_NODE
	WIDGET_TREE_SET_UPDATING
 MODIFICATION HISTORY:
   Written by:  DRE, RSI, November 2005
   Modified:


WRITE_BMP $RSI/write_bmp.pro
[Previous] [Next]
 NAME:
	WRITE_BMP

 PURPOSE:
   	This procedure writes a Microsoft Windows Version 3 device
	independent bitmap file (.BMP).

 CATEGORY:
   	Input/Output.

 CALLING SEQUENCE:
   	WRITE_BMP, File, Image [, R, G, B]

 INPUTS:
   	File:	   The full path name of the bitmap file to write.
   	Image:	   The array to write into the new bitmap file. The array
	 	   should be scaled into a range of bytes for 8 and 24
		   bit deep images. Scale to 0-15 for 4 bit deep images.
       	   If the image has 3 dimensions and the first dimension
		   is 3, a 24 bit deep bitmap file is created.
		   NOTE: for 24 bit images, color interleaving is blue,
		   green, red: image[0,i,j] = blue, image[1,i,j] = green, etc.

 OPTIONAL INPUTS:
   	R, G, B:   Color tables. If omitted, the colors loaded in the
		   COLORS common block are used.

 KEYWORD PARAMETERS:
   	FOUR_BITS: Set this keyword to write as a four bit device
	  	   independent bitmap. If omitted or zero, an eight bit
		   deep map is written.
   	IHDR:	   { BITMAPINFOHEADER } structure containing the file header
       	   fields that are not obtained from the image parameter.
       	   (The only fields that the user can set are:
		   bi{XY}PelsPerMeter, biClrUsed, and biClrImportant.)
	RGB:	   If this keyword is supplied, color interleaving will be
                  reversed: image[0,i,j] = red, image[1,i,j] = green, etc.

 OUTPUTS:
   	No explicit outputs.

 KEYWORD OUTPUT PARAMETERS:
   	HEADER_DEFNIE: Returns an empty BITMAPINFOHEADER structure,
		       containing zeroes. No other actions are performed.
		       This structure may be then modified with the
		       pertinent fields and then passed in via the Ihdr
       	       keyword parameter. See the Microsoft Windows
		       Programmers Reference Guide for a description of
		       each field in the structure. NOTE: this parameter
		       must be defined before the call.  e.g.:
           		h = 0
           		WRITE_BMP, HEADER_DEFINE = h

 CALLS: ***
	LOADCT, SWAP_ENDIAN
 CALLED BY:
	WRITE_IMAGE
 COMMON BLOCKS:
   	COLORS:    Used with 4- and 8-bit images if no colors are specified.

 SIDE EFFECTS:
   	IO is performed.

 RESTRICTIONS:
   	Does not handle 1-bit images or compressed images.
   	Is not fast for 4-bit images. Works best on images where the
   	number of bytes in each scan line is evenly divisible by 4.

 PROCEDURE:
   	Straightforward. Will work on both big endian and little endian
	machines.

 EXAMPLES:
       Pseudo screen dump from the current window:
         WRITE_BMP, 'test.bmp', TVRD()

       Scale an image to 0-15, and then write a four bit BMP file,
       using a gray scale color table:
         r = BYTSCL(INDGEN(16))   ;Ramp from 0 to 255.
         WRITE_BMP, 'test.bmp', BYTSCL(Image, MAX=15), r, r, r, /FOUR

 MODIFICATION HISTORY:
   DMS, RSI.   March 1993.	Original version.
   DMS, RSI.   May, 1993.	Now works on all machines...
   CT, RSI, Aug 2003: Fix bug in error code if unable to open file.


WRITE_GIF $RSI/write_gif.pro
[Previous] [Next]
 NAME:
	WRITE_GIF

 PURPOSE:
	Write an IDL image and color table vectors to a
	GIF (graphics interchange format) file.

 CATEGORY:

 CALLING SEQUENCE:

	WRITE_GIF, File, Image  ;Write a given array.

	WRITE_GIF, File, Image, R, G, B  ;Write array with given color tables.


 INPUTS:
	Image:	The 2D array to be output.

 OPTIONAL INPUT PARAMETERS:
      R, G, B:	The Red, Green, and Blue color vectors to be written
		with Image.
 Keyword Inputs:
	CLOSE = if set, closes any open file if the MULTIPLE images
		per file mode was used.  If this keyword is present,
		nothing is written, and all other parameters are ignored.
	MULTIPLE = if set, write files containing multiple images per
		file.  Each call to WRITE_GIF writes the next image,
		with the file remaining open between calls.  The File
		parameter is ignored, but must be supplied,
		after the first call.  When writing
		the 2nd and subsequent images, R, G, and B are ignored.
		All images written to a file must be the same size.


 OUTPUTS:
	If R, G, B values are not provided, the last color table
	established using LOADCT is saved. The table is padded to
	256 entries. If LOADCT has never been called, we call it with
	the gray scale entry.


 CALLS: ***
	LOADCT
 CALLED BY:
	WRITE_IMAGE
 COMMON BLOCKS:
	COLORS

 SIDE EFFECTS:
	If R, G, and B aren't supplied and LOADCT hasn't been called yet,
	this routine uses LOADCT to load the B/W tables.

 COMMON BLOCKS:
	WRITE_GIF_COMMON.
 RESTRICTIONS:
	This routine only writes 8-bit deep GIF files of the standard
	type: (non-interlaced, global colormap, 1 image, no local colormap)

	The Graphics Interchange Format(c) is the Copyright property
	of CompuServ Incorporated.  GIF(sm) is a Service Mark property of
	CompuServ Incorporated.

 MODIFICATION HISTORY:
	Written 9 June 1992, JWG.
	Added MULTIPLE and CLOSE, Aug, 1996.


WRITE_IMAGE $RSI/write_image.pro
[Previous] [Next]
 NAME:
	WRITE_IMAGE

 PURPOSE:
       The WRITE_IMAGE procedure writes an image and its color table
       vectors, if any, to a file of a specified type. WRITE_IMAGE
       can write most types of image files supported by IDL.  See
       QUERY_IMAGE for a list of supported formats.

 CATEGORY:
       Input/Output

 CALLING SEQUENCE:
       WRITE_IMAGE, Filename, Format, Data [, Red, Green, Blue])

 INPUTS:
	Filename: A scalar string containing the name of the file to write.

       Format: A scalar string containing the name of the file format to
       write.  See QUERY_IMAGE for a list of supported formats.

       Data: An IDL variable containing the image data to write to the file.

       Red: A vector containing the red channel of the color table
            if a colortable exists.

       Green: A vector containing the green channel of the color table
            if a colortable exists.

       Blue: A vector containing the blue channel of the color table
            if a colortable exists.


 OPTIONAL KEYWORDS:

       APPEND - Set this keyword to force the image to be appended to
       the file instead of overwriting the file.  APPEND may be used
       with image formats which support multiple images per file, and
       is ignored for formats which support only a single image per file.

 CALLS: ***
	WRITE_BMP, WRITE_GIF, WRITE_JPEG2000, WRITE_PPM, WRITE_SRF
 CALLED BY:
	DIALOG_WRITE_IMAGE, IDLexViewGroup
 EXAMPLE:
       WRITE_IMAGE, 'myImage.png', 'PNG', data, r, g, b

 MODIFICATION HISTORY:
 	Written by:	Scott Lasica, July, 1998
   CT, RSI, April 2004: Added JPEG2000 support.


WRITE_JPEG2000 $RSI/write_jpeg2000.pro
[Previous] [Next]
 NAME:
  WRITE_JPEG2000

 PURPOSE:
   This procedure writes a JPEG2000 image.

 CATEGORY:
   Input/Output

 CALLING SEQUENCE:
   WRITE_JPEG2000, File, Image

 INPUTS:
   File: The full path name of the file to write.

   Image: The two or three-dimensional array to write.

   Red, Green, Blue: For single-channel images, these should contain
       the red, green, and blue color vectors, respectively.
       For multi-channel images, these arguments are ignored.

 OUTPUTS:
   None.

 KEYWORDS:
   N_LAYERS: Set this keyword to a positive integer specifying
       the number of quality layers. The default is one.

   N_LEVELS: Set this keyword to an integer specifying the number of
       wavelet decomposition levels, or stages, in the range 0...15.
       The default value is 5. When writing a JP2 file, if
       a Red, Green, Blue palette is provided then the default
       is N_LEVELS=0.

   ORDER: Set this keyword to a nonzero value to store images in
       the Result from top to bottom. By default, images are stored
       in the Result from bottom to top.

   REVERSIBLE: Set this keyword to 0 or 1 indicating the type of
       compression to use. A non-zero value indicates that reversible
       compression should be used. The default is to use irreversible
       compression. When writing a JP2 file, if a Red, Green, Blue
       palette is provided then the default is REVERSIBLE=1.

 CALLED BY:
	WRITE_IMAGE
 MODIFICATION HISTORY:
   Written: CT, RSI, March 2004.


WRITE_NRIF $RSI/write_nrif.pro
[Previous] [Next]
 NAME:
	WRITE_NRIF

 PURPOSE:
	Write an IDL image and color table vectors to an
	NCAR Raster Interchange Format (NRIF) rasterfile.

 CATEGORY:
	Input/Output.

 CALLING SEQUENCE:
	WRITE_NRIF, File, Image, [R, G, B]

 INPUTS:
	File:	A string containing the name of the rasterfile to write.

	Image:	The byte array to be output.  If Image is dimensioned [n,m] an
		8-bit NCAR Raster File with color tables is output.  If Image 
		is dimensioned [3,n,m], a 24-bit NCAR Raster File is output, 
		where each byte triple represents the red, green, and blue 
		intensities at [n,m] on a scale from 0 to 255.  In either 
		case, IMAGE must be a byte array.  The NRIF image will be 
		rendered from bottom to top, in accordance with IDL standards,
		so the !ORDER variable should not be changed from its default 
		value of zero.

 OPTIONAL INPUT PARAMETERS:
      R, G, B:	The Red, Green, and Blue color vectors to be used as a color
		table with 8-bit images.  If color vectors are supplied, they
		are included in the output (8-bit images only).  If color 
		vectors are not supplied, the color vectors established by 
		LOADCT or PALETTE are included in the output.  If LOADCT or 
		PALETTE have not yet been used to define color vectors, 
		"LOADCT, 0" is called to load the standard grayscale color
		table.

		This routine does not recognize color vectors loaded directly 
		using TVLCT, so if a custom color table is desired and it is 
		not convenient to use PALETTE, include the R, G, and B vectors
		that were used to create the color table.

 OUTPUTS:
	No explicit outputs.  The specified File will contain header 
	information, color vectors (8-bit images only), and the image, in
	NCAR Raster Interchange Format (NRIF).

 CALLS: ***
	LOADCT, SWAP_ENDIAN
 COMMON BLOCKS:
	COLORS:  The IDL color table common block.

 SIDE EFFECTS:
	If R, G, and B aren't supplied and color tables haven't been previously
	established by LOADCT or PALETTE, this routine calls "LOADCT, 0" to 
	load the standard gray scale color table.

 RESTRICTIONS:
	This routine only writes 8 or 24-bit deep rasterfiles of types
	"Indexed Color" (for 8-bit) and "Direct Color integrated" for 24-bit.
	The color map is included only for 8-bit files.

 FURTHER INFORMATION:
	See the document "NCAR Raster Interchange Format and TAGS Raster
	Reference Manual", available from the Scientific Computing Division,
	National Center for Atmospheric Research, Boulder, CO, 80307-3000,
	for the structure of NCAR Raster Interchange Format (NRIF) files.

 MODIFICATION HISTORY:
	Written February, 1991 by Stan Solomon, LASP, University of Colorado.
	(Adapted from the WRITE_SRF procedure.)


WRITE_PICT $RSI/write_pict.pro
[Previous] [Next]
 NAME:         WRITE_PICT
 PURPOSE:      Writes image files with the current color palette in the PICT
               Version 2 Format.  This format is used by Apple Macintosh 
               Computers.
 CATEGORY:     
 CALLING SEQUENCE:
       WRITE_PICT, FILE                ;Writes contents of current window
       WRITE_PICT, FILE, IMAGE         ;Writes given array
       WRITE_PICT, FILE, IMAGE, R, G, B  ;Writes array w/given color table
 INPUTS:
       FILE = Scalar string giving the name of the PICT file to write.
       IMAGE = 2D matrix to be output.  If IMAGE is omitted,
         the entire current window is read into an array and written
         to the PICT file.
 OPTIONAL INPUT PARAMETERS:
       R, G, B = The Red, Green, and Blue color vectors to be written
               with IMAGE.  If not specified, the current color table is used
 OUTPUTS:
       FILE contains the image in a PICT version 2 file format.  If color
       vectors were supplied, they are used. Otherwise, the last color tables
       established by LOADCT are used (If LOADCT hasn't been used
       to establish color tables yet it is used to load the B/W tables.).
 CALLS: ***
	PACKDATA, WRITE_PICT_ITEM
 SIDE EFFECTS:
       If R, G, and B aren't supplied and LOADCT hasn't been called yet,
       this routine uses LOADCT to load the B/W tables.
 RESTRICTIONS:
       Only creates Version 2 PICT files.  Only works with 8-bit displays
 PROCEDURE:
       Write out the header, size, and the following quickdraw opcodes:
               Version, HeaderOp, DefHilite, Clip, and PackBitsRect
       Then pack the image data using the QUICKDRAW PackBits
       run length encoding algorithm.
       Packing method:
               Each line is preceeded by a byte if the image width
               is less than 250 or a integer otherwise.  This prefix
               tells how many bytes are in the packed line to follow.
               The line following this length descriptor is made up of
               a series of runs and data as follows:
       - Runs
               If there is a run, the high bit of the first byte is 
               set and the other seven bits tell how many elements are
               in the run.  The next byte is then the value of the run.
               Runs can only be 128 bytes in length so longer runs are
               broken up into smaller runs if they exceed 128 bytes.
               The smallest run is three bytes.
       - Data
               If there are a series of image values that differ at least
               every two bytes, they are written out after a byte that
               describes how many dissimilar data bytes are to follow.
               As with runs, the length of a run of data can not be 
               longer than 128 without setting the high bit of the
               length descriptor so long strings of data are broken up
               into chunks 128 bytes or smaller.
 MODIFICATION HISTORY:
       Written 16 November 1990, Steve Richards.
       SMR, Aug 25, '92        Rewrote the packing routine and fixed bugs.
       JIY, Mar 30, '92        added fix to work on Ultrix and VMS.
       SMR, Oct 12, '93        Added changes suggested by Joe Gurman that
                               prevented the clobbering of color vectors on
                               exit from the routine.
       SMR, Jan 12, '94        Added a case for OSF byte ordering, suggested
                               by Joe Gurman.
       DMS, Jun 24, 1994       Fixed byte ordering logic.
                               Added code to clip image to # of colors-1


WRITE_PPM $RSI/write_ppm.pro
[Previous] [Next]
 NAME:
	WRITE_PPM

 PURPOSE:
	Write an image to a PPM (true-color) or PGM (gray scale) file.
	PPM/PGM format is supported by the PMBPLUS and Netpbm packages.

	PBMPLUS is a toolkit for converting various image formats to and from
	portable formats, and therefore to and from each other.

 CATEGORY:
	Input/Output.

 CALLING SEQUENCE:

	WRITE_PPM, File, Image  ;Write a given array.

 INPUTS:
	Image:	The 2D (gray scale) or 3D (true-color) array to be output.

 KEYWORD PARAMETERS:
	ASCII = if set, formatted ASCII IO is used to write the image data.
		If omitted, or set to zero, the far more efficient
		binary IO (RAWBITS) format is used to write the image data.

 CALLED BY:
	WRITE_IMAGE
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	A file is written.

 RESTRICTIONS:
	This routine only writes 8-bit deep PGM/PPM files of the standard
	type.
	Images should be ordered so that the first row is the top row.
	If your image is not, use WRITE_PPM, File, REVERSE(Image, 2)

 MODIFICATION HISTORY:
	Written Nov, 1994, DMS.
   CT, RSI, August 2000: Change PRINTF to WRITEU,
            change output to match PPM spec, add "Created by..." comment.


WRITE_SPR $RSI/write_spr.pro
[Previous] [Next]
 NAME:
       WRITE_SPR

 PURPOSE:
       This procedure writes a row-indexed sparse matrix stucture to a 
	specified file.  A  row-indexed sparse matrix is created by the
	Numerical Recipes routine SPRSIN.

 CATEGORY:
       Sparse Matrix File I/O 

 CALLING SEQUENCE:
       WRITE_SPR, AS, 'Filename' 

 INPUTS:
       AS:  row indexed sparse matrix created by SPRSIN
	Filename:  Name of file to contain AS.

 KEYWORDS:
	NONE

 OUTPUTS:
	NONE

 EXAMPLE:
	a = [[3.,0., 1., 0., 0.],$
	     [0.,4., 0., 0., 0.],$
     	     [0.,7., 5., 9., 0.],$
     	     [0.,0., 0., 0., 2.],$
     	     [0.,0., 0., 6., 5.]]

	as = SPRSIN(a)

	WRITE_SPR, as, 'sprs.as'

 MODIFICATION HISTORY:
       Written by:     BMH, 1/94.
       Modified:       GGS, RSI, July 1996
                       Changed NR_SPRSIN to SPRSIN.


WRITE_SRF $RSI/write_srf.pro
[Previous] [Next]
 NAME:
	WRITE_SRF

 PURPOSE:
	Write an IDL image and color table vectors to a
	Sun rasterfile.

 CATEGORY:

 CALLING SEQUENCE:
	WRITE_SRF, File		;Write contents of current window.

	WRITE_SRF, File, Image  ;Write a given array.

	WRITE_SRF, File, Image, R, G, B  ;Write array with given color tables.

 INPUTS:
	File:	Scalar string giving the name of the rasterfile to write.

	Image:	The 2D array to be output.  If Image is dimensioned (3,n,m),
		a 24-bit Sun Raster File is written.  If Image is omitted,
		the entire current window is read into an array and written
		to the SRF file.  IMAGE should be of byte type, and in top
		to bottom scan line order.

 OPTIONAL INPUT PARAMETERS:
      R, G, B:	The Red, Green, and Blue color vectors to be written
		with Image.

 KEYWORD PARAMETERS:
	ORDER:	If specified, the image is written from the top down instead
		of bottom up.  This only has effect
		when writing a file from the current IDL window instead of
		an image passed as a parameter.

     WRITE_32:	If the input image is a true color image, dimensioned (3,n,m),
		it is normally written as a 24-bit raster file.  Set this
		keyword to write the result as a 32-bit file.

 OUTPUTS:
	FILE contains the image in rasterfile format. If color vectors
	were supplied, they are used. Otherwise, the last color tables
	established by LOADCT are used (If LOADCT hasn't been used
	to establish color tables yet it is used to load the B/W tables.).

	See the file /usr/include/rasterfile.h for the structure of
	Sun rasterfiles.

 CALLS: ***
	LOADCT
 CALLED BY:
	WRITE_IMAGE
 COMMON BLOCKS:
	COLORS

 SIDE EFFECTS:
	If R, G, and B aren't supplied and LOADCT hasn't been called yet,
	this routine uses LOADCT to load the B/W tables.

 RESTRICTIONS:
	This routine only writes 32, 24, & 8-bit deep rasterfiles of
	type RT_STANDARD.  Use the Unix command rasfilter8to1(1) to convert
	these files to 1-bit deep files.

 MODIFICATION HISTORY:
	Written 26 June 1988, AB.

	Added 24 bit color, March 1990, DMS.

	Added 32 bit color, July, 1990, DMS.

	Changed to use CURRENT, rather than ORIGINAL colortables, if
	the color parameter is not provided.  Made sure
	that colortables were written as bytes.  April, 1991.

	Fixed bug that misordered the colors when writing a 24 bit
	image.  Jan, 1992.

	Fixed bug that had the colors for 24 bit images misordered.
	The colors were being written as RGB, bug for a standard
	type of SRF the colors should be in BGR order. This is as
	per the Ency. of Graphic file formats. Also verfied
	this with other SRF reading programs. May 7th,1996 kdb.

	Fixed bug that occurred when byte padding was performed on
	an odd columned image. The values in the file header didn't
	reflect this addition of one column to the file. May 7th, 1996 kdb.


WRITE_SYLK $RSI/write_sylk.pro
[Previous] [Next]
 NAME:
   WRITE_SYLK

 PURPOSE:
   Writes the contents of an IDL variable to a sylk (Symbolic Link) format 
   spreadsheet data file. 

 CATEGORY:
   Input/Output.

 CALLING SEQUENCE:
   fStatus = WRITE_SYLK(OutFile, SourceData [, STARTROW, STARTCOL])

 INPUT:
   OutFile: Scalar string with the name of the sylk file to write.
   SourceData: A scalar, a vector, or a 2D array to be written to file.

 OUTPUT:
   fStatus: Boolean flag.  Returns TRUE if function was successful. 

 OPTIONAL INPUT PARAMETERS:
   STARTROW: The starting (0-based) row of spreadsheet cells to which the 
       routine will write the data.  If not specified, this value defaults 
       to row 0. 
   STARTCOL: The starting (0-based) column of spreadsheet cells to which the
       routine will write the data.  If not specified, this value defaults 
       to column 0.

 CALLS: ***
	WRITESYLKCELL
 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   This routine *only* writes numerical and string sylk data.  It connot
   handle spreadsheet and cell formatting information such as cell width, text
   justification, font type, date, time, and monetary notations, etc.  A 
   particular sylk data file cannot be appended with data blocks through 
   subsequent calls.

 EXAMPLES:
   Assume you wished to write the contents of a 2x2 array of floats, 
   arrfltData, to a sylk data file called "bar.slk" such that, when read into 
   a spreadsheet, the matrix would appear with it's upper left data at the 
   cell in the 10th row and the 20th column.  The following call would 
   accomplish this task:
   
       fStatus = WRITE_SYLK("bar.slk", arrflData, STARTROW = 9, STARTCOL = 19)


 MODIFICATION HISTORY:
   Written October 1994, AJH
   Modified;
   	    Feb. 1998, SVP : Added FATAL_MESSAGE and FATAL_Cleanup so that a catchable error
                            is produced.


WRITE_WAV $RSI/write_wav.pro
[Previous] [Next]
 NAME:
	WRITE_WAV

 PURPOSE:
 	This function writes a Microsoft Windows .WAV (RIFF) file

 CATEGORY:
   	Input/Output

 CALLING SEQUENCE:
   	WRITE_WAV, File, data, rate

 INPUTS:
 	File: The full path name of the file to write.
	Data: Input data channels to be written (1 or 2D array,
		 leading dimension is the number of channels).  Note:
		 if not in BYTE or INT format, output data will be
		 written in INT format.
	Rate: Sampling rate (samples per second).

 OUTPUTS:
	None

 OPTIONAL OUTPUTS:
	None

 KEYWORDS:
	None

 CALLS: ***
	SWAP_ENDIAN
 SIDE EFFECTS:
   	IO is performed.

 RESTRICTIONS:
	Only the PCM (uncompressed) data only format is supported.

 PROCEDURE:
   	Straightforward. Will work on both big endian and little endian
	machines.

 EXAMPLE:

 MODIFICATION HISTORY:
   RJF, RSI.   Sep, 1998. Original version.
   CT, RSI, Aug 2003: Fix bug in error code if unable to open file.


WRITE_WAVE $RSI/write_wave.pro
[Previous] [Next]
 NAME:
	WRITE_WAVE

 PURPOSE:
	Write a three dimensional IDL array to a .wave or .bwave file
	for use with the Wavefront Visualizer.

 CALLING SEQUENCE:
	WRITE_WAVE, File, Array

 INPUTS:
	File: 	   Scalar string giving the name of the Wavefront file to write.
	Array:	   3D matrix to be output.

 KEYWORD PARAMETERS:
	BIN:       If the BIN keyword is set, the file will be written in
		   Binary mode, otherwise, it is written as a text file.
	DATANAME:  The name of the data inside of the Wavefront file.  If
		   not specified, the name used is "idldata".
	MESHNAME:  The name of the mesh used in the Wavefront file.  When
		   not specified, the name used is "idlmesh".
	NOMESHDEF: When set, no mesh definition is included.
	VECTOR:    When set, the variable being written is written as a 
		   vector

 OUTPUTS:
	FILE contains the array in Wavefront file format. If DATANAME
	was supplied, the scalar data field in the Wavefront file is given
	that name. 

 RESTRICTIONS:
	This routine only writes one scalar field for each Wavefront file
	that it creates.

 MODIFICATION HISTORY:
	Written July 3, 1991, by Steve Richards.


WV_CWT $RSI/wavelet/source/wv_cwt.pro
[Previous] [Next]
 NAME:
    WV_CWT

 PURPOSE
    This function computes the continuous wavelet transform
    for one-dimensional arrays.

 CALLING SEQUENCE
    Result = WV_CWT( Array, Family, Order)

 INPUTS
   Array = A one-dimensional array of data, either real or complex.

   Family = A string giving the name of the wavelet function to use.

   Order = A scalar specifying the order or parameter
           for the wavelet function.


 OUTPUTS
    Result = A two-dimensional array containing the wavelet transform.
             If Family is symmetric in Fourier space then Result will
             be real (e.g. the 'Gaussian' family). If Family is not
             symmetric then Result will be complex (e.g. 'Morlet' or 'Paul').

 KEYWORD PARAMETERS
   DOUBLE = Set this keyword to force the computation to be done in
        double precision arithmetic.

   DSCALE = Set this keyword to a scalar value giving the spacing
        between scale values, in logarithmic units. The default is 0.25,
        which gives four subscales within each major scale.

   NSCALE = Set this keyword to a scalar value giving the total number
        of scale values to use for the wavelet transform.
        The default is [log 2 (N/START_SCALE)]/DSCALE+1.

   PAD = Set this keyword to force Array to be padded with zeroes before
        computing the transform. Enough zeroes are added to make the
        total length of Array equal to the next-higher power-of-two
        greater than 2N. Padding with zeroes prevents wraparound
        of the Array and speeds up the fast Fourier transform.

      Note - Padding with zeroes reduces, but does not eliminate,
        edge effects caused by the discontinuities at the start
        and end of the data.

   SCALE = Set this keyword to a named variable in which to return
        the scale values used for the continuous wavelet transform.
        The SCALE values range from START_SCALE up to
        START_SCALE*2^[(NSCALE-1)*DSCALE].

   START_SCALE = Set this keyword to a scalar value giving the
        starting scale, in non-dimensional units.
        The default is 2, which gives a starting scale that is
        twice the spacing between Array elements.

 REFERENCE
    Torrence, C. and G.P. Compo, 1998: A practical guide to wavelet analysis.
        Bull. Amer. Meteor. Soc., v. 79, pp. 61-78.

 EXAMPLE
   Morlet wavelet transform using convolution:
      n = 1024
      time = FINDGEN(n)
      data = RANDOMN(seed, n)   ; choose a random time series length n

   Find wavelet transform for Morlet order=6:
      cwt = WV_CWT(data, 'Morlet', 6, SCALE=scale)

   Color contour plot:
      LOADCT, 39
      CONTOUR, cwt, time, scale, /YLOG, /FILL, XSTYLE=1, YSTYLE=1, $
          XTITLE='Time', YTITLE='Scale'

 MODIFICATION HISTORY
    Written by: Chris Torrence, 2000
    CT, RSI, Sept 2001: Complex input was being converted to real.
                        Now uses both real & imaginary parts.

 CALLS: ***
	ALOG2


WV_DENOISE $RSI/wavelet/source/wv_denoise.pro
[Previous] [Next]
 NAME:
    WV_DENOISE

 PURPOSE:

    This function uses the wavelet transform to filter (or de-noise)
    a one or two-dimensional array.

 CALLING SEQUENCE:

    Result = WV_DENOISE( Array [, Family, Order])

 INPUTS:

   Array: A one- or two-dimensional array of data to be analyzed.

      Note - If the dimensions of Array are not powers of two,
           then the Array will be embedded within a larger zero-filled array
           whose dimensions are powers of two. In this case the Result
           will have the same dimensions as the larger array.

   Family: A string specifying the name of the wavelet function
            to use. WV_DENOISE will construct the actual function name
            by removing all white space and attaching a prefix of 'WV_FN_'.
           Note: This must be a discrete wavelet, such as COIFLET,
               DAUBECHIES, HAAR, or SYMLET.

   Order: A scalar specifying the order number for the wavelet.

      Note - If you pass in DENOISE_STATE, then Family and Order
          may be omitted. In this case the values from DENOISE_STATE
          are used.

 KEYWORDS:

   COEFFICIENTS: Set this keyword to a scalar specifying the number of
           wavelet coefficients to retain in the filtered wavelet transform.
           This keyword is ignored if keyword PERCENT is present.

   CUTOFF: Set this keyword to a named variable that will contain the
           actual cutoff value of wavelet power that was used for the
           threshold.

   DENOISE_STATE: This is both an input and an output keyword.
           If this keyword is set to a named variable, then upon return,
           DENOISE_STATE will contain the following structure:

            Tag          Type        Definition
            FAMILY        String     Name of wavelet function
            ORDER         Double     Order number for the wavelet
            DWT           FLT/DBLARR Discrete wavelet transform of Array
            WPS           FLT/DBLARR Wavelet power spectrum = |DWT|^2
            SORTED        FLT/DBLARR Percent-normalized WPS, sorted
            CUMULATIVE    FLT/DBLARR Cumulative sum of SORTED
            COEFFICIENTS  LONG       Number of coefficients retained
            PERCENT       Double     Percent of coefficients retained

            Upon input, if DENOISE_STATE is set to a structure with the
            above form, then the DWT, WPS, SORTED, and CUMULATIVE variables
            are not recomputed. This is useful if you want to make multiple
            calls to WV_DENOISE using the same Array.

        Note - No error checking is made on the input values. The values
            should not be modified between calls to DENOISE_STATE.

   DOUBLE: Set this keyword to force the computation to be done using
           double-precision arithmetic.

   DWT_FILTERED: Set this keyword to a named variable in which the
           the filtered discrete wavelet transform will be returned.

   PERCENT: Set this keyword to a scalar specifying the percentage of
           cumulative wavelet power to retain.

        Note - If neither COEFFICIENTS nor PERCENT is present then all
             of the coefficients are retained (i.e. no filtering is done).

   THRESHOLD: Set this keyword to a scalar specifying the type of threshold.
            Possible values are:
               0 = hard threshold (this is the default)
               1 = soft threshold

   WPS_FILTERED: Set this keyword to a named variable in which the
           filtered wavelet power spectrum will be returned.

 OUTPUTS:

    Result: A vector or array containing the filtered version of Array.

 REFERENCE:
    IDL Wavelet Toolkit Online Manual

 CALLS: ***
	MEAN, REVERSE, WV_DENOISE_DWT
 MODIFICATION HISTORY:
    Written by CT, August 2000.
    CT, May 2001: Fixed default if COEFFICIENTS or PERCENT not supplied.
    CT, Nov 2004: Add error message if incorrect wavelet supplied.


WV_FN_COIFLET $RSI/wavelet/source/wv_fn_coiflet.pro
[Previous] [Next]
 NAME:
    WV_FN_COIFLET

 PURPOSE:
    This function returns the Coiflet wavelet coefficients.

 CALLING SEQUENCE:
    info = WV_FN_COIFLET( Order, Scaling, Wavelet, Ioff, Joff)

 INPUTS:
    Order: This is the order number for the Coiflet wavelet.
           Order=1 is the "Daubechies Coiflet L=2" wavelet,
           and has 2 vanishing moments and 6 coefficients.

 OUTPUTS:
    Scaling: A vector of the scaling (father) coefficients

    Wavelet: A vector of the wavelet (mother) coefficients

    Ioff: The offset index used to center the Scaling support

    Joff: The offset index used to center the Wavelet support

 KEYWORD PARAMETERS:
    None.

 RETURN VALUE:
    Returns a structure with the following information:
          (this is an example for order=1)
       info = {family:'Coiflet', $    ; name of wavelet family
               order_name:'Order', $     ; term used for "order"
               order_range:[1,5,1], $    ; valid range [first,last,default]
               order:1, $                ; order number
               discrete:1, $             ; 0=continuous, 1=discrete
               orthogonal:1, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:2, $            ; 0=asymmetric, 1=sym., 2=near sym.
               support:5, $              ; support width
               moments:2, $              ; # of vanishing moments
               regularity:0.550}         ; # of continuous derivatives

 REFERENCE:
    Daubechies, I., 1992: Ten Lectures on Wavelets, SIAM, p. 261.
       Note that Daubechies has divided by Sqrt(2), and the coefficients
       are reversed.

    Actual coefficients from <http://www.isds.duke.edu/~brani/filters.html>

 CALLS: ***
	REVERSE, WV_FN_COIFLET_COEFF
 MODIFICATION HISTORY:
    Written by: Chris Torrence, 1999


WV_FN_DAUBECHIES $RSI/wavelet/source/wv_fn_daubechies.pro
[Previous] [Next]
 NAME:
    WV_FN_DAUBECHIES

 PURPOSE:
    This function returns the Daubechies wavelet coefficients.

 CALLING SEQUENCE:
    info = WV_FN_DAUBECHIES( Order, Scaling, Wavelet, Ioff, Joff)

 INPUTS:
    Order: This is the order number for the Daubechies wavelet.
           Order=2 is the "db2" wavelet, and has 2 vanishing moments
           and 4 coefficients.

 OUTPUTS:
    Scaling: A vector of the scaling (father) coefficients

    Wavelet: A vector of the wavelet (mother) coefficients

    Ioff: The offset index used to center the Scaling support

    Joff: The offset index used to center the Wavelet support

 KEYWORD PARAMETERS:
    None.

 RETURN VALUE:
    Returns a structure with the following information:
          (this is an example for order=2)
       info = {family:'Daubechies', $    ; name of wavelet family
               order_name:'Order', $     ; term used for "order"
               order_range:[2,24,2], $   ; valid range [first,last,default]
               order:2, $                ; order number
               discrete:1, $             ; 0=continuous, 1=discrete
               orthogonal:1, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:0, $            ; 0=asymmetric, 1=symmetric
               support:3, $              ; support width
               moments:2, $              ; # of vanishing moments
               regularity:0.550}         ; # of continuous derivatives

 REFERENCE:
    Daubechies, I., 1992: Ten Lectures on Wavelets, SIAM, p. 195.
       Daubechies has orders 2-10, although note that Daubechies
       has multiplied by Sqrt(2).

    Orders 11-24 are from <http://www.isds.duke.edu/~brani/filters.html>

 CALLS: ***
	REVERSE, WV_FN_DAUBECHIES_COEFF
 MODIFICATION HISTORY:
    Written by: Chris Torrence, 1999


WV_FN_GAUSSIAN $RSI/wavelet/source/wv_fn_gaussian.pro
[Previous] [Next]
 NAME:
    WV_FN_GAUSSIAN

 PURPOSE
    This function returns the Gaussian-derivative wavelet.

 CALLING SEQUENCE
    Info = WV_FN_GAUSSIAN( [Parameter] [, Scale, N]
          [, /DOUBLE] [, /SPATIAL]
          [, WAVELET=Wavelet] )

 INPUTS
    Parameter
        A scalar integer specifying the nondimensional frequency parameter
        for the Gaussian-derivative wavelet. The default is 2 (also known
        as the Marr or Mexican Hat wavelet).

    Scale
        A scalar specifying the normalized wavelet scale of the resulting
        wavelet function.

    N = A scalar specifying either the number of points in the data set
        (for Fourier frequencies) or the width of the wavelet function
        (if /SPATIAL is set).

    Note - if keyword WAVELET is missing then Scale and N are ignored
           and only Info is returned.

 RETURN VALUE:
    Returns a structure with the following information:
          (this is an example for Parameter=6)
       Info = {family:'Gaussian', $    ; name of wavelet family
               order_name:'Derivative', $     ; term used for "order"
               order_range:[1,6,2], $   ; valid range [first,last,default]
               order:2, $                ; order number
               discrete:0, $             ; 0=continuous, 1=discrete
               orthogonal:0, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:1, $            ; 0=asymmetric, 1=symmetric
               support:-1, $              ; support width
               moments:-1, $              ; # of vanishing moments
               regularity:-1}         ; # of continuous derivatives

 KEYWORD PARAMETERS
    DOUBLE = Set this keyword to force the computation to be done in
        double precision arithmetic.

    WAVELET = Upon return, this keyword will contain a vector of wavelet
        coefficients evaluated either at the spatial coordinates (/SPATIAL), or
        at the Fourier frequencies.

        The spatial coordinates range from -(N-1)/2 to (N-1)/2.
        The Fourier frequencies are in the same order as the FFT,
        and range from:
           [0, 2pi/N, 4pi/N, ..., pi, -pi(N+1)/N, ... -2pi(N-1)/N]

    SPATIAL = Set this keyword to return the wavelet as a function of spatial
        coordinates instead of the default Fourier frequencies.

 REFERENCE
    Torrence, C. and G.P. Compo, 1998: A practical guide to wavelet analysis.
        Bull. Amer. Meteor. Soc., v. 79, pp. 61-78.

 EXAMPLE
   Gaussian-derivative wavelet transform using convolution:
      n = 1024
      x = RANDOMN(seed, n)   ; choose a random time series length n

    parameter 6.0, scale 8, filter width 79 points
      info = WV_FN_GAUSSIAN(6.0, 8, 79, /SPATIAL, WAVELET=wavelet)
    find wavelet transform at scale 8:
      cwtConvol = COMPLEX(CONVOL(x, FLOAT(wavelet), /EDGE_WRAP), $
                    CONVOL(x, IMAGINARY(wavelet), /EDGE_WRAP))

   The same transform using the fast Fourier transform:
      info = WV_FN_GAUSSIAN(6.0, 8, n, WAVELET=wavelet)
      cwtFFT = FFT(FFT(x)*CONJ(wavelet),/INVERSE)

   Note that the FFT method is both much easier (since you don't need
   to choose a filter width) and much faster.

 MODIFICATION HISTORY
    Written by: Chris Torrence, 2000

 CALLS: ***
	GAMMA, WV_FN_GAUSS_DERIV


WV_FN_HAAR $RSI/wavelet/source/wv_fn_haar.pro
[Previous] [Next]
 NAME:
    WV_FN_HAAR

 PURPOSE:
    This function returns the Haar wavelet coefficients.

 CALLING SEQUENCE:
    info = WV_FN_HAAR(Order, Scaling, Wavelet, Ioff, Joff)

 INPUTS:
    Order: This is the order number for the Haar wavelet.
           It is automatically set to 1 (equivalent to Daubechies order=1),
           regardless of the input.

 OUTPUTS:
    Scaling: The scaling (father) coefficients [1d,1d]/SQRT(2d)

    Wavelet: The wavelet (mother) coefficients [1d,-1d]/SQRT(2d)

    Ioff: The offset index used to center the Scaling support (Ioff=0)

    Joff: The offset index used to center the Wavelet support (Joff=0)

 KEYWORD PARAMETERS:
    None.

 RETURN VALUE:
    Returns a structure with the following information:
       info = {family:'Haar', $    ; name of wavelet family
               order:1, $                ; order number
               order_name:'Order', $     ; term used for "order"
               order_range:[1], $        ; valid range for orders
               discrete:1, $             ; 0=continuous, 1=discrete
               orthogonal:1, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:0, $            ; 0=asymmetric, 1=symmetric
               support:1, $              ; support width
               moments:1, $              ; # of vanishing moments
               regularity:0.0}           ; # of continuous derivatives

 CALLS: ***
	REVERSE
 MODIFICATION HISTORY:
    Written by: Chris Torrence, 1999


WV_FN_MORLET $RSI/wavelet/source/wv_fn_morlet.pro
[Previous] [Next]
 NAME:
    WV_FN_MORLET

 PURPOSE
    This function returns the Morlet wavelet.

 CALLING SEQUENCE
    Info = WV_FN_MORLET( [Parameter] [, Scale, N]
          [, /DOUBLE] [, /SPATIAL]
          [, WAVELET=Wavelet] )

 INPUTS
    Parameter
        A scalar specifying the nondimensional frequency parameter
        for the Morlet wavelet. The default is 6.0.

    Scale
        A scalar specifying the normalized wavelet scale of the resulting
        wavelet function.

    N = A scalar specifying either the number of points in the data set
        (for Fourier frequencies) or the width of the wavelet function
        (if /SPATIAL is set).

    Note - if keyword WAVELET is missing then Scale and N are ignored
           and only Info is returned.

 RETURN VALUE:
    Returns a structure with the following information:
          (this is an example for Parameter=6)
       Info = {family:'Morlet', $    ; name of wavelet family
               order_name:'Parameter', $     ; term used for "order"
               order_range:[3,24,6], $   ; valid range [first,last,default]
               order:6, $                ; order number
               discrete:0, $             ; 0=continuous, 1=discrete
               orthogonal:0, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:1, $            ; 0=asymmetric, 1=symmetric
               support:-1, $              ; support width
               moments:-1, $              ; # of vanishing moments
               regularity:-1}         ; # of continuous derivatives

 KEYWORD PARAMETERS
    DOUBLE = Set this keyword to force the computation to be done in
        double precision arithmetic.

    WAVELET = Upon return, this keyword will contain a vector of wavelet
        coefficients evaluated either at the spatial coordinates (/SPATIAL), or
        at the Fourier frequencies.

        The spatial coordinates range from -(N-1)/2 to (N-1)/2.
        The Fourier frequencies are in the same order as the FFT,
        and range from:
           [0, 2pi/N, 4pi/N, ..., pi, -pi(N+1)/N, ... -2pi(N-1)/N]

    SPATIAL = Set this keyword to return the wavelet as a function of spatial
        coordinates instead of the default Fourier frequencies.

 REFERENCE
    Torrence, C. and G.P. Compo, 1998: A practical guide to wavelet analysis.
        Bull. Amer. Meteor. Soc., v. 79, pp. 61-78.

 EXAMPLE
   Morlet wavelet transform using convolution:
      n = 1024
      x = RANDOMN(seed, n)   ; choose a random time series length n

    parameter 6.0, scale 8, filter width 79 points
      info = WV_FN_MORLET(6.0, 8, 79, /SPATIAL, WAVELET=wavelet)
    find wavelet transform at scale 8:
      cwtConvol = COMPLEX(CONVOL(x, FLOAT(wavelet), /EDGE_WRAP), $
                    CONVOL(x, IMAGINARY(wavelet), /EDGE_WRAP))

   The same transform using the fast Fourier transform:
      info = WV_FN_MORLET(6.0, 8, n, WAVELET=wavelet)
      cwtFFT = FFT(FFT(x)*CONJ(wavelet),/INVERSE)

   Note that the FFT method is both much easier (since you don't need
   to choose a filter width) and much faster.

 MODIFICATION HISTORY
    Written by: Chris Torrence, 2000


WV_FN_PAUL $RSI/wavelet/source/wv_fn_paul.pro
[Previous] [Next]
 NAME:
    WV_FN_PAUL

 PURPOSE
    This function returns the Paul wavelet.

 CALLING SEQUENCE
    Info = WV_FN_PAUL( [Parameter] [, Scale, N]
          [, /DOUBLE] [, /SPATIAL]
          [, WAVELET=Wavelet] )

 INPUTS
    Parameter
        A scalar integer specifying the nondimensional frequency parameter
        for the Paul wavelet. The default is 4.

    Scale
        A scalar specifying the normalized wavelet scale of the resulting
        wavelet function.

    N = A scalar specifying either the number of points in the data set
        (for Fourier frequencies) or the width of the wavelet function
        (if /SPATIAL is set).

    Note - if keyword WAVELET is missing then Scale and N are ignored
           and only Info is returned.

 RETURN VALUE:
    Returns a structure with the following information:
          (this is an example for Parameter=6)
       Info = {family:'Paul', $    ; name of wavelet family
               order_name:'Parameter', $     ; term used for "order"
               order_range:[1,20,4], $   ; valid range [first,last,default]
               order:4, $                ; order number
               discrete:0, $             ; 0=continuous, 1=discrete
               orthogonal:0, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:1, $            ; 0=asymmetric, 1=symmetric
               support:-1, $              ; support width
               moments:-1, $              ; # of vanishing moments
               regularity:-1}         ; # of continuous derivatives

 KEYWORD PARAMETERS
    DOUBLE = Set this keyword to force the computation to be done in
        double precision arithmetic.

    WAVELET = Upon return, this keyword will contain a vector of wavelet
        coefficients evaluated either at the spatial coordinates (/SPATIAL), or
        at the Fourier frequencies.

        The spatial coordinates range from -(N-1)/2 to (N-1)/2.
        The Fourier frequencies are in the same order as the FFT,
        and range from:
           [0, 2pi/N, 4pi/N, ..., pi, -pi(N+1)/N, ... -2pi(N-1)/N]

    SPATIAL = Set this keyword to return the wavelet as a function of spatial
        coordinates instead of the default Fourier frequencies.

 REFERENCE
    Torrence, C. and G.P. Compo, 1998: A practical guide to wavelet analysis.
        Bull. Amer. Meteor. Soc., v. 79, pp. 61-78.

 EXAMPLE
   Paul wavelet transform using convolution:
      n = 1024
      x = RANDOMN(seed, n)   ; choose a random time series length n

    parameter 6.0, scale 8, filter width 79 points
      info = WV_FN_PAUL(6.0, 8, 79, /SPATIAL, WAVELET=wavelet)
    find wavelet transform at scale 8:
      cwtConvol = COMPLEX(CONVOL(x, FLOAT(wavelet), /EDGE_WRAP), $
                    CONVOL(x, IMAGINARY(wavelet), /EDGE_WRAP))

   The same transform using the fast Fourier transform:
      info = WV_FN_PAUL(6.0, 8, n, WAVELET=wavelet)
      cwtFFT = FFT(FFT(x)*CONJ(wavelet),/INVERSE)

   Note that the FFT method is both much easier (since you don't need
   to choose a filter width) and much faster.

 MODIFICATION HISTORY
    Written by: Chris Torrence, 2000

 CALLS: ***
	FACTORIAL


WV_FN_SYMLET $RSI/wavelet/source/wv_fn_symlet.pro
[Previous] [Next]
 NAME:
    WV_FN_SYMLET

 PURPOSE:
    This function returns the Symlet wavelet coefficients.

 CALLING SEQUENCE:
    info = WV_FN_SYMLET( Order, Scaling, Wavelet, Ioff, Joff)

 INPUTS:
    Order: This is the order number for the Symlet wavelet.
           Order=4 has 4 vanishing moments and 8 coefficients.

 OUTPUTS:
    Scaling: A vector of the scaling (father) coefficients

    Wavelet: A vector of the wavelet (mother) coefficients

    Ioff: The offset index used to center the Scaling support

    Joff: The offset index used to center the Wavelet support

 KEYWORD PARAMETERS:
    None.

 RETURN VALUE:
    Returns a structure with the following information:
          (this is an example for order=2)
       info = {family:'Symlet', $    ; name of wavelet family
               order_name:'Order', $     ; term used for "order"
               order_range:[4,15,4], $   ; valid range [first,last,default]
               order:4, $                ; order number
               discrete:1, $             ; 0=continuous, 1=discrete
               orthogonal:1, $           ; 0=nonorthogonal, 1=orthogonal
               symmetric:2, $            ; 0=asymmetric, 1=sym., 2=near sym.
               support:7, $              ; support width
               moments:4, $              ; # of vanishing moments
               regularity:0.550}         ; # of continuous derivatives

 REFERENCE:
    Daubechies, I., 1992: Ten Lectures on Wavelets, SIAM, p. 198.
       Daubechies has orders 4-10, although note that Daubechies
       has multiplied by Sqrt(2), and for some Orders the coefficients
       are reversed.

    Orders 11-15 are from <http://www.isds.duke.edu/~brani/filters.html>

 CALLS: ***
	REVERSE, WV_FN_SYMLET_COEFF
 MODIFICATION HISTORY:
    Written by: Chris Torrence, 1999