/usr/share/gnudatalanguage/astrolib/ftdelrow.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | pro ftdelrow,h,tab,rows
;+
; NAME:
; FTDELROW
; PURPOSE:
; Delete a row of data from a FITS table
;
; CALLING SEQUENCE:
; ftdelrow, h, tab, rows
;
; INPUTS-OUPUTS
; h,tab - FITS table header and data array. H and TAB will
; be updated on output with the specified row(s) deleted.
; rows - scalar or vector, specifying the row numbers to delete
; This vector will be sorted and duplicates removed by FTDELROW
;
; EXAMPLE:
; Compress a table to include only non-negative flux values
;
; flux = FTGET(h,tab,'FLUX') ;Obtain original flux vector
; bad = where(flux lt 0) ;Find negative fluxes
; FTDELROW,h,tab,bad ;Delete rows with negative fluxes
;
; PROCEDURE:
; Specified rows are deleted from the data array, TAB. The NAXIS2
; keyword in the header is updated.
;
; PROCEDURES USED:
; sxaddpar
;
; REVISION HISTORY:
; Written W. Landsman STX Co. August, 1988
; Checked for IDL Version 2, J. Isensee, July, 1990
; Converted to IDL V5.0 W. Landsman September 1997
; Assume since V5.4, use BREAK instead of GOTO W. Landsman April 2006
;
;-
On_error,2
if N_params() LT 3 then begin
print,'Syntax - ftdelrow,h,tab,rows'
return
endif
nrows = sxpar(h,'NAXIS2') ;Original number of rows
if (max(rows) GE nrows) or (min(rows) LT 0) then $
message,'Specified rows must be between 0 and ' + strtrim(nrows-1,2)
ndel = N_elements(rows)
if ndel GT 1 then begin
rows = rows[rem_dup(rows)] ;Sort and remove duplicate values
ndel = N_elements(rows)
endif
j = 0L
i = rows[0]
for k = long(rows[0]),nrows-1 do begin
if k EQ rows[j] then begin
j = j+1
if j EQ ndel then BREAK
endif else begin
tab[0,i] = tab[*,k]
i = i+1
endelse
endfor
k = k-1
if k NE nrows-1 then tab[0,i] = tab[*,i+j:nrows-1]
tab = tab[*,0:nrows-ndel-1]
sxaddpar,h,'NAXIS2',nrows-ndel ;Reduce number of rows
return
end
|