Identifier     daar

 Purpose        Derive Auto Analysis Result as in the pipeline.

 Synopsis       aar_struct = daar(spd_struct [,AOT_SPEED=AOT_SPEED]
                                [,/FORTRAN]
                                [, AOT_NUMBER=AOT_NUMBER]
                                [, DARKTABLE=DARKTABLE]
                                [, PHOTTABLE=PHOTTABLE]
                                [, NOVERSCHK = NOVERSCHK]
                                [,/ALL]
                                [, CAL3 = cal3] [, CAL13 = cal13]
                                [, CAL19 = cal19]
                                [, CAL21_1 = cal21_1] [, CAL21_2 = cal21_2]
                                [, CAL21_4 = cal21_4] [, CAL21_8 = cal21_8]
                                [, CAL25_1A = cal25_1a] [, CAL25_1B = cal25_1b]
                                [, CAL25_1D = cal25_1d] [, CAL25_1E = cal25_1e]
                                [, CAL25_2A = cal25_2a] [, CAL25_2B = cal25_2b]
                                [, CAL25_2C = cal25_2c] [, CAL25_3A = cal25_3a]
                                [, CAL25_3C = cal25_3c] [, CAL25_3D = cal25_3d]
                                [, CAL25_3E = cal25_3e] 
                                [, CAL25_4  = cal25_4]  [, CAL25_5A = cal25_5a]
                                [, CAL25_5B = cal25_5b] [, CAL25_5C = cal25_5c]
                                [, CAL25_5D = cal25_5d] [, CAL25_6  = cal25_6]
                                [, /noclearbuffer]
                               )

 Arguments      Name      I/O Type    Description
                -----------------------------------------------------
                spd_struct I  struct  SPD structure name
                aot_number I  int     AOT number (1,2,6,7)
                fortran    I  key     use FORTRAN version 
                noverschk  I  keyw    supress OLP version check
                darktable  I  string  filename TA dark file 
                                      not yet activated
                phottable  I  string  filename TA PHOT file
                                      not yet activated
                all        I  keyw    all refrence data will be unflagged
                aot_speed  I  int     AOT 1 speed : 1... 4
                                      if the necessary informations 
                                      EOHAUTCS and EOHAUTCE not given 
                                      in the header of the SPD
                aar_struct O  struct  AAR structure name
                cal3       I  struct  CAL3    file to use instead of default 
                cal19      I  struct  CAL19   file to use instead of default 
                cal13      I  struct  CAL13   file to use instead of default 
                cal21_x    I  struct  CAL21_x file to use instead of default 
                cal25_x    I  struct  CAL25_x file to use instead of default 
                /noclearbuffer
                           I  switch  Do not clear the calfile buffer
                                      before setting any optional
                                      alternative calibration calfile

 Returns        AAR structure

 Description    This function runs aa on the spd_struct, and puts the
                resulting AAR in aar_struct.
                If any of the optional CAL file parameters are used, the 
                specified cal file is used in stead of the default one.

                If the /noclearbuffer option is not given, the calfile
                buffer will be cleared upon entering DAAR thus ensuring
                that the default set of calibration files will be used
                even in those cases where no calxx parameter is used.
                
                The OLP version is extracted from the SPD header (if
                not /noverschk is given) and if the OLP version is lower
                than 6 all data are set to NO refrence scan.

 Comment        ---                

 Example        ---

 Category       AA

 Filename       daar.pro (ias_aa s module to extract) (module: ias_aa)

 Author         E.Wieprecht (-->ekw)

 Version        3.2

 History        0.1   23-03-94 ekw  first draft
                1.0   22-06-94 ekw  coding 
                1.1   19-07-94 GB   Cleaned up and adapted a lot
                1.2   23-09-94 DRB  Alternate calfile access implemented
                1.3   30-09-94 DRB  Always clear the calbuffer unless
                                           told otherwise with /noclearbuffer
                1.4   17-10-94 EkW  read AOT number from header
                1.5   23-03-95 EkW  read velocity components from header
                1.6   28-03-95 EkW  add parameter to external call
                1.7   27-10-95 NS   Change AA to DAAR
                1.8   27-11-95 KL   Corrected access of velocity keywords
                                         TREFDOPP replaced by TREFDOP1, 2 & 3
                1.9   15-12-95 KL   Added access to calfile 21_x and 25_3E
                2.0   17-12-95 EkW  correct access calfile 21_x and 25_3E
                2.1   19-12-95 EkW  correct AOT number access
                2.1.1 30-04-96 rh++ removed VMS specific include statement
                2.2   01-07-96 EkW  adapt to SPR 1705/06/07
                2.3   04-07-96 NS   Add utc to itk conversion / devide by 24
                2.4   21-11-96 NS   Add cal19
                2.5   21-11-96 BV   Timedependent calfile access
                2.6   24-02-97 EkW  print out velocity information (SPR_S0186)
                2.7   27-06-97 EkW  SPR_S0203 : refrence scan handling
                2.8   27-06-97 BV   SPR_S0203 : all reference scans unflagged
                2.9   13-10-97 EkW  SPR_S0203 : add /ALL keyword
                3.0   03-12-97 EkW  call IDL pipeline programs
                3.1   20-01-98 EkW  activate TA SPR_S0314
                3.2   21-01-98 EkW  activate calseletion by keyword S0319