	program wtbar
c
c	determines mean and rms weights for all observers and
c	methods, for observations used in new orbit grading
c
	character*3 method1,obs1,obs2,method(5)
	dimension en(5),wmean(5),wrms(5),rmean(5),rrms(5)
	data method/'VIS','VPH','XVI','XSP','CSP'/
c
	open(10,file='junk.all',status='UNKNOWN')
	open(11,file='wtbar.out',status='UNKNOWN')
c
	do 100 im=1,5
	en(im)=0.
	wmean(im)=0.
	wrms(im)=0.
	rmean(im)=0.
	rrms(im)=0.
  100	continue
c	
	read(10,901) rho,method1,wt,obs1
  901	format(t31,f10.4,t50,a3,f5.1,t64,a3)
	do 200 n=1,5
  200	if (method1 .eq. method(n)) im=n
	if (obs1 .eq. 'HIP') im=4
	if (obs1 .eq. 'TYC') im=4
	en(im)=1.
	wmean(im)=wt
	wrms(im)=wt*wt
	rmean(im)=rho
	rrms(im)=rho*rho
c
  300	read(10,901,end=800) rho,method1,wt,obs2
  	if (obs2 .ne. obs1) go to 500
	do 400 n=1,5
  400	if (method1 .eq. method(n)) im=n
	if (obs2 .eq. 'HIP') im=4
	if (obs2 .eq. 'TYC') im=4
	en(im)=en(im)+1.
	wmean(im)=wmean(im)+wt
	wrms(im)=wrms(im)+wt*wt
 	rmean(im)=rmean(im)+rho
	rrms(im)=rrms(im)+rho*rho
 	go to 300
c
  500	do 600 n=1,5
	if (en(n) .eq. 0.) go to 600
	wmean(n)=wmean(n)/en(n)
	wrms(n)=sqrt(wrms(n)/en(n))
	rmean(n)=rmean(n)/en(n)
	rrms(n)=sqrt(rrms(n)/en(n))
c	write(11,902) method(n),obs1,en(n),rmean(n),
c     $     rrms(n),wmean(n),wrms(n)
c  902	format(2x,a3,2x,a3,f10.0,2f10.3,2f10.2)
	write(11,902) method(n),obs1,en(n),rmean(n),
     $     wmean(n)
  902	format(2x,a3,2x,a3,f10.0,f10.3,f10.2)
  600	continue
c
	do 700 n=1,5
	en(n)=0.
	wmean(n)=0.
	wrms(n)=0.
   	if (method1 .eq. method(n)) im=n
  700	continue
	if (obs2 .eq. 'HIP') im=4
	if (obs2 .eq. 'TYC') im=4
	obs1=obs2
	en(im)=1.
 	rmean(im)=rho
	rrms(im)=rho*rho
	wmean(im)=wt
	wrms(im)=wt*wt
	go to 300
c
  800	do 900 n=1,5
	if (en(n) .eq. 0.) go to 900
	wmean(n)=wmean(n)/en(n)
	wrms(n)=sqrt(wrms(n)/en(n))
	rmean(n)=rmean(n)/en(n)
	rrms(n)=sqrt(rrms(n)/en(n))
c	write(11,902) method(n),obs1,en(n),rmean(n),
c     $     rrms(n),wmean(n),wrms(n)
	write(11,902) method(n),obs1,en(n),rmean(n),
     $     wmean(n)
  900	continue
c
  999	stop
  	end
