C.........................................................June	 2025
C
C.........................................................Apr. 2021
C JPL maps 2.5 X 5 glat X glon 
C
c VERIFICATION OF MEDIAN ================
      subroutine smed15j1(CC,SMED)
C
C Median smed, for -14+1 days at specified hour+00,15,30,45min
C
C Input file: CC(ndnr,0:72) for ndnr days, 
C ncol=73 for longitudes -180:5:180 or ncol=72 for hours UT=0,1,...,23. MIN=00, 15, 30, 45
C Number days for median : ndnr=7	(6 preceding days+current day)
C Output arrays: SMED(0:72) for longitudes -180:5:180 
C
	DIMENSION CC(15,0:72),SMED(0:72)
	+,X1(15),X2(15)
C "MEDIAN:"
	ncol=72
	ndnr=15
C	ndnr=7
       DO 1030 M=0,ncol
      MM=0
C Add calculation of average:
	aver=0.
      DO N=1,ndnr
      X1(N)=CC(N,M)
C-	aver=aver+x1(n)
      ENDDO 
C-	aver=aver/ndnr
  880 XX=0.
CREM MAX X1(N)
  890 DO N=1,ndnr
  900 IF (XX.lt.X1(N)) THEN 
      XX=X1(N)
	ENDIF
      ENDDO      !N
  920 IF (XX.eq.0) GOTO 980
C
  930 DO 960 N=1,ndnr
      IF (X1(N).lt.XX) GOTO 960
      MM=MM+1 
      X2(MM)=XX 
	X1(N)=0.
  960 CONTINUE      ! N
  970 IF (MM.lt.NDNR) GOTO 880
  980 XMM=FLOAT(MM)
      XD1=XMM/2.
      ND1=INT(XD1)
	CD1=FLOAT(ND1) 
      ND2=ND1+1 
      IF (CD1.LT.XD1) THEN 
	XMD=X2(ND2)
	else
	XMD=(X2(ND1)+X2(ND2))/2.
	ENDIF
C
      SMED(M)=XMD
 1030 CONTINUE
C 
c
 1050 RETURN
      END