c VERIFICATION OF MEDIAN ================
      subroutine submedian3h(ndn,BB,xme)
C Input file: CC(60,0:7) up to 60 lines, hours 00, 03, 21 (3h) UY
C Number days for median : ndnr
C Outout file: ME(0:23) for hours 00, 01, 23 h UY
	DIMENSION BB(180,0:7),XME(0:7),X1(180),X2(180)
	integer ndn
C-		COMMON /BL1/BB,XME
C "MEDIAN:"
       DO 1030 M=0,7
      MM=0
      DO N=1,ndn
      X1(N)=BB(N,M)
      ENDDO 
  880 XX=0.
CREM MAX X1(N)
  890 DO N=1,ndn
  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,ndn
      IF (X1(N).lt.XX) GOTO 960
      MM=MM+1 
      X2(MM)=XX 
	X1(N)=0.
  960 CONTINUE      ! N
  970 IF (MM.lt.NDN) 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 1000 IF (MM.eq.0) MD=0
C
 1020 XME(M)=XMD
 1030 CONTINUE
c
 1050 RETURN
      END