      program cntpch
C...............................................Dec. 2018
C
C cnt delpch >0 delpch(i)=Pch(i)-Pch(i-1)
C to produce histogram of delpch >0
C
      character*50 infile,outfile
      character*2 AMN,ADY

	infile='pchdata.dat'
Crem	outfile='delpch.txt' ! only delpch >0
	outfile='delpch2.txt'	 ! all delpch +-
	OPEN(10,file=infile,action='READ')
	OPEN(11,file=outfile)
	nn=0
C
      pch_pre=276.61
      DO 44 ii=1,2832
	read(10,30,end=50) iyr,iMN,iDY,pch
C+	if (pch.le.pch_pre) then
C+      pch_pre=pch
C+	goto 44
C+	                                 else
      lda=ndoy(iyr,imn,idy)
	ryr=float(iyr)
		if(int(ryr/4.)*4.eq.iyr) THEN 
	dnr=366.
	                          ELSE
	dnr=365.
	ENDIF
      delyr=1./dnr
	ryear=2000.+ryr+(lda-1)*delyr
	call blet2(imn,AMN)
      call blet2(idy,ADY)
	delpch=pch-pch_pre
	nn=nn+1
C	write(*,31) ryear,AMN,ADY,delpch,nn
C      write(11,31) ryear,AMN,ADY,delpch,nn
	write(*,31) ryear,AMN,ADY,pch,delpch,nn
	write(11,31) ryear,AMN,ADY,pch,delpch,nn
	      pch_pre=pch
C+             endif
   44 CONTINUE
   50 close(unit=10)
       close(unit=11)
   30 format(1X,3I2,1X,F7.2)
C   31 format(1X,F8.3,2(1X,A2),1X,F7.2,1X,I4)
   31 format(1X,F8.3,2(1X,A2),2(1X,F7.2),1X,I4)
      pause ' '
	STOP
	END