!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
       subroutine cube2llh( h, hg, lmax) 
!      *****************************************************************
!      *                                                               *
!      *   Set scalar array for graphical output on cubic grid         *
!      *                                                               *
!      *****************************************************************
!----------------------------------------------------------------------
      include 'param_o.h'
      include 'graph.comm'
!----------------------------------------------------------------------
       real,parameter::one=1.  
!-----------------------------------------------------------------------
       dimension  &
       h   (0:im+1,0:jm+1,nm,lmax)  &
      ,hg  (igm,jgm,lmax)
        integer::i,j,l,il,jl
	real::x1a(4),x2a(4),ya(4,4),dy

	x1a=(/-1.,0.,1.,2./)
	x2a=(/-1.,0.,1.,2./)
!-----------------------------------------------------------------------
      do j=1,jgm
      do i=1,igm
        xmap=XMP0(i,j)
        ymap=YMP0(i,j)
        kmap=KMP0(i,j)
        
        xsi=xmap*(im-1)
        eta=ymap*(jm-1)
          il=xsi+1
          jl=eta+1
        xsi=xsi-il+1
        eta=eta-jl+1
        omxsi=one-xsi
        ometa=one-eta
!	if(il.eq.1.or.il.eq.im-1.or.jl.eq.1.or.jl.eq.jm-1)then
      HG(i,j,:)=H(il,jl,kmap,:)*omxsi*ometa+H(il+1,jl,kmap,:)*xsi*ometa  &
               +H(il,jl+1,kmap,:)*omxsi*eta+H(il+1,jl+1,kmap,:)*xsi*eta
!        else
!	  do l=1,lmax
!	   ya=H(il-1:il+2,jl-1:jl+2,kmap,l)
!	   call polin2(x1a,x2a,ya,4,4,xsi,eta,hg(i,j,l),dy)
!          enddo
!        endif
!        print *,i,j,kmap,il,jl,glon(i,j)*180/3.14,glat(i,j)*180/3.14
      if(i.eq.61.and.j.eq.91)then
!        print *,i,j,il,jl,kmap
!	stop
      endif
      end do
      end do
!-----------------------------------------------------------------------
                               Return
                               End
