      program extwpstmax
C...............................................Dec. 2018
C
C extract days of Wp-geom storms peaks 1994-2018
C
      character*50 infile,outfile
      character*2 AMN,ADY,AUT

	infile='tecstorm2.txt'
	outfile='wpstmax.txt'	 ! Wp peaks
	OPEN(10,file=infile,action='READ')
	OPEN(11,file=outfile)
   30 format(21X,I2,3(1X,I2),1X,F4.1)
C
      DO 44 ii=1,656
	read(10,30,end=50) iyr,iMN,iDY,iUT,wpst
      lda=ndoy(iyr,imn,idy)
	ryr=float(iyr)
		if(int(ryr/4.)*4.eq.iyr) THEN 
	dnr=366.
	                          ELSE
	dnr=365.
	ENDIF
      delyr=1./dnr
	if (iyr.gt.50) then 
	ryear=1900.0
	else
	ryear=2000.0
	endif
	ryear=ryear+ryr+(lda-1)*delyr
	call blet2(imn,AMN)
      call blet2(idy,ADY)
	call blet2(idy,AUT)
	write(*,31) ryear,AMN,ADY,AUT,wpst,ii
	write(11,31) ryear,AMN,ADY,AUT,wpst,ii
C
   44 CONTINUE
   50 close(unit=10)
       close(unit=11)
   31 format(1X,F8.3,3(1X,A2),1X,F4.1,1X,I4)
      pause ' '
	STOP
	END