      program lagApotau6st
C..............................................................June 2023
C Input: Apotau6.txt
C Extract Cat-storms peaks with Apo(tau6) >= 100 nt
C
C
      CHARACTER*64 infile,outfile
	CHARACTER*2 AMN,ADY,AUT
C	CHARACTER*4 AYEAR
C
C	
	infile='Apotau6.txt'                ! read(10
	outfile='Catapotau6st.txt'			   !
   30	format(1X,F8.3,1X,I3,3(1X,A2),2X,F7.2,1X,I4)
   31	format(1X,F9.4,3(1X,I2),2X,F5.0,2X,F6.2)
C
       OPEN(10,file=infile,action='READ')
       OPEN(14,file=outfile,access='APPEND')
C
C
C
	ndy=0	!norm
C
C++        DO iyear=1994,2023  ! years
C 
C Apo(tau6)
C    1	read(10,31,end=50) ryear,imn,idy,iut,apo,aptau
    1	read(10,*,end=50) ryear,imn,idy,iut,apo,aptau
C-  101	continue
	iyear=int(ryear)
	iyr=iyear-iyear/100*100
	aptaumax=0.
	lda=ndoy(iyr,imn,idy)
C
	IF (aptau.ge.100.) THEN
	call blet2(imn,AMN)
	call blet2(idy,ADY)
	call blet2(iut,AUT)
C
C Output
      ndy=ndy+1
      write(*,30) ryear,lda,amn,ady,aut,aptau,ndy
	write(14,30) ryear,lda,amn,ady,aut,aptau,ndy
	goto 1
	                        ELSE
	goto 1
       ENDIF
C
C
   50	close(10)
C
   	close(unit=14)
	pause ' '
	STOP
	END