      program Vsw500
C...............................................Oct. 2019
C Extract days with Vsw >=500 km/s
C to select High Speed Streams, days
C
      character*50 infile,outfile,txt
      character*2 AMN,ADY,AUT
	character*4 AYEAR

	infile='d:\apkp\OMNI\swYEAR.txt'
	outfile='Vsw500.txt'	 ! 
C
   30	format(A50)
c2011 364  1   8.3  -0.5   12859.   4.9  406.
  31	format(I4,1X,I3,1X,I2,28X,F5.0)
	OPEN(11,file=outfile)
C
       icnt=0
        vswmin_pre=300.0
	vsout_pre=300.
      DO 44 iyear=2011,2019
	call blet4(iyear,AYEAR)
	infile(16:19)=AYEAR
	iyr=iyear-iyear/100*100
C
	OPEN(10,file=infile,action='READ')
C
	do i=1,13
	read(10,30) txt ! extra lines
	enddo
C
	ryear=float(iyear)
		if(int(ryear/4.)*4.eq.iyear) THEN 
	ndnr=366
	                          ELSE
	ndnr=365
	ENDIF
C
C day-to day cycle
C
	DO lda=1,ndnr		 !++++++++
	call submmdd(lda,iyr,imn,idy)
	call blet2(imn,AMN)
	call blet2(idy,ADY)
	vsmax=0.
        do iut=0,23		   !==========
	call blet2(iut,AUT)
	  read(10,31,end=50) kyear,kday,kut,vsw
	if (vsw.gt.999.9) vsw=vswmin_pre
	if (vsmax.lt.vsw) vsmax=vsw
	vswmin_pre=vsw
        enddo				  !==========
	if ((vsmax.ge.500.).and.(vsmax.gt.vsout_pre)) then
	icnt=icnt+1
	write(*,32) icnt,iyr,AMN,ADY,vsmax
	write(11,32) icnt,iyr,AMN,ADY,vsmax
	vsout_pre=vsmax
	                     else
      vsout_pre=vsmax
   32 format(1X,I4,1X,I2,2(1X,A2),1X,F6.0)
      endif

	ENDDO	   !++++++++
C
   50 close(unit=10)
   44 CONTINUE
       close(unit=11)
      pause ' '
	STOP
	END