C
C LAST UPDATE:
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C******************************
C**     LFN_GET_SPOTPARS     **
C******************************
C
CD-Routine: Get Integrated Spot Parameters - LFN_GET_SPOTPARS
C This routine is used to return the basic parameters of the last integrated 
C spot calculated using the diagnostic option of the routine LFN_SAINT to 
C integrate an individual profile-fitted spot.
CD-end
CD-Fortran:
      SUBROUTINE LFN_GET_SPOTPARS (KSPOT, KH, KK, KL, 
     +                             XPOS_S, YPOS_S, NUM_S, NREJ_S,
     +                             BACK_S, AINTEN_S, SIGI_S, 
     +                             IERR, ERRSTR)
CD-end
      INCLUDE 'implicit_none.finc'
C
C PURPOSE: Get last integrated spot parameters calculated by LFN_SAINT
C 
C AUTHOR: J.W. Campbell 
C
C ARGUMENTS:
C
      INTEGER KSPOT
      INTEGER KH
      INTEGER KK
      INTEGER KL
      REAL XPOS_S
      REAL YPOS_S
      INTEGER NUM_S
      INTEGER NREJ_S
      REAL BACK_S(3)
      REAL AINTEN_S
      REAL SIGI_S
      INTEGER IERR
      CHARACTER*(*) ERRSTR
CD-Parameters:
C   KSPOT               i  (W) Spot no. in LRL of last integrated spot
C   KH                  i  (W) 'h' index of last integrated spot
C   KK                  i  (W) 'k' index of last integrated spot
C   KL                  i  (W) 'l' index of last integrated spot
C   XPOS_S              r  (W) Spot 'x' position in rasters
C   YPOS_S              r  (W) Spot 'y' position in rasters
C   NUM_S               i  (W) No. of pixels in spot
C   NREJ_S              i  (W) No. of rejected pixels
C   BACK_S(3)           r  (W) Background plane constants
C   AINTEN_S            r  (W) Integrated intensity
C   SIGI_S              r  (W) sig(I)
C   IERR                i  (W) Error flag =0 OK
C                                =1 No spot stored
C   ERRSTR              c  (W) Error message string (max 80 chars) set 
C                              if IERR is non-zero
CD-end
C
C====== Parameter statements
C 
      INCLUDE 'saint_limits.finc'
C
C====== GLOBALS:
C
      INCLUDE 'lfn_saint.finc'
C
C====== LOCALS:
C
      INTEGER I

C     INTEGER I       !Temp/loop variable
C
C------------------------------------------------------------------------------- 
C
      IERR = 0
      ERRSTR = ' '
C
C====== Error checks
C
      KSPOT = KSPOT_LAST
      IF (KSPOT.LE.0) THEN
         IERR = 1
         ERRSTR = 'No individual spot data currently stored'
         RETURN
      END IF
C
C====== Return data
C
      NUM_S = NUM_IN_SPOT
      DO 20 I = 1,3 
         BACK_S(I) = BACK(I)
 20   CONTINUE
      KH = I_H
      KK = I_K
      KL = I_L
      XPOS_S = XPOS
      YPOS_S = YPOS
      NREJ_S = NREJ
      AINTEN_S = INTEN
      SIGI_S = SIGI
      RETURN
      END
