Class gt4_history
In: gt4_history.f90

gtool4 netCDF データの入出力インターフェース

Interface of Input/Output of gtool4 netCDF data

gt4_history モジュールは, 数値モデルの結果を gtool4 netCDF 規約 に基づくデータ形式 (以降, gtool4 データと呼びます) で出力するためのインターフェースです. 主に時間積分の結果を等時間間隔で出力することを念頭においてます. このモジュールを用いれば, Fortran90 で書かれたプログラムの計算結果を gtool4 データで出力することが簡単に実現できます.

なお, Fortran77 用のインターフェースとして, HSPACK も用意しています.

Prepare

以下の use 文を Fortran 90 プログラムの先頭に書き込んでください. 本 gt4_history モジュール内の手続きと構造型変数が 利用できるようになります.

    use gt4_history

Procedures List

【出力用】

HistoryCreate :gtool4 データ出力用初期設定
HistoryAddVariable :変数定義
HistoryCopyVariable :変数定義 (別ファイルの変数コピー)
HistoryPut :データ出力
HistoryAddAttr :変数に属性付加
HistoryClose :終了処理
HistorySetTime :時刻指定

【入力用】

HistoryGet :データ入力 (固定長配列用)
HistoryGetPointer :データ入力 (ポインタ配列用)

【その他】

HistoryInquire :GT_HISTORY 型変数への問い合わせ
HistoryCopy :GT_HISTORY 型変数のコピー
HistoryPutLine :GT_HISTORY 型変数の印字
HistoryInitialized :GT_HISTORY 型変数の初期設定をチェック

Derived types

GT_HISTORY :gtool4 データ出力用
GT_HISTORY_AXIS :gtool4 データ座標軸情報
GT_HISTORY_VARINFO :gtool4 データ変数情報

gtool4 netCDF 規約との対応

バージョン gtool4_netCDF_version に対応しています。

生成系

出力するデータには以下の大域属性を必ず与えます。

netCDF属性:与えられる値
Conventions :ユーザによる指定が無い限り gtool4_netCDF_Conventions が与えられます.
gt_version :ユーザによる指定が無い限り gtool4_netCDF_version が与えられます.
title :ユーザによって指定されます.
source :ユーザによって指定されます.
institution :ユーザによって指定されます.
history :"unknown 2005-08-05T21:48:37+09:00> gt4_history: HistoryCreate\n" といった値が与えられます. "unknown" の部分には, 環境変数 USER から取得される ユーザ名が与えられます. その後ろにはファイルの生成を 開始した時刻が与えられます.

出力するデータの変数には以下の属性を必ず与えます.

netCDF属性:与えられる値
long_name :ユーザによって指定されます.
units :ユーザによって指定されます.

この他の属性に関して HistoryAddAttr などによって任意に与えることは 可能です. 禁止の属性に関しては警告を発するべきですが, 現在は チェックを行っていません.

解釈系

原則的に, 現在の gt4_history は全ての属性の解釈を行ないません. 本来ならば, HistoryGet は scale_factor, add_offset, valid_range などの属性を解釈すべきかも知れません. ただし, HistoryCopyVariable は変数コピーの際, 変数に属する全ての属性と その値を引き継ぎます.

Methods

Copy   Copy   Copy   Create   Create   GT_HISTORY   GT_HISTORY_ATTR   GT_HISTORY_AVRDATA   GT_HISTORY_AXIS   GT_HISTORY_VARINFO   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttrChar0   HistoryAddAttrDouble0   HistoryAddAttrDouble1   HistoryAddAttrInt0   HistoryAddAttrInt1   HistoryAddAttrLogical0   HistoryAddAttrReal0   HistoryAddAttrReal1   HistoryAddVariable   HistoryAddVariable   HistoryAddVariable1   HistoryAddVariable2   HistoryAttrAdd   HistoryAttrCopy   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttrChar0   HistoryAxisAddAttrDouble0   HistoryAxisAddAttrDouble1   HistoryAxisAddAttrInt0   HistoryAxisAddAttrInt1   HistoryAxisAddAttrLogical0   HistoryAxisAddAttrReal0   HistoryAxisAddAttrReal1   HistoryAxisClear   HistoryAxisCopy   HistoryAxisCopy1   HistoryAxisCreate   HistoryAxisCreate1   HistoryAxisInquire   HistoryAxisInquire1   HistoryClose   HistoryCopy   HistoryCopy1   HistoryCopyVariable   HistoryCopyVariable1   HistoryCreate   HistoryCreate   HistoryCreate1   HistoryCreate2   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGet   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryGetPointer   HistoryInitialized   HistoryInitialized0   HistoryInquire   HistoryInquire   HistoryInquire1   HistoryInquire2   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPutDouble0   HistoryPutDouble1   HistoryPutDouble2   HistoryPutDouble3   HistoryPutDouble4   HistoryPutDouble5   HistoryPutDouble6   HistoryPutDouble7   HistoryPutDoubleEx   HistoryPutEx   HistoryPutEx   HistoryPutEx   HistoryPutInt0   HistoryPutInt1   HistoryPutInt2   HistoryPutInt3   HistoryPutInt4   HistoryPutInt5   HistoryPutInt6   HistoryPutInt7   HistoryPutIntEx   HistoryPutLine   HistoryPutReal0   HistoryPutReal1   HistoryPutReal2   HistoryPutReal3   HistoryPutReal4   HistoryPutReal5   HistoryPutReal6   HistoryPutReal7   HistoryPutRealEx   HistorySetTime   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttrChar0   HistoryVarinfoAddAttrDouble0   HistoryVarinfoAddAttrDouble1   HistoryVarinfoAddAttrInt0   HistoryVarinfoAddAttrInt1   HistoryVarinfoAddAttrLogical0   HistoryVarinfoAddAttrReal0   HistoryVarinfoAddAttrReal1   HistoryVarinfoClear   HistoryVarinfoClear0   HistoryVarinfoCopy   HistoryVarinfoCopy1   HistoryVarinfoCreate   HistoryVarinfoCreate1   HistoryVarinfoInitialized   HistoryVarinfoInitialized0   HistoryVarinfoInquire   HistoryVarinfoInquire1   Inquire   Inquire   Inquire   Inquire   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   Put_Attr   TimeGoAhead   default   gtool4_netCDF_Conventions   gtool4_netCDF_version   initialized   lookup_dimension   lookup_var_or_dim   lookup_variable   lookup_variable_ord   set_fake_dim_value   version  

Included Modules

gtdata_types dc_types dc_trace dc_string dc_error gtdata_generic dc_url dc_present dc_message sysdep dc_date_types dc_date netcdf_f77

Public Instance methods

Copy( axis_dest, axis_src, [err], [name], [length], [longname], [units], [xtype] )
Subroutine :
axis_dest :type(GT_HISTORY_AXIS),intent(out)
: コピー先 GT_HISTORY_AXIS
axis_src :type(GT_HISTORY_AXIS),intent(in)
: コピー元 GT_HISTORY_AXIS
err :logical, intent(out), optional
name :character(*) , intent(in), optional
: 次元変数名
length :integer, intent(in), optional
: 次元長 (配列サイズ)
longname :character(*) , intent(in), optional
: 次元変数の記述的名称
units :character(*) , intent(in), optional
: 次元変数の単位
xtype :character(*) , intent(in), optional
: 次元変数の型

GT_HISTORY_AXIS 型変数コピー

GT_HISTORY_AXIS 型の変数 axis_srcaxis_dest にコピーします。 axis_srcHistoryAxisCreate によって初期設定されている必要が あります。 さらに属性を付加する場合には HistoryAxisAddAttr を用いてください。

err を与えておくと、コピーの際何らかの不具合が生じても 終了せずに err が真になって返ります。

err 以降の引数は、コピーの際に上書きする値です。

Alias for HistoryAxisCopy1

Copy( hist_dest, file, [hist_src], [title], [source], [institution], [origin], [interval], [conventions], [gt_version] )
Subroutine :
hist_dest :type(GT_HISTORY), intent(out), target
file :character(*), intent(in)
hist_src :type(GT_HISTORY), intent(in), optional, target
title :character(*), intent(in), optional
source :character(*), intent(in), optional
institution :character(*), intent(in), optional
origin :real, intent(in), optional
interval :real, intent(in), optional
conventions :character(*), intent(in), optional
gt_version :character(*), intent(in), optional

引数 hist_src の内容にコピーし, hist_dest へ返します. hist_src が与えられない場合は, 引数 history を与えずに呼び出した HistoryCreate の設定内容が参照されます. HistoryCreate と同様に, 出力の初期設定を行います. file は必ず与えなければならず, hist_src と同じファイルへ出力 しようとする場合はエラーを生じます. HistoryAddVariable で設定される内容に関してはコピーされません.

それ以降の引数を与えることで, hist_src の設定を 上書きすることが可能です.

Alias for HistoryCopy1

Copy( varinfo_dest, varinfo_src, [err], [name], [dims], [longname], [units], [xtype] )
Subroutine :
varinfo_dest :type(GT_HISTORY_VARINFO),intent(out)
varinfo_src :type(GT_HISTORY_VARINFO),intent(in)
err :logical, intent(out), optional
name :character(*) , intent(in), optional
: 次元変数名
dims(:) :character(*) , intent(in), optional, target
: 依存する次元
longname :character(*) , intent(in), optional
: 次元変数の記述的名称
units :character(*) , intent(in), optional
: 次元変数の単位
xtype :character(*) , intent(in), optional
: 次元変数の型

GT_HISTORY_VARINFO 型変数コピー

GT_HISTORY_VARINFO 型の変数 varinfo_srcvarinfo_dest にコピーします。 varinfo_srcHistoryVarinfoCreate によって初期設定されている必要が あります。 さらに属性を付加する場合には HistoryVarinfoAddAttr を用いてください。

err を与えておくと、コピーの際何らかの不具合が生じても 終了せずに err が真になって返ります。

err 以降の引数は、コピーの際に上書きする値です。

Alias for HistoryVarinfoCopy1

Create( axis, name, size, longname, units, xtype )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(out)
name :character(*) , intent(in)
: 次元変数名
size :integer, intent(in)
: 次元長 (配列サイズ)
longname :character(*) , intent(in)
: 次元変数の記述的名称
units :character(*) , intent(in)
: 次元変数の単位
xtype :character(*) , intent(in)
: 次元変数の型

GT_HISTORY_AXIS 型変数作成

GT_HISTORY_AXIS 型変数を作成します。 このサブルーチンによる設定の後、 HistoryCreateaxes に与えます。 さらに属性を付加する場合には HistoryAxisAddAttr を用いてください。

Constructor of GT_HISTORY_AXIS

Alias for HistoryAxisCreate1

Create( varinfo, name, dims, longname, units, [xtype], [time_average], [average], [err] )
Subroutine :
varinfo :type(GT_HISTORY_VARINFO),intent(inout)
name :character(*), intent(in)
: 変数名
dims(:) :character(*), intent(in)
: 依存する次元
longname :character(*), intent(in)
: 変数の記述的名称
units :character(*), intent(in)
: 変数の単位
xtype :character(*), intent(in), optional
: 変数の型
time_average :logical, intent(in), optional
: 時間平均
average :logical, intent(in), optional
: 時間平均 (後方互換用)
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

GT_HISTORY_VARINFO 型変数作成

GT_HISTORY_VARINFO 型変数を作成します。 このサブルーチンによる設定の後、 HistoryAddVariablevarinfo に与えます。 さらに属性を付加する場合には HistoryVarinfoAddAttr を用いてください。

Constructor of GT_HISTORY_VARINFO

Alias for HistoryVarinfoCreate1

GT_HISTORY
Derived Type :
initialized = .false. :logical
: 初期設定フラグ. Initialization flag
unlimited_index :integer
dimvars(:) =>null() :type(GT_VARIABLE), pointer
: 次元変数 ID配列. it is index of dimvars(:), not that of vars(:).
dim_value_written(:) =>null() :logical, pointer
: 各次元が記述済みかどうか
origin :real
interval :real
newest :real
oldest :real
vars(:) =>null() :type(GT_VARIABLE), pointer
: 変数 ID 配列
growable_indices(:) =>null() :integer, pointer
: 無制限次元の添字 (無制限次元が無い時は 0)
count(:) =>null() :integer, pointer
: 各配列の無制限次元の配列長
var_avr_count(:) =>null() :integer, pointer
: 各変数の時間平均値出力の際の積算回数. -1 の場合は出力データを平均化しない.

Number of times of integral for time-averaged value output of each variable. -1 disables average value output

var_avr_data(:) =>null() :type(GT_HISTORY_AVRDATA), pointer
: 時間平均値を出力するためのデータ一時保管用配列.

Array for temporary keeping data for time-averaged value output

time_bnds(1:2) :real(DP)
: "time_bnds" 変数に出力されるデータ.

Data that is to be output in "time_bnds" variable

time_bnds_output_count = 0 :integer
: "time_bnds" 変数に出力された回数.

Number of output in "time_bnds" variable

gtool4 netCDF データの出力用構造体

この型の変数は HistoryCreate によって初期設定される必要があります。 初期設定後、データ出力用の複数のサブルーチンによって利用されます。 最終的には HistoryClose によって終了処理してください。

この構造体の内部の要素は非公開になっています。 問い合わせの際には HistoryInquire を利用してください。

Data entity of this type represents a netCDF dataset controlled by gt4f90io library. It must be initialized by HistoryCreate , then used in many subroutines, and must be finalized by HistoryClose . Note that the resultant file is undefined if you forget to finalize it.

Users are recommended to retain the object of this type returned by HistoryCreate, to use it as the last argument called history for all following subroutine calls. However, it is not mandatory. When you are going to write ONLY one dataset, argument history of all subroutine calls can be omitted, and the history entity will be internally managed within this module.

GT_HISTORY_AXIS
Derived Type :
name = "" :character(TOKEN)
: 次元変数名
length = 0 :integer
: 次元長 (配列サイズ)
longname = "" :character(STRING)
: 次元変数の記述的名称
units = "" :character(STRING)
: 次元変数の単位
xtype = "" :character(TOKEN)
: 次元変数の型
attrs(:) =>null() :type(GT_HISTORY_ATTR), pointer
: 属性情報群

座標軸情報を格納する構造体

この型の変数は HistoryAxisCreate, HistoryAxisCopy, HistoryInquire によって初期設定される必要があります。 初期設定後、HistoryCreateaxes に与えます。

問い合わせは HistoryAxisInquire によって行います。 属性の付加は HistoryAxisAddAttr によって行います。 初期化は HistoryAxisClear によって行います。

This type may be used as a argument axes of HistoryCreate to define features of axes of a history dataset. Typically, a constant array of this type will be used for fixed specification.

GT_HISTORY_VARINFO
Derived Type :
name = "" :character(TOKEN)
: 変数名
dims(:) =>null() :character(TOKEN), pointer
: 依存する次元
longname = "" :character(STRING)
: 変数の記述的名称
units = "" :character(STRING)
: 変数の単位
xtype = "" :character(TOKEN)
: 変数の型
attrs(:) =>null() :type(GT_HISTORY_ATTR), pointer
: 属性情報群
time_average = .false. :logical
: 時間平均
initialized = .false. :logical
: 初期設定フラグ. Initialization flag

変数情報を格納する構造体

この型の変数は HistoryVarinfoCreate, HistoryVarinfoCopy, HistoryInquire によって初期設定される必要があります。 初期設定後、HistoryAddVariablevarinfo に与えます。

問い合わせは HistoryVarinfoInquire によって行います。 属性の付加は HistoryVarinfoAddAttr によって行います。 初期化は HistoryVarinfoClear によって行います。

This type may be used as a argument varinfo of HistoryAddVariable to define features of variable of a history dataset.

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
: 変数の名前。

ここで指定するものは、 HistoryCreatedims 、 または HistoryAddVariablevarname で既に指定されてい なければなりません。

attrname :character(*), intent(in)
: 変数またはファイル全体に付 加する属性の名前

"+" (プラ ス) を属性名の先頭につける 場合には、ファイル全体に属 性を付加します。 ファイル全体へ属性を付加 する場合でも、 HistoryCreatedims 、または HistoryAddVariablevarname で既に指定されてい る変数を varname に指定する 必要があります。

value :character(*), intent(in)
: 属性の値
history :type(GT_HISTORY), intent(inout), target, optional
: 出力ファイルの設定に関する情報を 格納した構造体

ここに指定するものは、 HistoryCreate によって初期設定 されていなければなりません。

gtool4 データ内の変数への属性付加

gtool4 データおよびそのデータ内の変数に属性を付加します。 このサブルーチンを用いる前に、 HistoryCreate による初期設定が 必要です。

属性名 attrname の先頭にプラス "+" を付加する 場合は、gtool4 データ自体の属性 (大域属性) として属性が付加されます この場合、varname は無視されますが、その場合でも varname へは 引数の解説にもある通り有効な値を与えてください。

HistoryAddAttr は複数のサブルーチンの総称名です。value には いくつかの型を与えることが可能です。 下記のサブルーチンを参照ください。

Alias for HistoryAddAttrChar0

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :integer, intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrInt0

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :logical, intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrLogical0

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :real(DP), intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrDouble0

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :real, intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrReal0

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :integer, intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrInt1

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :real(DP), intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrDouble1

HistoryAddAttr( varname, attrname, value, [history] )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :real, intent(in)
history :type(GT_HISTORY), intent(inout), target, optional

Alias for HistoryAddAttrReal1

HistoryAddVariable( varinfo, [history], [err] )
Subroutine :
varinfo :type(GT_HISTORY_VARINFO), intent(in)
: 変数情報を格納した構造体

ここに指定するものは、 HistoryVarinfoCreate によって 初期設定されていなければなりません。

history :type(GT_HISTORY), intent(inout), optional
: 出力ファイルの設定に関する情報を 格納した構造体

ここに指定するものは、 HistoryCreate によって初期設定 されていなければなりません。

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

変数定義

gtool4 データ内の変数の定義を行います。このサブルーチンを 用いる前に、 HistoryCreate による初期設定が必要です。

既に gtool4 データが存在し、そのデータ内の変数と全く同じ 構造の変数を定義したい場合は HistoryCopyVariable を利用すると 便利です。

HistoryAddVariable というサブルーチン名は 2 つの別々の サブルーチンの総称名です。下記のサブルーチンも参照ください。

Alias for HistoryAddVariable2

HistoryAddVariable( varname, dims, longname, units, [xtype], [time_average], [average], [history], [err] )
Subroutine :recursive
varname :character(len = *), intent(in)
: 定義する変数の名前

最大文字数は dc_type#TOKEN

dims(:) :character(len = *), intent(in)
: 変数が依存する次元の名前

時間の次元は配列の最後に指定 しなければならない。 ここで指定するものは、 HistoryCreate にて dims で指定 されていなければならない。

もしもスカラー変数を作成 する場合には, サイズが 1 で 中身が空の文字型配列, すなわち (/’’/) を与えること.

longname :character(len = *), intent(in)
: 変数の記述的名称

最大文字数は dc_types#STRING

units :character(len = *), intent(in)
: 変数の単位

最大文字数は dc_types#STRING

xtype :character(len = *), intent(in), optional
: 変数のデータ型

デフォルトはfloat (単精度実数型) である。 有効なのは、 double (倍精度実数型)、 int (整数型)である。 指定しない 場合や、無効な型を指定した 場合には、 float (単精度実数型) となる。

time_average :logical, intent(in), optional
: 出力データを時間平均する場合には .true. を与えます。 デフォルトは .false. です。

If output data is averaged in time direction, specify ".true.". Default is ".false.".

average :logical, intent(in), optional
: time_average の旧版. Old version of "time_average"
history :type(GT_HISTORY), intent(inout), optional, target
: 出力ファイルの設定に関する情報を 格納した構造体

ここに指定するものは、 HistoryCreate によって初期設定 されていなければなりません。

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

変数定義

gtool4 データ内の変数の定義を行います。このサブルーチンを 用いる前に、 HistoryCreate による初期設定が必要です。

既に gtool4 データが存在し、そのデータ内の変数と全く同じ 構造の変数を定義したい場合は HistoryCopyVariable を利用すると便利です。

HistoryAddVariable というサブルーチン名は 2 つの別々の サブルーチンの総称名です。上記のサブルーチンも参照ください。

Alias for HistoryAddVariable1

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :character(*), intent(in)
: 属性に与えられる値

配列の場合でも、数値型以外 では配列の 1 つ目の要素のみ 値として付加されます。

GT_HISTORY_AXIS 型変数への属性付加

GT_HISTORY_AXIS 型の変数 axis へ属性を付加します。

HistoryAxisAddAttr は複数のサブルーチンの総称名です。 value には様々な型の引数を与えることが可能です。 下記のサブルーチンを参照ください。

Alias for HistoryAxisAddAttrChar0

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :integer, intent(in)

Alias for HistoryAxisAddAttrInt0

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :logical, intent(in)

Alias for HistoryAxisAddAttrLogical0

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :real(DP), intent(in)

Alias for HistoryAxisAddAttrDouble0

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :real, intent(in)

Alias for HistoryAxisAddAttrReal0

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value(:) :integer, intent(in)

Alias for HistoryAxisAddAttrInt1

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value(:) :real(DP), intent(in)

Alias for HistoryAxisAddAttrDouble1

HistoryAxisAddAttr( axis, attrname, value )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value(:) :real, intent(in)

Alias for HistoryAxisAddAttrReal1

Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)

GT_HISTORY_AXIS 型変数初期化

axis で与えられた変数を HistoryAxisCreate による初期設定よりも さらに前の状態に初期化します。

Destructor of GT_HISTORY_AXIS

[Source]

  subroutine HistoryAxisClear(axis)
    !
    !== GT_HISTORY_AXIS 型変数初期化
    !
    ! *axis* で与えられた変数を HistoryAxisCreate による初期設定よりも
    ! さらに前の状態に初期化します。
    !
    ! Destructor of GT_HISTORY_AXIS
    !
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(len = *), parameter:: subname = "HistoryAxisClear1"
    call BeginSub(subname)
    axis % name     = ""
    axis % length   = 0
    axis % longname = ""
    axis % units    = ""
    axis % xtype    = ""
    if (associated(axis % attrs)) then
      deallocate(axis % attrs)
    end if
    call EndSub(subname)
  end subroutine HistoryAxisClear
HistoryAxisCopy( axis_dest, axis_src, [err], [name], [length], [longname], [units], [xtype] )
Subroutine :
axis_dest :type(GT_HISTORY_AXIS),intent(out)
: コピー先 GT_HISTORY_AXIS
axis_src :type(GT_HISTORY_AXIS),intent(in)
: コピー元 GT_HISTORY_AXIS
err :logical, intent(out), optional
name :character(*) , intent(in), optional
: 次元変数名
length :integer, intent(in), optional
: 次元長 (配列サイズ)
longname :character(*) , intent(in), optional
: 次元変数の記述的名称
units :character(*) , intent(in), optional
: 次元変数の単位
xtype :character(*) , intent(in), optional
: 次元変数の型

GT_HISTORY_AXIS 型変数コピー

GT_HISTORY_AXIS 型の変数 axis_srcaxis_dest にコピーします。 axis_srcHistoryAxisCreate によって初期設定されている必要が あります。 さらに属性を付加する場合には HistoryAxisAddAttr を用いてください。

err を与えておくと、コピーの際何らかの不具合が生じても 終了せずに err が真になって返ります。

err 以降の引数は、コピーの際に上書きする値です。

Alias for HistoryAxisCopy1

HistoryAxisCreate( axis, name, size, longname, units, xtype )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(out)
name :character(*) , intent(in)
: 次元変数名
size :integer, intent(in)
: 次元長 (配列サイズ)
longname :character(*) , intent(in)
: 次元変数の記述的名称
units :character(*) , intent(in)
: 次元変数の単位
xtype :character(*) , intent(in)
: 次元変数の型

GT_HISTORY_AXIS 型変数作成

GT_HISTORY_AXIS 型変数を作成します。 このサブルーチンによる設定の後、 HistoryCreateaxes に与えます。 さらに属性を付加する場合には HistoryAxisAddAttr を用いてください。

Constructor of GT_HISTORY_AXIS

Alias for HistoryAxisCreate1

HistoryAxisInquire( axis, [name], [size], [longname], [units], [xtype] )
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(in)
name :character(*) , intent(out), optional
: 次元変数名
size :integer, intent(out), optional
: 次元長 (配列サイズ)
longname :character(*) , intent(out), optional
: 次元変数の記述的名称
units :character(*) , intent(out), optional
: 次元変数の単位
xtype :character(*) , intent(out), optional
: 次元変数の型

GT_HISTORY_AXIS 型変数への問い合わせ

GT_HISTORY_AXIS 型の変数内の各情報を参照します。

Alias for HistoryAxisInquire1

Subroutine :
history :type(GT_HISTORY), intent(inout), optional, target
: 出力ファイルの設定に関する情報を 格納した構造体

ここに指定するものは, HistoryCreate によって初期設定 されていなければなりません.

quiet :logical, intent(in), optional
: .true. を与えた場合, メッセージ出力が抑制されます.

If ".true." is given, messages are suppressed.

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

gtool4 データの終了処理

HistoryCreate で始まったデータ出力の終了処理をおこなうものです. プログラム内で HistoryCreate を用いた場合, プログラムを終了する 前に必ずこのサブルーチンを呼んで下さい.

[Source]

  subroutine HistoryClose( history, quiet, err )
    !
    !== gtool4 データの終了処理
    !
    ! HistoryCreate で始まったデータ出力の終了処理をおこなうものです.
    ! プログラム内で HistoryCreate を用いた場合, プログラムを終了する
    ! 前に必ずこのサブルーチンを呼んで下さい.
    !
    use gtdata_generic, only: Close, Inquire
    use dc_message, only: MessageNotify
    use dc_url, only: UrlSplit
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT
    type(GT_HISTORY), intent(inout), optional, target:: history
                              ! 出力ファイルの設定に関する情報を
                              ! 格納した構造体
                              ! 
                              ! ここに指定するものは,
                              ! HistoryCreate によって初期設定
                              ! されていなければなりません.
                              ! 
    logical, intent(in), optional:: quiet
                              ! .true. を与えた場合, 
                              ! メッセージ出力が抑制されます. 
                              !
                              ! If ".true." is given, 
                              ! messages are suppressed. 
                              ! 
    logical, intent(out), optional:: err
                              ! 例外処理用フラグ.
                              ! デフォルトでは, この手続き内でエラーが
                              ! 生じた場合, プログラムは強制終了します.
                              ! 引数 *err* が与えられる場合,
                              ! プログラムは強制終了せず, 代わりに
                              ! *err* に .true. が代入されます.
                              !
                              ! Exception handling flag. 
                              ! By default, when error occur in 
                              ! this procedure, the program aborts. 
                              ! If this *err* argument is given, 
                              ! .true. is substituted to *err* and 
                              ! the program does not abort. 
    type(GT_HISTORY), pointer:: hst =>null()
    character(STRING):: url, file
    integer:: i, v_size
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryClose"
  continue
    call BeginSub(subname)
    stat = DC_NOERR
    cause_c = ""

    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    !-----------------------------------------------------------------
    !  初期設定のチェック
    !  Check initialization
    !-----------------------------------------------------------------
    if ( .not. hst % initialized ) then
      stat = DC_ENOTINIT
      cause_c = 'GT_HISTORY'
      goto 999
    end if

    !-----------------------------------------------------------------
    !  メッセージ出力用にファイル名取得
    !  Get filename for output messages
    !-----------------------------------------------------------------
    if ( .not. present_and_true(quiet) ) then
      call Inquire( hst % dimvars(1), url = url )                 ! (out)
      call UrlSplit( fullname = url, file = file )                ! (out)
    end if

    v_size = size(hst % dimvars)
    do, i = 1, v_size
      if (.not. hst % dim_value_written(i)) call set_fake_dim_value(hst, i)
      call Close(hst % dimvars(i))
    enddo
    deallocate(hst % dimvars)
    v_size = size(hst % vars)
    do, i = 1, v_size
      call Close(hst % vars(i))
    enddo
    if (associated(hst % vars)) deallocate(hst % vars)
    if (associated(hst % count)) deallocate(hst % count)
    if (associated(hst % var_avr_count)) deallocate(hst % var_avr_count)
    do, i = 1, v_size
      if (associated(hst % var_avr_data(i) % a_DataAvr)) deallocate(hst % var_avr_data(i) % a_DataAvr)
    enddo
    if (associated(hst % var_avr_data)) deallocate(hst % var_avr_data)

    !-----------------------------------------------------------------
    !  メッセージ出力
    !  Output messages
    !-----------------------------------------------------------------
    if ( .not. present_and_true(quiet) ) then
      call MessageNotify('M', subname, '"%c" is closed', c1 = trim( file ) )
    end if

    !-----------------------------------------------------------------
    !  終了処理, 例外処理
    !  Termination and Exception handling
    !-----------------------------------------------------------------
    hst % initialized = .false.
999 continue
    call StoreError( stat, subname, err, cause_c )
    call EndSub( subname )
  end subroutine HistoryClose
HistoryCopy( hist_dest, file, [hist_src], [title], [source], [institution], [origin], [interval], [conventions], [gt_version] )
Subroutine :
hist_dest :type(GT_HISTORY), intent(out), target
file :character(*), intent(in)
hist_src :type(GT_HISTORY), intent(in), optional, target
title :character(*), intent(in), optional
source :character(*), intent(in), optional
institution :character(*), intent(in), optional
origin :real, intent(in), optional
interval :real, intent(in), optional
conventions :character(*), intent(in), optional
gt_version :character(*), intent(in), optional

引数 hist_src の内容にコピーし, hist_dest へ返します. hist_src が与えられない場合は, 引数 history を与えずに呼び出した HistoryCreate の設定内容が参照されます. HistoryCreate と同様に, 出力の初期設定を行います. file は必ず与えなければならず, hist_src と同じファイルへ出力 しようとする場合はエラーを生じます. HistoryAddVariable で設定される内容に関してはコピーされません.

それ以降の引数を与えることで, hist_src の設定を 上書きすることが可能です.

Alias for HistoryCopy1

HistoryCopyVariable( file, varname, [history], [overwrite] )
Subroutine :
file :character(len = *), intent(in)
: コピーしようとする変数が格納された netCDF ファイル名
varname :character(len = *), intent(in)
: コピー元となる変数の名前

定義される変数名もこれと 同じになります。 最大文字数は dc_types#TOKEN

依存する次元が存在しない 場合は自動的にその次元に関する 変数情報も元のファイルから コピーします。 この場合に「同じ次元」と見 なされるのは、(1) 無制限次 元 (自動的に「時間」と認識 される)、 (2) サイズと単位が同じ次元、 です。

history :type(GT_HISTORY), intent(inout), optional, target
: 出力ファイルの設定に関する情報を 格納した構造体

ここに指定するものは、 HistoryCreate によって初期設定 されていなければなりません。

overwrite :logical, intent(in), optional
: 上書きの可否の設定

この引数に .false. を渡すと、 既存のファイルを上書きしません。 デフォルトは上書きします。

変数定義 (別ファイルの変数コピー)

gtool4 データ内の変数の定義を行います。 他の gtool4 データの ファイル名とその中の変数名を指定することで、 自動的のその変数の 構造や属性をコピーして変数定義します。このサブルーチンを 用いる前に、 HistoryCreate による初期設定が必要です。

構造や属性を手動で設定する場合には HistoryAddVariable を用いて下さい。

Alias for HistoryCopyVariable1

HistoryCreate( file, title, source, institution, axes, [origin], [interval], [history], [conventions], [gt_version], [overwrite], [quiet], [err] )
Subroutine :
file :character(*), intent(in)
: HistoryCreate 参照 (以下 axes を除く引数も同様)
title :character(*), intent(in)
source :character(*), intent(in)
institution :character(*), intent(in)
axes(:) :type(GT_HISTORY_AXIS), intent(in)
: 次元情報を格納した構造型変数

GT_HISTORY_AXIS 型変数の生成 (constructer) は HistoryAxisCreate にて行いま す。配列の大きさに制限は ありません。

origin :real, intent(in), optional
interval :real, intent(in), optional
history :type(GT_HISTORY), intent(out), optional
conventions :character(*), intent(in), optional
gt_version :character(*), intent(in), optional
overwrite :logical, intent(in), optional
quiet :logical, intent(in), optional
: .true. を与えた場合, メッセージ出力が抑制されます. デフォルトは .false. です.

If ".true." is given, messages are suppressed. Default value is ".false.".

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

gtool4 データ出力用初期設定

HistoryCreate というサブルーチン名は 2 つの別々の サブルーチンの総称名です。まずは HistoryCreate を参照ください。

もう 1 つのサブルーチンと異なる点は、座標軸の情報を dims, dimsizes, longnames, units, and xtypes といった 個別の引数で与えるのではなく、構造体 GT_HISTORY_AXIS 型の 引数 axes で与える点にあります。

GT_HISTORY_AXIS 型変数の生成 (constructer) は HistoryAxisCreate にて行います。

Two specific subroutines shares common part:

Both two ones initializes a dataset file. The result of type GT_HISTORY will be returned by history or managed internally if omitted. Mandatory global attributes are defined by arguments title, source, and institution; they are all declared as ((character(len = *))). Spatial axis definitions have two different forms: a primitive one uses several arrays of various types: dims, dimsizes, longnames, units, and xtypes. Another sophisticated one has only array of type GT_HISTORY_AXIS, axes. Temporal definition is done without origin, interval.

Alias for HistoryCreate2

HistoryCreate( file, title, source, institution, dims, dimsizes, longnames, units, [origin], [interval], [xtypes], [history], [conventions], [gt_version], [overwrite], [quiet], [err] )
Subroutine :
file :character(*), intent(in)
: 出力するファイルの名前. Name of output file
title :character(*), intent(in)
: データ全体の表題. Title of entire data
source :character(*), intent(in)
: データを作成する際の手段. Source of data file
institution :character(*), intent(in)
: ファイルを最終的に変更した組織/個人. Institution or person that changes files for the last time
dims(:) :character(*), intent(in)
: 次元の名前.

配列の大きさに制限はありません. 個々の次元の文字数は dc_types#TOKEN まで. 配列内の文字数は 全て同じでなければなりません. 足りない文字分は空白で 補ってください.

Names of dimensions.

Length of array is unlimited. Limits of numbers of characters of each dimensions are "dc_types#TOKEN". Numbers of characters in this array must be same. Make up a deficit with blanks.

dimsizes(:) :integer, intent(in)
: dims で指定したそれぞれの次元大きさ.

配列の大きさは dims の大きさと等しい 必要があります. ‘0’ (数字のゼロ) を指定 するとその次元は 無制限次元 (unlimited dimension) となります. (gt4_history では時間の次元に対して無制限次元を 用いることを想定しています). ただし, 1 つの NetCDF ファイル (バージョン 3) は最大で 1 つの無制限次元しか持てないので, 2 ヶ所以上に ‘0’ を指定しないでください. その場合, 正しく gtool4 データが出力されません.

Lengths of dimensions specified with "dims".

Length of this array must be same as length of "dim". If ‘0’ (zero) is specified, the dimension is treated as unlimited dimension. (In "gt4_history", unlimited dimension is expected to be used as time). Note that one NetCDF file (version 3) can not have two or more unlimited dimensions, so that do not specify ‘0’ to two or more places. In that case, gtoo4 data is not output currently

longnames(:) :character(*), intent(in)
: dims で指定したそれぞれの次元の名前.

配列の大きさは dims の大きさ と等しい必要があります. 文字数 は dc_types#STRING まで. 配列内の文字数は 全て同じでなければなりません. 足りない文字分は空白で補います.

Names of dimensions specified with "dims".

Length of this array must be same as length of "dim". Limits of numbers of characters are "dc_types#STRING". Numbers of characters in this array must be same. Make up a deficit with blanks.

units(:) :character(*), intent(in)
: dims で指定したそれぞれの次元の単位.

配列の大きさは dims の大きさ と等しい必要があります. 文字数 は dc_types#STRING まで. 配列内の文字数は 全て同じでなければなりません. 足りない文字分は空白で補います.

Units of dimensions specified with "dims".

Length of this array must be same as length of "dim". Limits of numbers of characters are "dc_types#STRING". Numbers of characters in this array must be same. Make up a deficit with blanks.

origin :real, intent(in), optional
: 時間の原点.

これは HistoryPut により変数を最初に 出力するときの時間となります.

省略した場合, 時間の原点には 自動的に 0.0 が設定されます.

Origin of time.

This time is used as time when first output is done by "HistoryPut".

If this argument is omitted, 0.0 is specified automatically.

interval :real, intent(in), optional
: 出力時間間隔.

同じ変数に対して HistoryPut が複数回 呼ばれた時に, 自動的に時間変数がこの値 だけ増やされて出力されます. なお, 各々の出力ファイルにつき HistorySetTime を一度でも用いた場合, この値は無効に なるので注意してください.

省略した場合, 自動的に 1.0 が設定されます.

Interval of output time.

When "HistoryPut" is called two or more times for the same variable, time is increased as this value and output automatically. Note that this value becomes invalid when "HistorySetTime" is used for each output file even once.

If this argument is omitted, 1.0 is specified automatically.

xtypes(:) :character(*), intent(in), optional
: dims で指定したそれぞれの 次元のデータ型.

デフォルトは float (単精度実数型) です. 有効なのは, double (倍精度実数型), int (整数型) です. 指定しない 場合や, 無効な型を指定した場合には, float となります. なお, 配列の大きさ は dims の大きさと等しい必要が あります. 配列内の文字数は全て 同じでなければなりません. 足りない文字分は空白で補います.

Data types of dimensions specified with "dims".

Default value is "float" (single precision). Other valid values are "double" (double precision), "int" (integer). If no value or invalid value is specified, "float" is applied. Length of this array must be same as length of "dim". Numbers of characters in this array must be same. Make up a deficit with blanks.

history :type(GT_HISTORY), intent(out), optional, target
: 出力ファイルの設定に関する情報を 格納した構造体.

1 つのプログラムで複数のファイル に gtool データを出力する 場合に利用します. (単独のファイルに書き出す場合は 指定する必要はありません)

Derived type that stores information about output files.

If multiple gtool4 data files are output from one program, use this argument. (If onlye one file is output, this argument is not needed).

conventions :character(*), intent(in), optional
: 出力するファイルの netCDF 規約

省略した場合, もしくは空文字を与えた場合, 出力する netCDF 規約の Conventions 属性に値 gtool4_netCDF_Conventions が自動的に与えられます.

NetCDF conventions of output file.

If this argument is omitted or, blanks are given, gtool4_netCDF_Conventions is given to attribute "Conventions" of an output file automatically.

gt_version :character(*), intent(in), optional
: gtool4 netCDF 規約のバージョン

省略した場合, gt_version 属性に 規約の最新版のバージョンナンバー gtool4_netCDF_version が与えられます. (ただし, 引数 conventions に gtool4_netCDF_Conventions 以外が与えられる場合は gt_version 属性を作成しません).

Version of gtool4 netCDF Conventions.

If this argument is omitted, latest version number of gtool4 netCDF Conventions is given to attribute "gt_version" of an output file (However, gtool4_netCDF_Conventions is not given to an argument "conventions", attribute "gt_version" is not created).

overwrite :logical, intent(in), optional
: 上書き可否

この引数に .false. を渡すと, 既存のファイルを上書きしません. デフォルトは上書きします.

Whether or not to overwrite.

If .false. is specified to this argument, an existing file is not overwritten. By default, existing file is overwritten.

quiet :logical, intent(in), optional
: .true. を与えた場合, メッセージ出力が抑制されます. デフォルトは .false. です.

If ".true." is given, messages are suppressed. Default value is ".false.".

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

gtool4 データ出力用初期設定

このサブルーチンは、gtool4 データ出力の初期設定を行います。 HistoryAddVariableHistoryCopyVariableHistoryPutHistoryAddAttrHistoryCloseHistorySetTime を用いるためには、HistoryCreate による初期設定が必要です。

なお、プログラム内で HistoryCreate を呼び出した場合、 プログラムを終了する前に必ず、 HistoryClose を呼び出して 終了処理を行なって下さい。

HistoryCreate というサブルーチン名は 2 つの別々の サブルーチンの総称名です。上記のサブルーチンも参照ください。

Two specific subroutines shares common part:

Both two ones initializes a dataset file. The result of type GT_HISTORY will be returned by history or managed internally if omitted. Mandatory global attributes are defined by arguments title, source, and institution; they are all declared as ((character(len = *))). Spatial axis definitions have two different forms: a primitive one uses several arrays of various types: dims, dimsizes, longnames, units, and xtypes. Another sophisticated one has only array of type GT_HISTORY_AXIS, axes. Temporal definition is done without origin, interval.

Alias for HistoryCreate1

HistoryGet( file, varname, array, [range], [quiet], [err] )
Subroutine :
file :character(*), intent(in)
: netCDF ファイル名. NetCDF filename.
varname :character(*), intent(in)
: 変数名. Variable name
array :real(DP), intent(out)
: 取得するデータを格納する配列

型は整数型, 単精度実数型, 倍精度実数型 かのいづれかです. 取得するデータの空 間次元のサイズと配列のサイズとが一致し ている必要があります. 入力するデータ の型と array の型が異なる場合は, 自 動的に array の型に変換されます.

Array in which input data is store

Type is integer or single precision real or double precision. Size of array must be identical to input data size. When type of input data is different from type of array, data is converted to type of array automatically.

range :character(*), intent(in), optional
: 切り出し用オプション. gtool4 変数のコンマ記法で記述 {(例: time=100.0,x=10:20,y=^1:^5)}

詳しくは gtool4 netCDF 規約 の「5.4 コンマ記法」を参照して ください.

Option for clipping. Give gtool4 comma-graphy {(ex. time=100.0,x=10:20,y=^1:^5)}

For details, see "5.4 gtool4 comma-graphy" in gtool4 netCDF Convention

quiet :logical, intent(in), optional
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Note that Japanese and English are described in parallel.

netCDF データを入力します. gtool4 netCDF 規約に基づくデータを想定 していますが, 大抵の netCDF データの入力は可能であると期待されます.

デフォルトでは, ファイル内の最新データ, すなわちデータを 時刻最大で切り出したものを入力します. 別の時刻または 別の次元で切り出したデータを 入力したい場合には, 下記の time オプションもしくは range オプションを利用してください.

file にファイル名を, varname に変数名を与えます. array にはファイルから入力されたデータが返ります. ポインタの配列へデータを入力を行う場合は, HistoryGetPointer を利用してください.

ある時刻のデータを明示したい場合には, その時刻を time に与えます. 整数型, 単精度実数型, 倍精度実数型の数値を与えることが可能です.

range には gtool4 のコンマ記法 (gtool4 netCDF 規約 の「5.4 コンマ記法」参照) を与えることで, 任意の次元で入力データを切り出すことが可能です. range に空文字を与えた場合は切り出しを行いません.

HistoryGet は複数のサブルーチンの総称名です. array には 0 〜 7 次元の整数型, 単精度実数型, 倍精度実数型の配列を与えることが可能です.

デフォルトでは, データの入力時にどのファイルのどの変数が どの次元で切り出されて入力されたのかを表示します. メッセージ出力が不要な場合は quiet に .true. を与えてください.

Input netCDF data. NetCDF data with gtool4 conventions is assumed, but most netCDF data is expected to be input.

Give filename to file, variable name to varname. Input data is returned to array. If you want to use pointer array, use "HistoryGetPointer".

By default, recent data, that is to say, data clipped with maximum time is input. In order to input data clipped with other time or other dimension, use time option or range option as follows.

In order to get data at certain time, specify the time to time. Type is integer or single precision real or double precision.

Give gtool4 comma-graphy (See "5.4 gtool4 comma-graphy" in gtool4 netCDF Convention) to range, then input data can be clipped by an arbitrary dimension. If null character is given to range, data is not clipped.

HistoryGet is generic name of multiple subroutines. Integer, single precision real, and double precision real 0 — 7 rank array can be given to array.

By default, when data is input, filename and variable name and clipping information is printed. The message is suppressed when .true. is given to quiet

Original external subprogram is historyget.f90#HistoryGetDouble0

HistoryGet( file, varname, array, [range], [quiet], [err] )
Subroutine :
file :character(*), intent(in)
varname :character(*), intent(in)
array :integer, intent(out)
range :character(*), intent(in), optional
quiet :logical, intent(in), optional
err :logical, intent(out), optional

Note that Japanese and English are described in parallel.

使用方法に関しては HistoryGet を参照してください.

See "HistoryGet", for basic usage.

Original external subprogram is historyget.f90#HistoryGetInt0

HistoryGet( file, varname, array, [range], [quiet], [err] )
Subroutine :
file :character(*), intent(in)
varname :character(*), intent(in)
array :real, intent(out)
range :character(*), intent(in), optional
quiet :logical, intent(in), optional
err :logical, intent(out), optional

Note that Japanese and English are described in parallel.

使用方法に関しては HistoryGet を参照してください.

See "HistoryGet", for basic usage.

Original external subprogram is historyget.f90#HistoryGetReal0

HistoryGet( file, varname, array, [range], [quiet], [err] )
Subroutine :
file :character(*), intent(in)
varname :character(*), intent(in)
array(:) :integer, intent(out)
range :character(*), intent(in), optional
quiet :logical, intent(in),