
           Program snowtotal
           Integer i,j,nx,ny
           Parameter(nx=80000,ny=2)
           Real day(nx),rain(nx),dmax(nx)
           Integer jday(nx),hr(nx),mn(nx),iyr(nx)
           Character*1 ff
           Character*55 infile,outfile,outfile2
           Character*55 outfile3,outfile6

           open(10,file='filesnowtotal',status='unknown')

           do ii=1,ny
           read(10,40)infile,outfile,outfile2,outfile3,
     *     outfile6
 40        format(a35,1x,a27,1x,a34,1xa34,1x,a34)

           open(11,file=infile,status='unknown')
           open(20,file=outfile,status='unknown')
           open(21,file=outfile2,status='unknown')
           open(22,file=outfile3,status='unknown')
           open(23,file=outfile6,status='unknown')

           total=0.
           rainmax=0.
           ikk=0
           raint=0.
           rtotal=0.
           revent=0.
           dmx=0.
           ff=':'

           timegap=60./(60.*24.)
           timegap2=60.*2./(60.*24.)
           timegap3=60.*3./(60.*24.)
           timegap6=60.*6./(60.*24.)

           i023=0
           r023=0.
           i053=0
           s023=0.
           i063=0
           s063=0.
           s070=0.
           i070=0
           i073=0
           s073=0.
           i089=0
           s089=0.
            
           k1=1
           do i=1,nx
           read(11,*,err=999,end=999)iyr(k1),jday(k1),hr(k1),mn(k1),
     *     temp,ztot,con,rain(k1),dmass,dmax(k1)
           thr=float(hr(k1))+float(mn(k1))/60.
           day(k1)=float(jday(k1))+thr/24.
           rtotal=rtotal+rain(k1)/60.

c          023

           if(jday(k1).eq.23 .and. hr(k1).ge.18)i023=i023+1
           if(jday(k1).eq.23 .and. hr(k1).ge.18)r023=r023+rain(k1)/60.
           if(jday(k1).eq.23 .and. hr(k1).eq.17)then
c          if(mn(k1).ge.10)i023=i023+1
c          if(mn(k1).ge.10)r023=r023+rain(k1)/60.
           if(mn(k1).ge.15)i023=i023+1
           if(mn(k1).ge.15)r023=r023+rain(k1)/60.
           endif

c          053

           if(jday(k1).eq.53 .and. hr(k1).ge.21)i053=i053+1
           if(jday(k1).eq.53 .and. hr(k1).ge.21)s053=s053+rain(k1)/60.
           if(jday(k1).eq.54 .and. hr(k1).eq.0)then
           if(mn(k1).lt.34)i053=i053+1
           if(mn(k1).lt.34)s053=s053+rain(k1)/60.
c          if(mn(k1).lt.30)i053=i053+1
c          if(mn(k1).lt.30)s053=s053+rain(k1)/60.
           endif

c          063

           if(jday(k1).eq.63 .and. hr(k1).le.5)i063=i063+1
           if(jday(k1).eq.63 .and. hr(k1).le.5)s063=s063+rain(k1)/60.
           if(jday(k1).eq.63 .and. hr(k1).eq.6)then
c          if(mn(k1).lt.15)i063=i063+1
c          if(mn(k1).lt.15)s063=s063+rain(k1)/60.
           if(mn(k1).lt.5)i063=i063+1
           if(mn(k1).lt.5)s063=s063+rain(k1)/60.
           endif

c          070

c          if(jday(k1).eq.70 .and. hr(k1).ge.7)i070=i070+1
c          if(jday(k1).eq.70 .and. hr(k1).ge.7)s070=s070+rain(k1)/60.
           if(jday(k1).eq.70 .and. hr(k1).ge.12)i070=i070+1
           if(jday(k1).eq.70 .and. hr(k1).ge.12)s070=s070+rain(k1)/60.
           if(jday(k1).eq.70 .and. hr(k1).eq.6)then
c          if(mn(k1).ge.35)i070=i070+1
c          if(mn(k1).ge.35)s070=s070+rain(k1)/60.
           endif

c          073

           if(jday(k1).eq.74 .and. hr(k1).le.14)i073=i073+1
           if(jday(k1).eq.74 .and. hr(k1).le.14)s073=s073+rain(k1)/60.
           if(jday(k1).eq.73 .and. hr(k1).ge.19)i073=i073+1
           if(jday(k1).eq.73 .and. hr(k1).ge.19)s073=s073+rain(k1)/60.
c          if(jday(k1).eq.73 .and. hr(k1).ge.18)i073=i073+1
c          if(jday(k1).eq.73 .and. hr(k1).ge.18)s073=s073+rain(k1)/60.
           if(jday(k1).eq.73 .and. hr(k1).eq.18)then
c          if(jday(k1).eq.73 .and. hr(k1).eq.17)then
           if(mn(k1).ge.42)i073=i073+1
           if(mn(k1).ge.42)s073=s073+rain(k1)/60.
c          if(mn(k1).ge.28)i073=i073+1
c          if(mn(k1).ge.28)s073=s073+rain(k1)/60.
           endif

c          089

           if(jday(k1).eq.89 .and. hr(k1).ge.6)i089=i089+1
           if(jday(k1).eq.89 .and. hr(k1).ge.6)s089=s089+rain(k1)/60.
           if(jday(k1).eq.89 .and. hr(k1).eq.5)then
c          if(mn(k1).ge.16)i089=i089+1
c          if(mn(k1).ge.16)s089=s089+rain(k1)/60.
           if(mn(k1).ge.14)i089=i089+1
           if(mn(k1).ge.14)s089=s089+rain(k1)/60.
           endif

           k1=k1+1
 999       enddo
           k1=k1-1

           print*,r023,i023
           print*,s053,i053
           print*,s063,i063
           print*,s070,i070
           print*,s073,i073
           print*,s089,i089

           print*,k1
           ik=1

           isave=iyr(1)
           jsave=jday(1)
           jhr=hr(1)
           jmn=mn(1)
           total=rain(1)/60.
           do i=2,k1
           tday=day(i-1)+timegap
           if(day(i) .le. tday .and. iyr(i).eq.iyr(i-1))then
           total=total + rain(i)/60.
           ik=ik+1
           if(rain(i).gt.rainmax)rainmax=rain(i)
           if(dmax(i).gt.dmx)dmx=dmax(i)
           if(i.eq.k1 .and.ik.ge.3 .and. total .ge.0.1)then
           write(20,22)isave,jsave,jhr,ff,jmn,jday(i),hr(i),ff,
     *     mn(i),ik,rainmax,total,dmx
           endif
           else
           if(ik.ge.3 .and. total.ge.0.1)then
           write(20,22)isave,jsave,jhr,ff,jmn,jday(i-1),hr(i-1),ff,
     *     mn(i-1),ik,rainmax,total,dmx
           ikk=ikk+ik
           revent=revent+1.
           raint=raint+total
 22        format(2i5,i5.2,a1,i2.2,i5,i5.2,a1,i2.2,i5,
     *     f8.1,f8.2,f8.3)
           endif
           rainmax=0.
           dmx=0.
           ik=1
           total=rain(i)/60.
           jsave=jday(i)
           isave=iyr(i)
           jhr=hr(i)
           jmn=mn(i)
           endif
           enddo

c          time gap 2 hours

           isave=iyr(1)
           jsave=jday(1)
           jhr=hr(1)
           jmn=mn(1)
           total=rain(1)/60.
           do i=2,k1
           tday=day(i-1)+timegap2
           if(day(i) .le. tday .and. iyr(i).eq.iyr(i-1))then
           total=total + rain(i)/60.
           ik=ik+1
           if(rain(i).gt.rainmax)rainmax=rain(i)
           if(dmax(i).gt.dmx)dmx=dmax(i)
           if(i.eq.k1 .and.ik.ge.3 .and. total .ge.2.0)then
           write(21,22)isave,jsave,jhr,ff,jmn,jday(i),hr(i),ff,
     *     mn(i),ik,rainmax,total,dmx
           endif
           else
           if(ik.ge.3 .and. total.ge.2.0)then
           write(21,22)isave,jsave,jhr,ff,jmn,jday(i-1),hr(i-1),ff,
     *     mn(i-1),ik,rainmax,total,dmx
           ikk=ikk+ik
           revent=revent+1.
           raint=raint+total
           endif
           rainmax=0.
           dmx=0.
           ik=1
           total=rain(i)/60.
           jsave=jday(i)
           isave=iyr(i)
           jhr=hr(i)
           jmn=mn(i)
           endif
           enddo

c          time gap 3 hours

           isave=iyr(1)
           jsave=jday(1)
           jhr=hr(1)
           jmn=mn(1)
           total=rain(1)/60.
           do i=2,k1
           tday=day(i-1)+timegap3
           if(day(i) .le. tday .and. iyr(i).eq.iyr(i-1))then
           total=total + rain(i)/60.
           ik=ik+1
           if(rain(i).gt.rainmax)rainmax=rain(i)
           if(dmax(i).gt.dmx)dmx=dmax(i)
           if(i.eq.k1 .and.ik.ge.3 .and. total .ge.2.0)then
           write(22,22)isave,jsave,jhr,ff,jmn,jday(i),hr(i),ff,
     *     mn(i),ik,rainmax,total,dmx
           endif
           else
           if(ik.ge.3 .and. total.ge.2.0)then
           write(22,22)isave,jsave,jhr,ff,jmn,jday(i-1),hr(i-1),ff,
     *     mn(i-1),ik,rainmax,total,dmx
           ikk=ikk+ik
           revent=revent+1.
           raint=raint+total
           endif
           rainmax=0.
           dmx=0.
           ik=1
           total=rain(i)/60.
           jsave=jday(i)
           isave=iyr(i)
           jhr=hr(i)
           jmn=mn(i)
           endif
           enddo
   
c          time gap 6 hours

           isave=iyr(1)
           jsave=jday(1)
           jhr=hr(1)
           jmn=mn(1)
           total=rain(1)/60.
           do i=2,k1
           tday=day(i-1)+timegap6
           if(day(i) .le. tday .and. iyr(i).eq.iyr(i-1))then
           total=total + rain(i)/60.
           ik=ik+1
           if(rain(i).gt.rainmax)rainmax=rain(i)
           if(dmax(i).gt.dmx)dmx=dmax(i)
           if(i.eq.k1 .and.ik.ge.3 .and. total .ge.2.0)then
           write(23,22)isave,jsave,jhr,ff,jmn,jday(i),hr(i),ff,
     *     mn(i),ik,rainmax,total,dmx
           endif
           else
           if(ik.ge.3 .and. total.ge.2.0)then
           write(23,22)isave,jsave,jhr,ff,jmn,jday(i-1),hr(i-1),ff,
     *     mn(i-1),ik,rainmax,total,dmx
           ikk=ikk+ik
           revent=revent+1.
           raint=raint+total
           endif
           rainmax=0.
           dmx=0.
           ik=1
           total=rain(i)/60.
           jsave=jday(i)
           isave=iyr(i)
           jhr=hr(i)
           jmn=mn(i)
           endif
           enddo

           enddo

           stop
           end
