!----------------------------------------------------------------------
!     Copyright (c) 2002 Shin-ichi Takehiro. All rights reserved.
!----------------------------------------------------------------------
!
!  yt_ggg, ggg_yt のテスト
!  
program spctest1

  use spcpack
  implicit none

  integer,parameter  :: im=32, jm=16, km=16  ! 格子点の設定(経度, 緯度, 動径)
  integer,parameter  :: nm=10, lm=16         ! 切断波数の設定(水平, 動径)
  real(8),parameter  :: ri=0.5, ro=1.5      ! 内外半径

  real(8), dimension(im,jm,0:km)     :: ggg_data
  real(8), dimension((nm+1)**2,0:lm) :: yt_data

  real(8), parameter :: eps=1D-10

  integer :: l,n

  integer :: n=1

  write(6,*) 'n?'
  read(5,*) n

  call spcinitial(im,jm,km,nm,lm,ri,ro)

  !ggg_data = ggg_rad**n * sin(ggg_lat)                  ! (n,m)=(1,0)
  !ggg_data = ggg_rad**n * sin(ggg_lon)*cos(ggg_lat)    ! (n,m)=(1,-1)
  ggg_data = ggg_rad**n * cos(ggg_lon)*cos(ggg_lat)    ! (n,m)=(1,1)

  yt_data = yt_ggg(ggg_data)

  do l=0,lm
     do n=1,(nm+1)**2
        if ( abs(yt_data(n,l)) > eps ) then
           write( 6,* ) n,nm_l(n),l,yt_data(n,l)
        end if
     enddo
  enddo

end program spctest1
