      program catpcheff10
C.....................................................Dec 2019
C Count number of moderate and intense Wp storms Mar 2011-Sep 2019
C
	CHARACTER*45 infile,outfile
   30	format(A50)
   31	format(39X,I4)
   32 format(3X,I2,5X,I2,2(1X,I2),1X,F4.1)
   33 format(1X,4(1X,I4))  ! out
   34 format(6X,24(1X,F4.1))  ! Vsigma
C   35 format(24X,F4.1)     !Wp
   35 format(24X,F4.0)     !HSS~ Vsw
   36 format(1X,I4,A1)
C   37 format(36X,F4.0)	 ! AE
   37 format(35X,F4.0)	 ! DST
   38 format(16X,F3.0) ! ap,aa
C   39 format(6X,8(1X,F5.1))  ! ap(tau)
   39 format(23X,F5.1)  ! ARn, ARp, ANn, ANp
C      infile='whstrms4o2011.txt'
c      infile='AEstorm2011.txt'
C      infile='aastrm.txt'
C      infile='apstrm.txt'
C      infile='cnthss50.res'
c      infile='dststorm30.txt'
c      infile='catARn.txt'
c      infile='catARp.txt'
c      infile='catANn.txt'
      infile='catANp.txt'
C 304 events
c	th0=4.5	 !Wp
c	th1=5.2	 !Wp
c	th2=6.4	 !Wp
c	th0=777.	 !AE
c	th1=963.	 !AE
c	th2=1274.	 !AE
c	th0=58.	 !aa
c	th1=83.	 !aa
c	th2=133.	 !aa
c	th0=30.	 !ap
c	th1=49.	 !ap
c	th2=96.	!ap
c	th0=563.	 !HSS-50~ Vsw
c	th1=600.	 !HSS-50~ Vsw
c	th2=654.	!HSS-50~ Vsw
c	th0=30.	 !|Dst|
c	th1=50.	 !|Dst|
c	th2=100.	! |Dst|
c	th0=19.8	 !ARn
c	th1=28.5	 !ARn
c	th2=46.8	! ARn
c	th0=28.9	 !ARp
c	th1=33.0	 !ARp
c	th2=39.4	! ARp
c	th0=27.7	 !ANn
c	th1=36.8	 !ANn
c	th2=54.2	! ANn
c	th0=33.6	 !ANp
c	th1=39.9	 !ANp
c	th2=50.2	! ANp
C
C 272 events
c	th0=4.5	 !Wp 
c	th1=5.1	 !Wp
c	th2=6.3	 !Wp
c	th0=768.	 !AE
c	th1=955.	 !AE
c	th2=1284.	 !AE
c	th0=58.	 !aa
c	th1=85.	 !aa
c	th2=143.	 !aa
c	th0=30.	 !ap
c	th1=49.	 !ap
c	th2=97.	!ap
c	th0=569.	 !HSS-50~ Vsw
c	th1=612.	 !HSS-50~ Vsw
c	th2=677.	!HSS-50~ Vsw
c	th0=30.	 !|Dst|
c	th1=50.	 !|Dst|
c	th2=100.	! |Dst|
c	th0=19.1	 !ARn
c	th1=26.6	 !ARn
c	th2=41.6	! ARn
c	th0=28.7	 !ARp
c	th1=32.5	 !ARp
c	th2=38.4	! ARp
c	th0=26.8	 !ANn
c	th1=34.4	 !ANn
c	th2=48.3	! ANn
	th0=33.6	 !ANp
	th1=40.1	 !ANp
	th2=51.1	! ANp
	outfile='catpcheff10-.res'
	OPEN(10,file=infile,action='READ')
	OPEN(11,file=outfile,access='APPEND')
	icntd=0	   ! th0:th1
	icntm=0	   ! th1:th2
	icnti=0	   ! >th2
	icntot=0
c    1	read(10,35,end=40) wp !Wp, HSS
c    1	read(10,37,end=40) wp	   !AE,Dst
c      wp=-wp               ! |Dst|
c    1	read(10,38,end=40) wp	   !aa,ap
    1	read(10,39,end=40) wp	   !! ARn, ARp, ANn, ANp
      icntot=icntot+1
	if ((wp.ge.th0).and.(wp.lt.th1)) then
	icntd=icntd+1
	endif
	if ((wp.ge.th1).and.(wp.lt.th2)) then
	icntm=icntm+1
	endif
	if (wp.ge.th2) then
	icnti=icnti+1
	endif
	goto 1
   40 close(unit=10)
C
	write(*,*) infile
	write(11,*) infile
	write(*,33) icntd,icntm,icnti,icntot
	write(11,33) icntd,icntm,icnti,icntot
	close(unit=11)
	pause ' '
	STOP
	END
