Viewing contents of file '../idllib/iuedac/iuelib/pro/delpar.pro'
;******************************************************************
;+
;*NAME:
;
; DELPAR
;
;*PURPOSE:
;
; Procedure to delete a keyword parameter(s) from a FITS header
;
;*CALLING SEQUENCE:
;
; DELPAR,H,PARNAME
;
;*PARAMETERS:
;
; H (REQ) (IO) (1) (S)
; - Fits header
;
; PARNAME (REQ) (I) (01) (S)
; - string or string array of keyword name(s) to delete
;
;*SUBROUTINES CALLED:
;
; PARCHECK
;
;*NOTES:
;
; tested with Idl Version 2.1.0 (sunos sparc) 7 Aug 91
; tested with Idl Version 2.1.0 (vms vax) 7 Aug 91
;
;*MODIFICATION HISTORY:
;
; version 1 D. Lindler Feb. 1987
; 9/17/90 RWT rename DELPAR and modify prolog
; 27 Mar 1990 PJL modified for unix/sun; added PARCHECK;
; strings for header must be declared as 80 bytes
;
;-
;******************************************************************
pro delpar,h,parname
;
npar = n_params(0)
if npar eq 0 then begin
print,'DELPAR,H,PARNAME'
retall
endif ; npar
parcheck,npar,2,'DELPAR'
;
; convert parameters to string array of upper case names of length 8 char
;
s = size(parname)
ndim = s(0)
type = s(ndim+1)
if type ne 7 then begin
print,'delpar-- keyword name(s) must a string or string array'
retall
endif ; type
if ndim eq 0 then num = 1 else num = n_elements(parname)
par = strarr(num)
if ndim eq 0 then begin
tmppar = string(bytarr(8) + 32b)
strput,tmppar,strupcase(parname)
par(0) = tmppar
endif else begin
for i=0,num-1 do begin
tmppar = string(bytarr(8) + 32b)
strput,tmppar,strupcase(parname(i))
par(i) = tmppar
endfor ; i
endelse ; ndim
;
s = size(h)
ndim = s(0)
type = s(ndim+1)
if (ndim ne 1) or (type ne 7) then begin
print,'delpar-- FITS header (1st parameter) must be a string array'
retall
endif ; ndim or type
nlines = s(1) ; number of lines in header array
pos = 0 ; position in compressed header with keywords removed
;
; loop on header lines
;
for i=0,nlines-1 do begin
keyword = strmid(h(i),0,8)
for j=0,num-1 do if keyword eq par(j) then goto,delete ;delete it?
h(pos) = h(i) ; keep it
pos = pos+1 ; increment number of lines kept
if keyword eq 'END ' then goto,done ; end of header
delete:
endfor ; i
;
;
done:
h=h(0:pos-1) ; truncate
return
end ; delpar