subroutine HistoryFileOpen
!
! history_file_io モジュールの初期化を行います.
!
!
! "history_file_io" module is initialized.
!
!
! モジュール引用 ; USE statements
!
! 出力ファイルの基本情報
! Basic information for output files
!
use fileset, only: FileTitle, FileSource, FileInstitution
! データファイルを最終的に変更した組織/個人.
! Institution or person that changes data files for the last time
! 物理定数設定
! Physical constants settings
!
use constants, only: PI ! $ \pi $ .
! 円周率. Circular constant
! 座標データ設定
! Axes data settings
!
use axesset, only: x_Lon, x_Lon_Weight, y_Lat, y_Lat_Weight, z_Sigma, r_Sigma, z_DelSigma, w_Number
! スペクトルデータの添字番号.
! Subscript of spectral data
! NAMELIST ファイル入力に関するユーティリティ
! Utilities for NAMELIST file input
!
use namelist_util, only: namelist_filename, NmlutilMsg
! 時刻管理
! Time control
!
use timeset, only: TimesetGetCurrentTime, TimesetGetDelTime
! gtool4 netCDF データの入出力インターフェース (大規模モデル用)
! Interface of Input/Output of gtool4 netCDF data (For large models)
!
use gt4_historyauto, only: HistoryAutoCreate, HistoryAutoAddAttr, HistoryAutoAddWeight, HistoryAutoPutAxis
! ファイル入出力補助
! File I/O support
!
use dc_iounit, only: FileOpen
! 文字列操作
! Character handling
!
use dc_string, only: StoA
! 種別型パラメタ
! Kind type parameter
!
use dc_types, only: STDOUT ! 標準出力の装置番号. Unit number of standard output
! 宣言文 ; Declaration statements
!
implicit none
! 作業変数
! Work variables
!
real(DP):: current_time ! 現在時刻. Current time
real(DP):: delta_time ! $ \Delta t $
! 実行文 ; Executable statement
!
if ( history_file_io_inited ) return
call InitCheck
! デフォルト値の設定
! Default values settings
!
DefaultIntValue = 1.0
DefaultIntUnit = 'day'
DefaultFilePrefix = ''
!!$ DefaultIntValue = 1.0
!!$ DefaultIntUnit = 'hrs'
!!$ DefaultFilePrefix = 'data01/'
! モデルの時刻取得
! Initialization by "HistoryAutoCreate"
!
call TimesetGetCurrentTime( current_time, 'sec' ) ! (in)
call TimesetGetDelTime( delta_time, 'sec' ) ! (in)
! HistoryAutoCreate による初期化
! Initialization by "HistoryAutoCreate"
!
call HistoryAutoCreate( title = trim(FileTitle) // ' history data', source = FileSource, institution = FileInstitution, dims = (/ 'lon ', 'lat ', 'sig ', 'sigm', 'wn ', 'time' /), dimsizes = (/ imax, jmax, kmax, kmax + 1, (nmax+1)**2, 0 /), longnames = (/ 'longitude ', 'latitude ', 'sigma at layer midpoints ', 'sigma at layer end-points (half level)', 'subscript of spectral data ', 'time ' /), units = (/ 'degree_east ', 'degree_north', '1 ', '1 ', '1 ', DefaultIntUnit /), xtypes = (/ 'float', 'float', 'float', 'float', 'int ', 'float' /), file_prefix = DefaultFilePrefix, namelist_filename = namelist_filename, interval = DefaultIntValue, current_time = real( current_time ), delta_time = real( delta_time ) ) ! (in) optional
! 座標データへの属性の設定
! Attributes of axes data settings
!
call HistoryAutoAddAttr( varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in)
call HistoryAutoAddAttr( varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in)
call HistoryAutoAddAttr( varname = 'sig', attrname = 'standard_name', value = 'atmosphere_sigma_coordinate' ) ! (in)
call HistoryAutoAddAttr( varname = 'sigm', attrname = 'standard_name', value = 'atmosphere_sigma_coordinate' ) ! (in)
call HistoryAutoAddAttr( varname = 'sig', attrname = 'positive', value = 'down' ) ! (in)
call HistoryAutoAddAttr( varname = 'sigm', attrname = 'positive', value = 'down' ) ! (in)
! 座標データの設定
! Axes data settings
!
call HistoryAutoPutAxis( dim = 'lon', array = x_Lon / PI * 180.0_DP ) ! (in)
call HistoryAutoPutAxis( dim = 'lat', array = y_Lat / PI * 180.0_DP ) ! (in)
call HistoryAutoPutAxis( dim = 'sig', array = z_Sigma ) ! (in)
call HistoryAutoPutAxis( dim = 'sigm', array = r_Sigma ) ! (in)
call HistoryAutoPutAxis( dim = 'wn', array = w_Number ) ! (in)
! 座標重みの設定
! Axes weights settings
!
call HistoryAutoAddWeight( dim = 'lon', weight = x_Lon_Weight, units = 'radian', xtype = 'double' ) ! (in) optional
call HistoryAutoAddWeight( dim = 'lat', weight = y_Lat_Weight, units = 'radian', xtype = 'double' ) ! (in) optional
call HistoryAutoAddWeight( dim = 'sig', weight = z_DelSigma, xtype = 'double' ) ! (in) optional
! 印字 ; Print
!
call MessageNotify( 'M', module_name, '----- Initialization Messages -----' )
call MessageNotify( 'M', module_name, '-- version = %c', c1 = trim(version) )
history_file_io_inited = .true.
end subroutine HistoryFileOpen