	program histwtec234t
c .......................................................Mar 2021
C Histogram of annual occurrence WTEC = +-2, +-3, +-4 
C   relative total annual number of grids
C for 1994-2020
C
c
	DIMENSION pgrid(6),IM(12),per(6) !
      CHARACTER*4 AYEAR
	CHARACTER*64 infile,outfile
	CHARACTER*2 AYR,AMN,ADY,AUT
      DATA IM/31,28,31,30,31,30,31,31,30,31,30,31/
C
C
		  infile='histwtec2-3-4.res'
	OPEN(10,FILE=INFILE,ACTION='READ')
	outfile='histwtec234t.res'
	OPEN(11,FILE=outfile)
C
C
C	+++++++++++++++++++++++++++++++++
C+
c       
       DO	55 iyear=1994,2020
	ryear=float(iyear)
c
 	z1=iyear/4.0
      jz=int(z1)*4

      IF(jz.EQ.iyear) THEN
               IM(2)=29
	dnyr=366.
        ELSE
                IM(2)=28
	  dnyr=365.
	       ENDIF
	gmap=71.*72.
	grids=dnyr*24.*gmap
	read(10,37)	ayear,icnneg,icnpos,(per(k),k=1,6)

C  ===================================
      do i=1,3
	pgrid(i)=per(i)/float(icnneg)*grids
	enddo
      do i=4,6
	pgrid(i)=per(i)/float(icnpos)/*grids
	enddo

       write(*,38) ayear,(pgrid(k),k=1,6)
	write(11,38) ayear,(pgrid(k),k=1,6)
   55	CONTINUE !===========================     
C
   37	format(1X,A4,2(1X,I8),6(1X,F6.2))
   38	format(1X,A4,6(1X,F7.3))
C  %
c   
	CLOSE(unit=11)
	goto 900
    2 CONTINUE
           write(*,*) 'INPUT FILE IS NOT IN YOUR DIRECTORY '
  900 pause ' '
      STOP
      END

