SDAS


List of Routines


Routine Descriptions

STRD

[Next Routine] [List of Routines]
 NAME:
	STRD
 PURPOSE:
	Open an STSDAS file and read into an image array and header.  Combines
	the functions of SXREAD and SXOPEN.  Can only be used on files 
	without group parameters

 CALLING SEQUENCE:
	STRD, im, hdr, filename  

 OPTIONAL INPUT:
	FILENAME -  Character string giving the name of the SDAS file
		to be read.  If omitted, then program will prompt 
		for the file name.  If an extension is given, then
		it must terminate in a 'h'.
		A default extension of '.hhh' is assumed, if one is
		not supplied.  VMS Version numbers are ignored, and the
		most recent version is always used.

 OUTPUTS:
	IM - array containing image data
	HDR - string array containing header

 COMMON BLOCKS:
	STCOMMN - Created by SXOPEN.  STRD uses STCOMMN to check
		for an open unit, and to get image dimensions.          

 SIDE EFFECTS:
	STSDAS image array and header are read into IM and HD
	IF FILENAME is not supplied, then the program will check that
	the image and header variable do not already contain data.

 RESTRICTIONS:
	For use only on data without Groups!!  

 SYSTEM VARIABLES:
	If !QUIET = 1 then program will not print the size of the image.

 PROCEDURE:
	Program checks that STSDAS files exists and that IDL variables do
	not already contain data, before calling SXOPEN and SXREAD to
	read in SDAS data.

 MODIFICATION HISTORY:
	Written W. Landsman, STI Corporation August 1986
	Optional parameter "FILENAME" added November 1986

(See /usr/local/idl/lib/zastron/sdas/strd.pro)


STSUB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	STSUB
 PURPOSE:
	Read a subset of a space telescope SDAS image file.   User can
	specify a subimage range or a step size    Called by STSUBIM

 CALLING SEQUENCE:
	Result =  stsub( unit, x1, x2, y1, y2, step)

 INPUTS:
	UNIT      =  Unit number of file, must be from 1 to 9.
		     Unit must have been opened with SXOPEN.
       x1        =  lower x value
       x2        =  upper x value
       y1        =  lower y value
       y2        =  upper y value
	step      =  used to extract every nth pixel.  If step = 1, a full res.
 	             subimage is extracted; step = 2, every other pixel is
	             extracted, etc.  Defaults to 1.  The minimum value is 1.
 OUTPUTS:
	Result of function = array constructed from designated record.

 COMMON BLOCKS:
	Uses idl common stcommn to access parameters (see SXOPEN)

 MODIFICATION HISTORY:
	Written, M. Greason, STX, July 1990.
	Remove initialization of array for increased efficiency  January, 1991
	Removed call to STSUBC.EXE, do it all in IDL
                                      - K. Venkatakrishna, STX, April 1992

(See /usr/local/idl/lib/zastron/sdas/stsub.pro)


STSUBIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	STSUBIM
 PURPOSE:
	Open an STSDAS file and read a portion of the file into an array.  
	An enhanced version of STRD.  Program will prompt for the file name
	and subimage bounds.
 CALLING SEQUENCE:
	STSUBIM, im, hdr, [ filename, x1, x2, y1, y2, step, SILENT = ]

 OPTIONAL INPUTS:
	FILENAME -  Character string giving the name of the SDAS file
		to be read.  If omitted, then program will prompt 
		for the file name.  If an extension is given, then
		it must terminate in a 'h'.  A default extension of '.hhh' 
		is assumed, if one is not supplied.  In VMS, version numbers 
		are ignored, and the most recent version is always used.
	X1      -  Starting x value (def=0), integer scalar
	X2      -  Ending x value (def=total record size), integer scalar
	Y1      -  Starting y value (def = 0), integer scalar
	Y2      -  Ending y value (def = total no. of records), integer scalar
     STEP    -  The number of pixels between extracted pixels.  This allows
                the user to read every Nth pixel from the image.  STEP=1
                indicates full resolution, STEP=2 indicates every other pixel,
                etc.
 OUTPUTS:
	IM - array containing image data
	HDR - string array containing STSDAS header

 OPTIONAL KEYWORD INPUT:
	SILENT  -  If this keyword is present, the size of the image 
		will not be printed.

 COMMON BLOCKS:
	STCOMMN - Created by SXOPEN.  STSUBIM uses STCOMMN to check
	for an open unit, and to get image dimensions.          

 SIDE EFFECTS:
	STSDAS image array and header are read into IM and HD
	IF FILENAME is not supplied, then the program will check that
	the image and header variable do not already contain data.

 RESTRICTIONS:
	For use only on data without Groups!!  
	For use only on 2 dimensional data files.

 PROCEDURE:
	Program checks that STSDAS file exists and that IDL variables do
	not already contain data, before calling SXOPEN and STSUB to
	read in data.  The header keywords NAXIS* and CRPIX*
	are updated to account for the actual image size.

 PROCEDURES CALLED:
       ORDINAL, STSUB, SXOPEN, FDECOMP, SPEC_DIR, SXADDPAR, SXADDHIST

 MODIFICATION HISTORY:
	Written B. Pfarr, STX, September 1987 from STRD
	Modifed to IDL Version 2, M. Greason, STX, May 1990.
	Prints 1st, 2nd, etc., instead of 1th, 2th... R. S.Hill, STX, Aug 1991
	CRPIX transformation corrected.  RSH, HSTX, 27-May-1992.

(See /usr/local/idl/lib/zastron/sdas/stsubim.pro)


STWRT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	STWRT
 PURPOSE:
	Write a STSDAS header and/or 2-D array to disk (without groups!) 

 CALLING SEQUENCE:
	STWRT, hdr                     ;Write image header (.hhh file) only
	STWRT, im                      ;Create header to match image array
	STWRT, im, hdr,[ name, /SDAS, /NOUPDATE ]  

 INPUT PARAMETERS:
	im - image array to be written to disk.  If no header array is
		supplied, then a simple header appropiate to the image will be
		constructed.

 OPTIONAL INPUT PARAMETER:
	hdr - STSDAS header, string array.  
	name - character string containing the name of output file
		to which the image is written.  If omitted, then 
		the program will prompt for the file name.  A file
		name will have the default extension of '.HHH'

 OPTIONAL KEYWORD INPUTS:
	NOUPDATE-- By default, STWRT will modify the input FITS header to create
		a proper SDAS .hhh file.   This includes  ensuring that (1) a 
               DATATYPE keyword exists, and (2) that BITPIX is a positive
		value.   
	SDAS-- The SDAS keyword can be specified to modify the input header to 
		ensure SDAS compatibility.

 RESTRICTIONS:
	(1) STWRT is only for 2 dimensional images.  For other arrays use

	SXOPEN,1,NAME,HD,HISTORY,'W'   ;HISTORY need not be defined
	SXWRITE,1,IM
	CLOSE,1

	(2) The type of data written is determined by the DATATYPE 
		keyword in the header.  A DATATYPE keyword appropiate to
		the image array type will be added if does not already exist

 SIDE EFFECTS:
	A STSDAS header and/or image array is written to disk.    Unit 2 is
	opened and closed.

 REVISION HISTORY:
	Written W. Landsman, STI Corp. August, 1986
	Returned old version to not modify header.  W. Landsman July 1991.
	Included call to CHKDType--option to change DATATYPE and BITPIX if they; 
	do not match.				J.D.Offenberg Dec 1991.
	Added call to CHECK_FITS, NOUPDATE keyword, remove autochange keyword
                                        W. Landsman May 1992

(See /usr/local/idl/lib/zastron/sdas/stwrt.pro)


SXADDHIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXADDHIST                           
 PURPOSE:
	Procedure to add history line(s) to FITS header

 CALLING SEQUENCE
	sxaddhist, history, header

 INPUTS:
	history - string or string array containing history line(s)
		to add to the header
	header - string array containing the FITS header

 OUTPUTS:
	header - unpdated header

 EXAMPLES:
	sxaddhist, 'I DID THIS', header

	hist = strarr(3)
	hist(0) = 'history line number 1'
	hist(1) = 'the next history line'
	hist(2) = 'the last history line'
	sxaddhist, hist, header

 HISTORY:
	D. Lindler  Feb. 87
	April 90  Converted to new idl  D. Lindler
	Put only a single space after HISTORY   W. Landsman  November 1992

(See /usr/local/idl/lib/zastron/sdas/sxaddhist.pro)


SXADDPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXADDPAR
 PURPOSE:
	Add or modify a parameter in a FITS or STSDAS header array.

 CALLING SEQUENCE:
	sxaddpar, Header, Name, Value, [ Comment,  Location,
				BEFORE =, AFTER = , FORMAT= ]

 INPUTS:
	Header = String array containing FITS or STSDAS header.    The
		length of each element must be 80 characters.    If not 
		defined, then SXADDPAR will create an empty FITS header array.

	Name = Name of parameter. If Name is already in the header the value 
		and possibly comment fields are modified.  Otherwise a new 
		record is added to the header.  If name = 'HISTORY' then the 
		value will be added to the record without replacement.  In 
		this case the comment parameter is ignored.

	Value = Value for parameter.  The value expression must be of the 
		correct type, e.g. integer, floating or string.  String values
		 of 'T' or 'F' are considered logical values.

 OPTIONAL INPUT PARAMETERS:
	Comment = String field.  The '/' is added by this routine.  Added 
		starting in position 31.    If not supplied, or set equal to 
		'', then the previous comment field is retained (when found) 

	Location = Keyword string name.  The parameter will be placed before the
		location of this keyword.    This parameter is identical to
		the BEFORE keyword and is kept only for consistency with
		earlier versions of SXADDPAR.

 OPTIONAL INPUT KEYWORD PARAMETERS:
	BEFORE	= Keyword string name.  The parameter will be placed before the
		location of this keyword.  For example, if BEFORE='HISTORY'
		then the parameter will be placed before the first history
		location.  This applies only when adding a new keyword;
		keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		location of this keyword.  This keyword takes precedence over
		BEFORE.

	FORMAT	= Specifies FORTRAN-like format for parameter, e.g. "F7.3".  A
		scalar string should be used.  For complex numbers the format
		should be defined so that it can be applied separately to the
		real and imaginary parts.

 OUTPUTS:
	Header = updated FITS header array.

 RESTRICTIONS:
	Warning -- Parameters and names are not checked
		against valid FITS parameter names, values and types.

 MODIFICATION HISTORY:
	DMS, RSI, July, 1983.
	D. Lindler Oct. 86  Added longer string value capability
	Converted to NEWIDL  D. Lindler April 90
	Added Format keyword, J. Isensee, July, 1990
	Added keywords BEFORE and AFTER. K. Venkatakrishna, May '92
	Pad string values to at least 8 characters   W. Landsman  April 94

(See /usr/local/idl/lib/zastron/sdas/sxaddpar.pro)


SXDELPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXDELPAR
 PURPOSE:
	Procedure to delete a keyword parameter(s) from a FITS header

 CALLING SEQUENCE:
	sxdelpar, h, parname

 INPUTS:
	h - FITS header, string array
	parname - string or string array of keyword name(s) to delete

 OUTPUTS:
	h - updated header
 EXAMPLE:
	Delete the astrometry keywords CDn_n from a FITS header, h

	IDL> sxdelpar, h, ['CD1_1','CD1_2','CD2_1','CD2_2']

 NOTES:
	(1)  No message is returned if the keyword to be deleted is not found (
	(2)  All appearances of a keyword in the header will be deleted

 HISTORY:
	version 1  D. Lindler Feb. 1987
	Converted to new IDL  April 1990 by D. Lindler

(See /usr/local/idl/lib/zastron/sdas/sxdelpar.pro)


SXGPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      SXGPAR                           

 PURPOSE:
      Obtain group parameter value in SDAS/FITS file

 CALLING SEQUENCE:
	result = sxgpar( h, par, name, [ type, sbyte, nbytes] )

 INPUTS:
	h - header returned by SXOPEN
	par - parameter block returned by SXREAD or multiple
		parameter blocks stored in array of dimension
		greater than one.
	name - parameter name (keyword PTYPEn) or integer
		parameter number.

 OPTIONAL INPUT/OUTPUT
	type - data type (if not supplied or null string, the
		header is searched for type,sbyte, and nbytes)
	sbyte - starting byte in parameter block for data
	nbytes - number of bytes in parameter block for data

 OUTPUT:
	parameter value or value(s) returned as function value

 SIDE EFFECTS:
	If an error occured then !err is set to -1

 OPERATIONAL NOTES:
	Supplying type, sbyte and nbytes greatly decreases execution
	time.  The best way to get the types is on the first call
	pass undefined variables for the three parameters or set
	type = ''.  The routine will then return their values for
	use in subsequent calls.
	
 METHOD:
	The parameter type for parameter n is obtained
	from PDTYPEn keyword.  If not found then DATATYPE keyword
	value is used.  If that is not found then BITPIX is
	used.  BITPIX=8, byte; BITPIX=16 integer*2; BITPIX=32
	integer*4.

 HISTORY:
	version 1  D. Lindler  Oct. 86
	version 2  D. Lindler Jan. 90  added ability to process
		multiple parameter blocks in single call
	version 3  D. Lindler  (converted to New vaxidl)
       Apr 14 1991      JKF/ACC - fixed make_array datatypes(float/double)

(See /usr/local/idl/lib/zastron/sdas/sxgpar.pro)


SXGREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SXGREAD
 PURPOSE:
	Read group parameters from a Space Telescope STSDAS image file     

 CALLING SEQUENCE:
	grouppar = sxgread( unit, group )

 INPUTS:
	UNIT   = Supply same unit as used in SXOPEN.
	GROUP  =  group number to read.  if omitted, read first group.
		The first group is number 0.

 OUTPUTS:
	GROUPPAR  =  parameter values from fits group parameter block.
		It is a byte array which may contain multiple data types.
		The function SXGPAR can be used to retrieve values from it.

 COMMON BLOCKS:
	Uses IDL Common STCOMMN to access parameters.
 SIDE EFFECTS:
	IO is performed. 
 MODIFICATION HISTORY:
	WRITTEN, Don Lindler, July, 1 1987
	MODIFIED, Don Neill, Jan 11, 1991 - derived from sxread.pro

(See /usr/local/idl/lib/zastron/sdas/sxgread.pro)


SXHCOPY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXHCOPY                            
 PURPOSE:
	Copies selected portions of one header to another

 CALLING SEQUENCE:
	sxhcopy, h, keyword1, keyword2, hout

 INPUTS:
	h - input header
	keyword1 - first keyword to copy
	keyword2 - last keyword to copy

 INPUT/OUTPUT:
	hout - header to copy the information to.

 METHOD:
	the headers lines from keyword1 to keyword2 are copied to
	the end of the output header.  No check is made to verify
	that a keyword value already exists in the output header.

 HISTORY:
	version 1  D. Lindler    Sept. 1989

(See /usr/local/idl/lib/zastron/sdas/sxhcopy.pro)


SXHEDIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SXHEDIT                             
 PURPOSE:
       Routine to interactively edit a SDAS header on disk.
	VMS: uses EDT.
	Unix: uses whatever your EDITOR environment variable is set to.

 CALLING SEQUENCE:
	sxhedit,name,h

 INPUTS:
	name - header file name (default extension is .hhh)

 OUTPUTS:
	h - (optional) editted header

 SIDE EFFECTS:
	A new version of the file will be created.

 HISTORY:
	Version 1  D. Lindler July  1987
	Version 2  JAH Dec '88:  Converted to Sun IDL.
	Modified   D. Neill Sept, 1990: Now deletes all versions of sxhedit.tmp
			made compatable with Unix
	Modified   D. Neill Apr, 1991: Ensures 80 char headers and will not
		create new version if no changes made.

(See /usr/local/idl/lib/zastron/sdas/sxhedit.pro)


SXHMAKE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXHMAKE
 PURPOSE:
	Create a basic STSDAS header file from an IDL data array

 CALLING SEQUENCE:
	sxhmake, Data, Groups, Header

 INPUTS:
	Data = IDL data array of the same type, dimensions and
		size as are to be written to file.
	Groups = # of groups to be written.

 OUTPUTS:
	Header = String array containing ST header file.

 PROCEDURE:
	Call sxhmake to create a header file.  Then call sxopen to
	open output image, followed by sxwrite to write the data.
	If you do not plan to change the header created by sxhmake
	before calling sxopen, you might consider using sxmake which
	does both steps.

 MODIFICATION HISTORY:
	Don Lindler  Feb 1990 modified from SXMAKE by DMS, July, 1983.
	D. Lindler April 90  Converted to new VMS IDL
	M. Greason May 1990  Header creation bugs eliminated.

(See /usr/local/idl/lib/zastron/sdas/sxhmake.pro)


SXHREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXHREAD                         
 PURPOSE:
	Procedure to read a STSDAS/GEIS (.hhh) header from disk.  This version
	of SXHREAD can read three types of disk files
	(1)  VMS Fixed record length 80 byte files, or GEIS files with
		VMS buckets
	(2)  Unix stream files with a CR after every 80 bytes
	(3)  Variable length record files

 CALLING SEQUENCE:
	sxhread, name, header

 INPUT:
	name - file name, scalar string.  An extension of .hhh is appended 
		if not already supplied
 OUTPUT:
	header - STSDAS header, string array
 NOTES:
	SXHREAD  does not do any checking to see if the file is a valid
	STSDAS header.    It simply reads the file into a string array with
	80 byte elements

 HISTORY:
	Version 1  D. Lindler  July, 1987
	Version 2  M. Greason, August 1990
	Use READU for certain ST VAX GEIS files   W. Landsman January, 1992

(See /usr/local/idl/lib/zastron/sdas/sxhread.pro)


SXHWRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXHWRITE
 PURPOSE:
	Procedure to write an STSDAS or FITS header to disk as a STSDAS
	*.hhh file.

 CALLING SEQUENCE:
	sxhwrite,name,h

 INPUTS:
	name - file name. If an extension is supplied it must be 3 characters
		ending in "h".
	h - FITS header, string array

 SIDE EFFECTS:
	File with specified name is written.  If qualifier not specified
	then .hhh is used
   
	SXHWRITE will modify the header in the following ways, if necessary
	(1)  If not already present, an END statement is added as the 
		last line.   Lines after an existing END statment are
		deleted.
	(2)  Spaces are appended to force each line to be 80 characters.
	(3)  On Unix machines, a carriage return is appended at the end
		of each line.   This is consistent with STSDAS and allows
		the file to be directly displayed on a stream device

 PROCEDURES USED:
	zparcheck, fdecomp
 HISTORY:
	version 1  D. Lindler  June 1987
	conversion cleaned up.  M. Greason, June 1990
	Add carriage return at the end of Unix files   W. Landsman Oct 1991

(See /usr/local/idl/lib/zastron/sdas/sxhwrite.pro)


SXMAKE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXMAKE
 PURPOSE:
	Create a basic St header file from an IDL
	Array before writing data.

 CALLING SEQUENCE:
	sxmake, Unit, File, Data, Par, Groups, Header

 INPUTS:
	Unit = Logical unit number from 1 to 9.
	File = file name of data and header files to
		create.  The filetype extension must not appear
		in this name.  The header file is created with the
		extension 'HHH' and the data file has 'HHD'.
	Data = IDL data array of the same type, dimensions and
		size as are to be written to file.
	Par = # of elements in each parameter block for each
		data record.  If = to 0, parameter blocks will
		not be written.  The data type of the parameter
		blocks must be the same as the data array.
	Groups = # of groups to write.  If 0 then write in basic
		format without groups.	

 OPTIONAL INPUT PARAMETERS:
	Header = String array containing ST header file.  If this
		parameter is omitted, a basic header is constructed.
		If included, the basic parameters are added to the
		header using sxaddpar.  The END keyword must terminate
		the parameters in Header.

 OPTIONAL OUTPUT PARAMETERS:
	Header = ST header array, an 80 by N character array.

 COMMON BLOCKS:
	Stcommn - as used in sxwrite, sxopen, etc.

 SIDE EFFECTS:
	The header file is created and written and then the
	data file is opened on the designated unit.

 RESTRICTIONS:
	Header files must be named .HHH and data files must be
	named .HHD.

 PROCEDURE:
	Call sxmake to create a header file.  Then call sxwrite
	to output each group.

 MODIFICATION HISTORY:
	DMS, July, 1983.
	converted to new VMS IDL  April 90

(See /usr/local/idl/lib/zastron/sdas/sxmake.pro)


SXOPEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXOPEN
 PURPOSE:
	Open a Space Telescope formatted header file.
	Save the parameters required subsequent SX routines in
	the common block Stcommn.  Optionally save the header in 
       the string array Header, and the history in the string array
	History.  Open the data file associated with this
	header on the same unit.

 CALLING SEQUENCE:
	SXOPEN, Unit, Fname [, Header [,History] [,Access]]

 INPUTS:
	Unit = IDL unit used for IO.  Must be from 1 to 9.
	Fname = File name of header file.  Default extension
		is .hhh for header files and .hhd for data
		files.    If an extension is supplied it must have the 
		form .xxH where xx are any to alphanumeric characters. The
		data file must have extension .xxD
		No version number is allowed.  Most recent versions
		of the files are used.

 OPTIONAL INPUT PARAMETER:
	Access = 'R' to open for read, 'W' to open for write.

 OUTPUTS:
	Stcommn = Common block containing ST parameter blocks.
		(Long arrays.)

 OPTIONAL OUTPUT PARAMETERS:
	Header = 80 char by N string array containing the
		names, values and comments from the FITS header.
		Use the function SXPAR to obtain individual
		parameter values.
	History = String array containing the value of the
		history parameter.

 COMMON BLOCKS:
	STCOMMN - Contains RESULT(20,10) where RESULT(i,LUN) =
	0 - 121147 for consistency check, 1 - Unit for consistency,
	2 - bitpix, 3 - naxis, 4 - groups (0 or 1), 5 - pcount,
	6 - gcount, 7 - psize, 8 - data type as idl type code,
	9 - bytes / record, 10 to 10+N-1 - dimension N,
	17 = record length of file in bytes.
	18 - # of groups written, 19 = gcount.

 SIDE EFFECTS:
	The data and header files are accessed.

 RESTRICTIONS:
	Works only for disc files.  The data file must have
	must have the extension ".hhd" and the header file
	must have the extension ".hhh".

 PROCEDURE:
	The header file is opened and each line is read.
	Important parameters are stored in the output
	parameter.  If the last two parameters are specified
	the parameter names and values are stored.  The common
	block STCOMMN is filled with the type of data, dimensions,
	etc. for use by SXREAD.

	If access is for write, each element of the header
	array, which must be supplied, is written to the
	header file.  The common block is filled with
	relevant parameters for SXWRITE.  A keyword of "END"
	ends the header.

 MODIFICATION HISTORY:
	Written, DMS, May, 1983.
	D. Lindler Feb. 1990
		Modified to allow var. record length header files.
	D. Lindler April 1990   Conversion to new VMS IDL
       Added /BLOCK when opening new .hhd file

(See /usr/local/idl/lib/zastron/sdas/sxopen.pro)


SXPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXPAR
 PURPOSE:
	Obtain the value of a parameter in a FITS header

 CALLING SEQUENCE:
	result = SXPAR( hdr, name,[ abort, COUNT= ])   
 INPUTS:
	Hdr =  FITS header array, (e.g. as returned by SXOPEN or READFITS)  
		string array, each element should have a length of 80
		characters	
	Name = String name of the parameter to return.   If Name is of 
		the form 'keyword*' then an array is returned containing 
		values of keywordN where N is an integer.  The value
		of keywordN will be placed in RESULT(N-1).  The data type 
		of RESULT will be the type of the first valid match of keywordN 
		found.

 OPTIONAL INPUTS:
	ABORT - string specifying that SXPAR should do a RETALL
		if a parameter is not found.  ABORT should contain
		a string to be printed if the keyword parameter is not found.
		If not supplied SXPAR will return with a negative
		!err if a keyword is not found.

 OPTIONAL KEYWORD OUTPUT:
	COUNT - Optional keyword to return a value equal to the number of 
		parameters found by sxpar, integer scalar

 OUTPUTS:
	Function value = value of parameter in header.
		If parameter is double precision, floating, long or string,
		the result is of that type.  Apostrophes are stripped
		from strings.  If the parameter is logical, 1 is
		returned for T, and 0 is returned for F.
		If Name was of form 'keyword*' then a vector of values
		are returned.

 SIDE EFFECTS:
	Keyword COUNT returns the number of parameters found.
	!err is set to -1 if parameter not found, 0 for a scalar
	value returned.  If a vector is returned it is set to the
	number of keyword matches found.

	If a keyword occurs more than once in a header, a warning is given,
	and the first occurence is used.

 EXAMPLES:
	Given a FITS header, h, return the values of all the NAXISi values
	into a vector.    Then place the history records into a string vector.

	IDL> naxisi = sxpar( h ,'NAXIS*')         ; Extract NAXISi value
	IDL> history = sxpar( h, 'HISTORY' )      ; Extract HISTORY records

 PROCEDURE:
	The first 8 chacters of each element of Hdr are searched for a 
	match to Name.  The value from the last 20 characters is returned.  
	An error occurs if there is no parameter with the given name.
       
	If a numeric value has no decimal point it is returned as type
	LONG.   If it contains more than 8 numerals, or contains the 
	character 'D', then it is returned as type DOUBLE.  Otherwise
	it is returned as type FLOAT

 MODIFICATION HISTORY:
	DMS, May, 1983, Written.
	D. Lindler Jan 90 added ABORT input parameter
	J. Isensee Jul,90 added COUNT keyword
	W. Thompson, Feb. 1992, added support for FITS complex values.
	W. Thompson, May 1992, corrected problem with HISTORY/COMMENT/blank
		keywords, and complex value error correction.

(See /usr/local/idl/lib/zastron/sdas/sxpar.pro)


SXREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SXREAD
 PURPOSE:
	Read a Space Telescope STSDAS image file     

 CALLING SEQUENCE:
	result = sxread( Unit, group , [par] )

 INPUTS:
	UNIT  =  Unit number of file, must be from 1 to 9.
		Unit must have been opened with SXOPEN.
	GROUP  =  group number to read.  if omitted, read first record.
		The first record is number 0.
 OUTPUTS:
	Result of function  =  array constructed from designated record.

 OPTIONAL OUTPUT:
	PAR  =  Variable name into which parameter values from STSDAS
		group parameter block are read.  It is a byte array
		which may contain multiple data types.  The function
		SXGPAR can be used to retrieve values from it.

 COMMON BLOCKS:
	Uses IDL Common STCOMMN to access parameters.

 NOTES:
       Use the function SXGREAD to read the group parameter blocks without
       having to read the group array.

	If the STSDAS file does not contain groups, then the optional output
	parameter PAR is returned undefined, but no error message is given.

 SIDE EFFECTS:
	IO is performed. 
 MODIFICATION HISTORY:
	WRITTEN, Don Lindler, July, 1 1987

(See /usr/local/idl/lib/zastron/sdas/sxread.pro)


SXWRITE

[Previous Routine] [List of Routines]
 NAME:
	SXWRITE
 PURPOSE:
	Write a group of data and parameters in ST format
	to a STSDAS data file.

 CALLING SEQUENCE:
	SXWRITE, Unit, Data,[ Par]

 INPUTS:
	Unit = unit number of file.  The file must have been
		previously opened by SXOPEN.
	Data = Array of data to be written.  The dimensions
		must agree with those supplied to SXOPEN and written
		into the FITS header.  The type is converted if
		necessary.

 OPTIONAL INPUT PARAMETERS:
	Par = parameter block.  The size of this array must
		agree with the Psize parameter in the FITS header.

 OUTPUTS:
	None.
 COMMON BLOCKS:
	STCOMMN - Contains RESULT(20,10) where RESULT(i,LUN) =
	0 - 121147 for consistency check, 1 - Unit for consistency,
	2 - bitpix, 3 - naxis, 4 - groups (0 or 1), 5 - pcount,
	6 - gcount, 7 - psize, 8 - data type as idl type code,
	9 - bytes / record, 10 to 10+N-1 - dimension N,
	18 - # of groups written, 19 = gcount.

 SIDE EFFECTS:
	The data are written into the next group.

 RESTRICTIONS:
	SXOPEN must have been called to initialize the
	header and the common block.

 MODIFICATION HISTORY:
	DMS, July, 1983.
	D.Lindler July, 1986 - changed block size of file to 512
			moved group parameters after the groups data.
	D.Lindler July, 1987 - modified to allow any size parameter block
			(in bytes).
	D. Lindler  April, 1990 - converted to new VMS IDL

(See /usr/local/idl/lib/zastron/sdas/sxwrite.pro)