pro rd_sda, infil, dset_arr, index, data, roadmap, nodata=nodata, filidx=filidx, dset_str=dset_arr0
;+
;NAME:
;	RD_SDA
;PURPOSE:
;	Read and extract SXT images specified in the 'dset_arr'
;	parameter from the SXT Solar-A reformatted data base.
;CALLING SEQUENCE:
;	Rd_SDA, infil, dset_arr, index, data, roadmap
;	Rd_SDA, infil, dset_arr, index, data
;	rd_sda, infil, dset_arr, index, data, roadmap, dset_str=dset_arr
;	Rd_SDA, infil, dset_arr, index, /nodata
;INPUT:
;	infil   : input file specification (SPR... or SFR...)
;		  "infil" can be a vector of filenames (WARNING - 
;		  do not mix and match FFI and PFI)
;	dset_arr: vector of dataset numbers to extract (indices vector)
;               * "dset_arr" can be
;                     1. An indicie vector ("SS") from a search of the roadmap
;			 of ALL of the files in "infil".
;                     2. a structure with fields ".dset" and ".ifil".
;                        ".dset" is the dataset number WITHIN THE FILE, and
;                        ".ifil" is the index of the filename within the
;                        infil array.  The structure is "N" elements long
;                        where "N" is the total number of datasets to extract.
;		* The order that the images are placed in the output 
;		  variable "data" is the same order that they 
;		  appear in "dset_arr"
;               * If "-1" is passed, the whole file is read
;                 and the dset_arr returned is the "indgen(ndset)"
;OPTIONAL INPUT:
;	nodata  : If present, only the index is read
;OUTPUT:
;	index	: data-index logical record (one for each 
;		  image requested)
;	data	: 2D or 3D image array
;OPTIONAL OUTPUT:
;	roadmap	: summary of data-index logical record, note
;		  all roadmaps records in the file are returned.
;		  In the case where "infil" is an array, roadmap
;		  is the concatenated roadmap for all files that
;		  are being read for the particular extraction.
;       filidx  : a vector the same length as the roadmap
;                 with the index of the file associated with that entry
;                 (ie: 0,0,0,0,1,1,1,1,2,2,2,2,...)
;		  This is output from RD_ROADMAP ONLY ON THE FILES FOR
;		  WHICH DATA HAS BEEN SELECTED TO BE READ!
;	dset_str: the structure form of the requested datasets 
;		  passed in with "dset_arr".  If user passes in
;		  a simple vector ("SS"), "dset_str" is the structure
;		  form of the output.
;Examples:
;	rd_sda, filename, indgen(10), index, data, roadmap
;	returns 1st 10 images in file=filename
;RESTRICION:
;	CAUTION: If the filename list is long and RD_SDA is going to
;	be called many times getting only a small number of data sets,
;	then it is recommended to use the structure option for "dset_arr"
;	(call MK_DSET_STR externally) because RD_FHEADER is called for
;	all files each time RD_SDA is called when not using the 
;	structure option for "dset_arr".
;HISTORY:
;	written by Mons Morrison, Fall 90.
;	11-Nov-91 MDM - Added option to not read the data
;	12-Nov-91 MDM - added the option to read the whole
;			file by passing a -1
;	 7-Dec-91 MDM - added option to pass a vector of filenames
;			as well as the "filidx" parameter
;	19-Dec-91 MDM - Changed "roadmap" reading to only read the
;			files that are being extracted from.
;	10-Jan-92 MDM - Moved "idset" increment command outside of
;			the read data option so that the /nodata
;			option would work properly (fixed bug)
;	10-Jan-91 MDM - Allowed user to pass "-1" for datasets with
;			an array of file names.
;	28-Feb-92 MDM - Changed calling sequence to allow "dset_arr"
;			to be a simple integer array ("SS") or a structure
;			with .DSET and .IFIL.  "SS" option can be used 
;			even if infil is an array (previously restricted
;			to turn it into a structure in external routine)
;			Uses MK_DSET_STR internally.
;			Also added "dset_str" optional output capability
;	 6-Mar-92 MDM - Adjusted the documentation header some
;       19-Mar-92 MDM - Changed not to use the "roadmap2" method of getting
;                       the byte offset.  Instead, uses the full roadmap.
;                       This is to speed up the reading if reading the same
;                       file multiple times.
;                       Also, changed call to RD_INDEX to pass the byte offset
;                       so it does not have to read RD_ROADMAP
;	20-Mar-92 MDM - Changed so output structure type is not updated if
;			the different structure is switching to an OLDER version
;	25-Jun-92 MDM - Added capability to have INTEGER*4 data
;	23-Oct-92 MDM - Use STR_COPY_TAGS instead of STR_COPY
;	 4-Jan-94 MDM - Removed all code and replaced with a call to RD_XDA
;-
;
rd_xda, infil, dset_arr, index, data, roadmap, nodata=nodata, filidx=filidx, dset_str=dset_arr0
;
end
