      program cntzero
C.................................................................Dec 2020
C count 0 VL35, VU35, VE35 for 1994-2020 (quiet monthly % conditions)
C glon=35 deg (or globel WL35, WU35, WE35 for 1994-2020)
C
      DIMENSION IM(12),iwneg(0:23),iwpos(0:23),iwran(0:23)
     +,icpos(12),icneg(12),icran(12),icmon(12)
      CHARACTER*128 INFILEN,INFILEP,INFILER,outfile
	CHARACTER*4 AYEAR
	CHARACTER*2 AYR,AMN,CYR
	DATA IM/31,28,31,30,31,30,31,31,30,31,30,31/
c
      infilen='d:\web\grif\datw\vlnYY35.txt'   !  Cnt(W-) 	 WL
      infilep='d:\web\grif\datw\vupYY35.txt'   !  Cnt(W+) 	 WU
      infiler='d:\web\grif\datw\verYY35.txt'   !  Cnt(Wrange) WE
	outfile='cntzero35.txt'
	OPEN(10,file=outfile)
C
C Yearly cycle
C
      DO 40 iyear=1994,2020
	call blet4(iyear,AYEAR)
      AYR=AYEAR(3:4)
	read(AYR,*) ryr
	iyr=int(ryr)
	if(int(ryr/4.)*4.eq.iyr) THEN 
 	im(2)=29
	ndyr=366
	                          ELSE
	im(2)=28
	ndyr=365
	ENDIF
	del=1./12.
	infilep(21:22)=ayr
	infilen(21:22)=ayr
	infiler(21:22)=ayr
	OPEN(11,file=infilep,action='READ')
	OPEN(12,file=infilen,action='READ')
	OPEN(13,file=infiler,action='READ')
C	read(11,*) txt ! title line
C	read(12,*) txt ! title line
C	read(13,*) txt ! title line
C
C
      do ii=1,12
	icmon(ii)=0  ! number of hours/month
      icpos(ii)=0
	icneg(ii)=0
	icran(ii)=0
	enddo
C
C       DO 41 imn=1,12
C	call blet2(imn,AMN)
C
C  day-to-day cycle
C
       DO 41 lda=1,ndyr
C       ndnr=im(imn)
C
C Daily cycle
C
   33 format(A2,2I2,24(1X,I4))
C-      do 42 idy=1,ndnr
C-	call blet2(idy,ADY)
C
      read(11,33,end=51) CYR,IMN,IDY,iwpos
	icmon(imn)=icmon(imn)+24
	do k=0,23
	if (iwpos(k).eq.0) then
	icpos(imn)=icpos(imn)+1
	endif
	enddo
C
      read(12,33,end=52) CYR,IMN,IDY,iwneg
	do k=0,23
	if (iwneg(k).eq.0) then
	icneg(imn)=icneg(imn)+1
	endif
	enddo
C
      read(13,33,end=53) CYR,IMN,IDY,iwran
	do k=0,23
	if (iwran(k).eq.0) then
	icran(imn)=icran(imn)+1
	endif
	enddo
C   42 CONTINUE ! end daily cycle
   41 CONTINUE ! end dayly cycle
   51 close(unit=11)
   52 close(unit=12)
   53 close(unit=13)
C
C Output:
      do imn=1,12
	call blet2(imn,AMN)
       ryear=float(iyear)+del*float(imn-1)
      pneg=float(icneg(imn))/icmon(imn)*100.
	ppos=float(icpos(imn))/icmon(imn)*100.
	pran=float(icran(imn))/icmon(imn)*100.
	write(*,34) ryear,ppos,pneg,pran
	write(10,34) ryear,ppos,pneg,pran
	enddo 
   34 format(1X,F8.3,3(1X,F6.2))
   40 CONTINUE ! end annual cycle
      close(unit=10)
	pause ' '
	STOP
	END



