pro rd_pointing1,filin,pointid,npoint,rmspnt,good,worst
; reads ascii file filin and returns pointing data arrays. 
; Also computes worst rms entry for each pointing, and returns
; this value in array worst.

nmax=5000               ; max number of pointings
f1='(a8,2x,i1,2x,5i4,2x,5f8.4)'

openr,iun,filin,/get_lun
ss=''
readf,iun,ss
readf,iun,ss
readf,iun,ss

pointid=strarr(nmax)
npoint=lonarr(5,nmax)
rmspnt=fltarr(5,nmax)
good=lonarr(nmax)

i=0
while(not eof(iun)) do begin
  readf,iun,ss,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,format=f1
  pointid(i)=strtrim(ss,2)
  npoint(*,i)=long([v2,v3,v4,v5,v6]) 
  rmspnt(*,i)=[v7,v8,v9,v10,v11]
  i=i+1
endwhile

pointid=pointid(0:i-1)
npoint=npoint(*,0:i-1)
rmspnt=rmspnt(*,0:i-1)
good=good(0:i-1)

close,iun
free_lun,iun

worst=fltarr(i)
for j=0,i-1 do begin
  worst(j)=max(rmspnt(*,j))
endfor

end