      program jplwipnd
C..................................................................Aug. 2022
C..Add WU.WL.daily mean intensity of W+, W- from JPL 1h maps in magn.coord.
C JPL 1h indices based on -15d median 	from Jan 1994 to 2022.07
C
C
      CHARACTER*64 infilep,infilen,outfile,txt
	CHARACTER*2 AYR
	DIMENSION kwu(0:24),kwl(0:24),IM(12)
	DATA IM/31,28,31,30,31,30,31,31,30,31,30,31/

C
	outfile='wuwldjpl.txt'
	infilep='d:\web\grif\datw\wuiYRm.txt'
	infilen='d:\web\grif\datw\wliYRm.txt'
C
       OPEN(11,file=outfile)
   33 format(3I2,24(1X,I4),1X,F5.2)
C
	DO 41 iyear=1994,2022
c      iyear=2022
C
C
	DO k=0,24
	kwu(k)=0
	kwl(k)=0
	ENDDO
	iyr=iyear-iyear/100*100
      ryr=float(iyr)
	if(int(ryr/4.)*4.eq.iyr) THEN 
	ndnr=366
	im(2)=29
	                          ELSE
	ndnr=365
	im(2)=28
	ENDIF
	del=1./ndnr
	call blet2(iyr,AYR)
C++ READ 1h Wp
C
	infilep(21:22)=AYR
	OPEN(12,file=infilep,action='READ')
	read(12,*) txt
	infilen(21:22)=AYR
	OPEN(13,file=infilen,action='READ')
	read(13,*) txt
C
      n1=1
C       if	(iyear.eq.1996) n1=336
	if (iyear.eq.2022) ndnr=212
	do 49 kk=n1,ndnr
C++ move data up to keep for d-1,d0,d+1 days
	read(12,33,end=55) kyr,kmn,kdy,(kwu(k),k=0,23),wum
	read(13,33,end=56) kyr,kmn,kdy,(kwl(k),k=0,23),wlm
	lda=ndoy(kyr,kmn,kdy)
	ryear=iyear+(lda-1)*del
        write(*,30) ryear,lda,kmn,kdy,wum,wlm
	write(11,30) ryear,lda,kmn,kdy,wum,wlm
   49	continue
   55	close(12)
   56	close(13)
C
   41 continue
   30 format(1X,F8.3,1X,I3,2(1X,I2),2(1X,F5.2))
   50	close(unit=11)
	pause ' '
	STOP
	END