	program rereweight
c
c	redetermine weights for observations in grading.orb8,  
c	based on relative observer weights
c
	character*21 data1
	character*3  code,dd1,code1(200),code2(200)
	character*2  dd2
	character*86 data2
	character*1  c62
	dimension    wt2(200)
c
	open( 9,file='observer.weight',status='UNKNOWN')
	open(10,file='grading.orb8',status='UNKNOWN')
	open(11,file='grading.orb9',status='UNKNOWN')
c
c	read in observer weights
c
c	(set mean visual weight to ~1)
	wmean=3. 
	nobs=169
	do 100 n=1,nobs
	read(9,901) code1(n),code2(n),wt2(n)
  901	format(t3,a3,t8,a3,t56,f8.1)
  100	continue
c
  200	read(10,902,end=999) data1,code,data2,enn,dd1,dd2,tel,
     $     c62,c63,c64,rho,wt1
  902	format(a21,a3,a86,t34,f2.0,a3,a2,f2.0,3a1,t58,f8.4,t111,f6.1)
c
c	determine additional observer codes
c
	if (code .eq. 'VS ') code='VIS'
	if (code .eq. 'VL ') code='VIS'
	if  (c62 .eq. 'E') code='XVI'
	if ((c62 .eq. 'G') .or. (c62 .eq. 'H')) code='VPH'
	if  (c62 .eq. 'O') code='VPH'
	if (dd1 .eq. 'MKT') code='XSP'
	if (dd1 .eq. 'NOI') code='XSP'
c	
	iobs=0
	do 300 n=1,nobs
  300	if ((code .eq. code1(n)) .and.  dd1 .eq. code2(n)) iobs=n
	if ((code .eq. 'VIS'     .and. iobs .eq. 0))       iobs=1
	if ((code .eq. 'VPH'     .and. iobs .eq. 0))       iobs=2
	if ((code .eq. 'XSP'     .and. iobs .eq. 0))       iobs=3
	if ((code .eq. 'XVI'     .and. iobs .eq. 0))       iobs=4
	if ((code .eq. 'CSP'     .and. iobs .eq. 0))       iobs=142
c
	wt=wt1*wt2(iobs)/wmean
	if ((wt .lt.  0.1) .and. (wt1 .gt. 0.0)) wt= 0.1
	if  (wt .gt. 99.9) wt=99.9
	write(11,903) data1,code,data2,wt1,wt2(iobs),wt
  903	format(a21,a3,a86,3f6.1)
c
  	go to 200
  999	stop
  	end
