!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Module NameSet
!
!   * Developer: SUGIYAMA Ko-ichiro (sugiyama@gfd-dennou.org)
!   * Version: $Id: $ 
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview 
!
!出力 netCDF ファイルに記載する実験設定を NAMELIST から取得する. 
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!
                                                                 !=end

module nameset
  implicit none
  save
                                                                 !=begin
  !== Public Interface
  character(80) :: ExpTitle  !データの表題
  character(80) :: ExpSrc    !データを作成する手順
  character(80) :: ExpInst   !最終変更者・組織
                                                                 !=end
contains
                                                                 !=begin
  !== Procedure Interface 
  !
  !=== Initialize module and acquire NAMELIST
  !
  !netCDF に書き込む実験名を NAMELIST から読み込む
  !
  subroutine nameset_init(cfgfile)

    !=== Dependency
    use dc_trace,      only: BeginSub, EndSub 

    !=== Input
    character(*), intent(in) :: cfgfile
    
    !=== NAMELIST
    NAMELIST /nameset/ ExpTitle, ExpSrc, ExpInst
                                                                 !=end        

    call BeginSub("nameset_init", &
&                 fmt="%c",       &
&                 c1="Initialize experiment setup comment.")

    open (10, FILE=cfgfile)
    read(10, NML=nameset)
    close(10)


    !==== 確認
!    write(*,*) "ExpTitle ", ExpTitle
!    write(*,*) "ExpSrc ", ExpSrc
!    write(*,*) "ExpInst ", ExpInst


    call EndSub("nameset_init")
    
  end subroutine nameset_init

end module nameset

