      program extwcpiaeq2
C..Add peak Wc(pia)..for EQs at SSN0 (Kp0=1183, Kp3=609)...............June 2022
C Separate results for Wa(EQ) <0 and Wa(EQ) >0
C JPL Wc indices 
C Wc peak from 3-days (SSN = 0) =regional from 4 W indices: at dlati=2.5o, dlong=5o around EQ=Mmax
C Wc = combined  with weights from 4 W-indices surrounding EQ daily peak
C 
C 
C
      CHARACTER*64 outfile1,outfile2,infileq
	CHARACTER*2 AMN,ADY,AUT,AMM
C
C+      infileq='addeqwckp3.txt' ! Kp>3	 nn=699  1994-2020
C+	outfile1='addeqwckp3p.txt'
C+	outfile2='addeqwckp3n.txt'
      infileq='addeqwckp0.txt' ! Kp0	 nn=1273  1994-2020
	outfile1='addeqwckp0p.txt'
	outfile2='addeqwckp0n.txt'
C
       OPEN(11,file=infileq,action='READ')
       OPEN(12,file=outfile1)
	OPEN(13,file=outfile2)
C
	ndy1=0
	ndy2=0
C
C+	DO 41 iev=1,699	   ! kp3
	DO 41 iev=1,1273	   ! kp0
    	read(11,32,end=50) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
 	+,aeqmax,eqav,kk,knum,wpeq,jtw_pre,wc_pre,jtw_nex,wc_nex,ndy
C	IF (NDY.lt.294) GOTO 41  !TEMPPPPPPPPPPPPP
C
	if (wpeq.gt.0.0) then
C Output1
      ndy1=ndy1+1
      write(*,32) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
 	+,aeqmax,eqav,kk,knum,wpeq,jtw_pre,wc_pre,jtw_nex,wc_nex,ndy1

	write(12,32) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
 	+,aeqmax,eqav,kk,knum,wpeq,jtw_pre,wc_pre,jtw_nex,wc_nex,ndy1
	                   else
      ndy2=ndy2+1
      write(*,32) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
 	+,aeqmax,eqav,kk,knum,wpeq,jtw_pre,wc_pre,jtw_nex,wc_nex,ndy2

	write(13,32) ryear,lda,amn,ady,aut,amm,glats,glons,kmds
 	+,aeqmax,eqav,kk,knum,wpeq,jtw_pre,wc_pre,jtw_nex,wc_nex,ndy2
                      endif
C
   41 continue
   32 format(1X,F8.3,1X,I3,4(1X,A2),2(1X,F6.2),1X,I4,2(1X,F4.1)
     +,2(1X,I4),1X,F5.2,2(1X,I3,1X,F5.2),1X,I4)
   50	close(unit=11)
	close(unit=12)
	close(unit=13)
	pause ' '
	STOP
	END