      program catseaswp
C.......................................................Dec. 2021
C
      CHARACTER*132 infhsswp,outfjan,outfjul,outfeqn
C
	      infhsswp='hsswuwlwe3.txt'
C
   31	format(A70,I4)
   32 format(A46,2(1X,I4))
   33	format(A70,I4,1X,I4)
		outfjan='cathsswpjan.txt'
	outfjul='cathsswpjul.txt'
	outfeqn='cathsswpeqn.txt'
	OPEN(11,file=outfjan)
	OPEN(12,file=outfjul)
	OPEN(13,file=outfeqn)
C
   29 format(1X,F8.3,1X,I3,2(1X,I2),1X,I3,1X,I4,1X,I3,2(1X,I4)	 ! Vsw
     +,1X,I3,1X,F4.1,9(1X,I3,1X,I4),2(1X,I3))						 ! WU, WL, WE
  138 format(1X,F8.3,1X,I3,2(1X,I2),1X,I3,1X,I4,1X,I3,2(1X,I4)	 ! Vsw
     +,1X,I3,1X,F4.1,9(1X,I3,1X,I4),1X,I4)						 ! WU, WL, WE
      icnjan=0
	icnjul=0
	icneqn=0
C read select JAN
      	open(10,file=infhsswp,action='READ')
	DO 177 iev=1,380	!HSS/Dst storm 1996-2021
      read(10,138,end=27) ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,ninp
C
      if ((imn1.eq.1).or.(imn1.eq.2).or.(imn1.eq.11).or.(imn1.eq.12)) 
	+then
	 icnjan=icnjan+1
	write(*,29)	ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,icnjan,ninp
      write(11,29) ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,icnjan,ninp
 	 goto 177
	endif
C
      if ((imn1.eq.3).or.(imn1.eq.4).or.(imn1.eq.9).or.(imn1.eq.10)) 
	+then
	 icneqn=icneqn+1
	write(*,29)	ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,icneqn,ninp
      write(13,29) ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,icneqn,ninp
	 goto 177
	endif
C
      if ((imn1.eq.5).or.(imn1.eq.6).or.(imn1.eq.7).or.(imn1.eq.8)) 
	+then
	 icnjul=icnjul+1
	write(*,29)	ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,icnjul,ninp
      write(12,29) ryear1,ldam,imn1,idy1,iutm,ivsmin,iutvs,ivsmax
	+,idel,iutwp,wpmax,iutun,iwumaxn,iutln,iwlminn,iuten,iwemaxn
     +,iutus,iwumaxs,iutls,iwlmins,iutes,iwemaxs
     +,iutug,iwumaxg,iutlg,iwlming,iuteg,iwemaxg,icnjul,ninp
	 goto 177
	endif
  177	CONTINUE
   27	close(10)
      close(11)
	close(12)
	close(13)
       pause	' '
	STOP
	 END
C


