Viewing contents of file '../idllib/iuedac/iuelib/pro/atrd.pro'
;****************************************************************************
;+
;*NAME:
;
; ATRD
;
;*PURPOSE:
;
; To convert FITS ASCII table entries to correct data types
;
;*CALLING SEQUENCE:
;
; ATRD,BYTE_EQ,TYPE,VARIABLE
;
;*PARAMETERS:
;
; BYTE_EQ (REQ) (I) (1) (B)
; The byte equivalent vector of the data variable to be converted.
; (BYTE_EQ must be a vector.)
;
; TYPE (REQ) (I) (0) (S)
; Data type of VARIABLE described as a single character. Allowed
; data types are: integer 'I', floating point 'E' or 'F', double
; precision 'D', and string 'A'.
;
; VARIABLE (REQ) (O) (01) (BILFD)
; Converted output vector.
;
;*SIDE EFFECTS:
;
;*SYSTEM VARIABLES USED:
;
;
;*SUBROUTINES CALLED:
;
; PARCHECK
;
;*EXAMPLE:
;
;*RESTRICTIONS:
;
;*NOTES:
;
; Data types are based on those allowed in the TFORM FITS keyword.
; One element output vectors are converted to scalars.
;
; tested with IDL Version 2.1.2 (sunos sparc) 08 Nov 91
; tested with IDL Version 2.3.2 (vax vms) 19 Oct 92
; tested with IDL Version 2.1.2 (ultrix mipsel) 08 Nov 91
; tested with IDL Version 2.2.0 (ultrix vax) 08 Nov 91
;
;*MODIFICATION HISTORY:
;
; Randy Thompson 2/8/91 (based on FITSCON)
;-
;****************************************************************************
pro atrd,byte_eq,type,variable
;
if n_params(0) eq 0 then begin
print,'PRO ATRD,BYTE_EQ,TYPE,VARIABLE'
retall
endif ; n_params(0)
parcheck,n_params(0),3,'ATRD'
;
tmpv = string(byte_eq)
byte_elems = n_elements(tmpv)
var_type = strupcase(type)
;
case var_type of
'I': begin ; integer
variable = fix(tmpv)
return
endcase ; I
'E': begin ; floating point
variable = float(tmpv)
return
endcase ; E
'F': begin ; floating point
variable = float(tmpv)
return
endcase ; F
'D': begin ; double precision
variable = double(tmpv)
return
endcase ; D
'A': begin ; string
variable = tmpv
return
endcase ; A
else: begin ; unknown
print,'Data type',var_type,' unknown, routine FITSCON'
retall
endelse
endcase ; var_type
return
end ; atrd