!c Description:
!c   netCDF ファイルに化学種名を追加する
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Histry: 
!c   Version    Date          Comment
!c   -------    ----------    --------
!c   1.0        2003-03-31    新規作成
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2003, All rights reserved


program InsertName
  use netcdf
  use prm_common, only: AdbtFile, property, obrinit
  use interface_netcdf_open
  use interface_netcdf_redef
  use interface_netcdf_put
  use interface_netcdf_close
  
  implicit none
  integer                     :: ncid
  character(30)               :: long_name     !名前
  character(20)               :: name          !名前  
  character(10)               :: dim_name1
  character(10)               :: dim_name2
  character(10)               :: units         !名前


  call ObrInit
  
  name = "sname"
  dim_name1 = "size"
  dim_name2 = "spc"
  long_name = "name of chemical species"
  units = "1"
  
  call netcdf_open(AdbtFile, ncid)
  write(*,*) "open"

  call netcdf_redef(ncid, name, dim_name1, dim_name2, &
       & long_name, units, nf90_char)
  write(*,*) "redef"

  call netcdf_put(ncid, name, property%name)
  write(*,*) "put"

  call netcdf_close(ncid)
  write(*,*) "close"
  
end program InsertName
