Viewing contents of file '../idllib/iuedac/iuelib/pro/curestr.pro'
;******************************************************************************
;+
;*NAME:
;
;	CURESTR
;
;*CLASS:
;
;*CATEGORY:
;
;	NEWSIPS
;
;*PURPOSE:
;
;	Determine if the image's camera and dispersion are permitted.  This
;	is useful as different cameras and dispersions will be released at
;	different times.  Once all data has been release, this procedure will
;	no longer be necessary.
;
;*CALLING SEQUENCE:
;
;	CURESTR,MAIN,FLAG
;
;*PARAMETERS:
;
;	MAIN	(REQ) (I) (1) (S)
;		The main fits header (may include the vicar label and fits
;		history portion).
;
;	FLAG	(REQ) (O) (0) (I)
;		Set to 1 is image is of a supported camera and dispersion.
;		Set to 0 is image is not of a supported camera or dispersion.
;
;*EXAMPLES:
;
;	iuefhrd,filename,params,main,/silent,/full
;	curestr,main,flag
;
;*SYSTEM VARIABLES USED:
;
;	none
;
;*INTERACTIVE INPUT:
;
;	none
;
;*SUBROUTINES CALLED:
;
;	PARCHECK
;	STPAR
;
;*FILES USED:
;
;	none
;
;*SIDE EFFECTS:
;
;	none
;
;*RESTRICTIONS:
;
;	Must be updated as different cameras and dispersion become available.
;
;*NOTES:
;
;
;*PROCEDURE:
;
;	Uses STPAR to obtain the CAMERA and FILENAME keywords.  The dispersion
;	is obtained from the extension given in the FILENAME keyword.  The
;	CAMERA keyword value and dispersion are checked.  If acceptable, then
;	flag = 1, else flag = 0.
;
;*I_HELP  nn:
;
;*MODIFICATION HISTORY:
;
;	 3 Jun 93  PJL  wrote
;        6 Sep 94  RWT  set flag for LWP low dispersion data
;-
;******************************************************************************
 pro curestr,main,flag
;
 npar = n_params(0)
 if (npar eq 0) then begin
    print,'CURESTR,MAIN,FLAG'
    retall
 endif  ; npar eq 0
 parcheck,npar,2,'CURESTR'
;
;  set flag
;
 flag = 0
;
;  extract camera from fits header
;
 stpar,main,'camera',camera,err
;
 if (err ne 0) then begin
    print,'Error in extracting camera from fits header.'
    print,'ACTION:  Returning'
    return
 endif  ; err ne 0
;
;  extract filename from fits header
;
 stpar,main,'filename',name,err
;
 if (err ne 0) then begin
    print,'Error in extracting filename from fits header.'
    print,'Unable to determine file type.'
    print,'ACTION:  Returning'
    return
 endif  ; err ne 0
;
;  extract file type from filename
;
 pdpos = strpos(name,'.')
 if (pdpos lt 0) then begin
    print,'Error in fits keyword entry for filename.'
    print,'ACTION:  Returning'
    return
 endif  ; pdpos lt 0
 type = strlowcase(strmid(name,pdpos+1,4))
;
;  check camera - only SWP acceptable - for now
;
 case (strtrim(camera,2)) of
    'LWP':  begin
               if (strmid(type,2,2) eq 'hi') then begin
                  print,'File is supposedly a LWP high dispersion image.'
                  print,'Currently untested for LWP high dispersion images.'
                  print,'ACTION:  Returning.'
               endif else flag = 1
            end  ; 'LWP'
    'LWR':  begin
               print,'File is supposedly a LWR image.'
               print,'Currently untested for LWR camera.'
               print,'ACTION:  Returning.'
            end  ; 'LWR'
    'SWP':  begin
               if (strmid(type,2,2) eq 'hi') then begin
                  print,'File is supposedly a SWP high dispersion image.'
                  print,'Currently untested for SWP high dispersion images.'
                  print,'ACTION:  Returning.'
               endif else flag = 1
            end  ; 'SWP'
    'SWR':  begin
               print,'File is supposedly a SWR image.'
               print,'Currently untested for SWR camera.'
               print,'ACTION:  Returning.'
            end  ; 'SWR'
    else:  begin
              print,'Not a valid camera.'
              print,'ACTION:  Returning.'
           end  ; else
 endcase  ; strtrim(camera,2)
;
 return
 end  ; curestr