Class gt4_history
In: gt4_history.f90

gtool4 データ入出力用 F90 インターフェース

概要

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

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

書式

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

    use gt4_history

手続き一覧

【出力用】

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

【入力用】

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

【その他】

HistoryInquire :GT_HISTORY 型変数への問い合わせ

構造体

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" の部分には本来ファイルを生成したユーザ名 が与えられるべきです。その後ろにはファイルの生成を 開始した時刻が与えられます。

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

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_AXIS   GT_HISTORY_VARINFO   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddAttr   HistoryAddVariable   HistoryAddVariable   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisAddAttr   HistoryAxisClear   HistoryAxisCopy   HistoryAxisCreate   HistoryAxisInquire   HistoryClose   HistoryCopy   HistoryCopyVariable   HistoryCreate   HistoryCreate   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   HistoryInquire   HistoryInquire   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPut   HistoryPutEx   HistoryPutEx   HistorySetTime   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoAddAttr   HistoryVarinfoClear   HistoryVarinfoCopy   HistoryVarinfoCreate   HistoryVarinfoInquire   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   gtool4_netCDF_Conventions   gtool4_netCDF_version   lookup_variable_ord  

Included Modules

gtdata_types dc_types dc_trace dc_date gtdata_generic dc_error dc_string dc_url dc_present dc_message netcdf_f77 regex

Attributes

Public Instance methods

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 以降の引数は、コピーの際に上書きする値です。

[Source]

  subroutine HistoryAxisCopy1(axis_dest, axis_src, err,  name, length, longname, units, xtype)
    !
    !== GT_HISTORY_AXIS 型変数コピー
    !
    ! GT_HISTORY_AXIS 型の変数 *axis_src* を
    ! *axis_dest* にコピーします。
    ! *axis_src* は HistoryAxisCreate によって初期設定されている必要が
    ! あります。
    ! さらに属性を付加する場合には HistoryAxisAddAttr
    ! を用いてください。
    !
    ! *err* を与えておくと、コピーの際何らかの不具合が生じても
    ! 終了せずに err が真になって返ります。
    ! 
    ! *err* 以降の引数は、コピーの際に上書きする値です。
    !
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    use dc_present,only: present_select
    implicit none
    type(GT_HISTORY_AXIS),intent(out) :: axis_dest ! コピー先 GT_HISTORY_AXIS
    type(GT_HISTORY_AXIS),intent(in)  :: axis_src  ! コピー元 GT_HISTORY_AXIS
    logical, intent(out), optional :: err
    character(*) , intent(in), optional:: name     ! 次元変数名
    integer, intent(in), optional:: length         ! 次元長 (配列サイズ)
    character(*) , intent(in), optional:: longname ! 次元変数の記述的名称
    character(*) , intent(in), optional:: units    ! 次元変数の単位
    character(*) , intent(in), optional:: xtype    ! 次元変数の型
    character(STRING), parameter:: subname = "HistoryAxisCopy1"
  continue
    call BeginSub(subname)
    axis_dest % name     = present_select('', axis_src % name, name)
    axis_dest % length   = present_select(.false., axis_src % length, length)
    axis_dest % longname = present_select('', axis_src % longname, longname)
    axis_dest % units    = present_select('', axis_src % units, units)
    axis_dest % xtype    = present_select('', axis_src % xtype, xtype)

    if (associated( axis_src % attrs ) ) then
      allocate(  axis_dest % attrs( size( axis_src % attrs) )  )
      call HistoryAttrCopy( from = axis_src % attrs,                 to = axis_dest % attrs, err = err)
    end if
    call EndSub(subname)
  end subroutine HistoryAxisCopy1
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 が与えられない場合は default が参照される. HistoryCreate と同様に, 出力の初期設定を行う. file は必ず与えなければならず, hist_src と同じファイルへ出力 しようとする場合は下層でエラーを生じる.

それ以降の引数は hist_src の設定を上書きするためのものである.

[Source]

  subroutine HistoryCopy1(hist_dest, file, hist_src,  title, source, institution,  origin, interval,  conventions, gt_version)
    !
    ! hist_src の内容にコピーし, hist_dest へ返す.
    ! hist_src が与えられない場合は default が参照される.
    ! HistoryCreate と同様に, 出力の初期設定を行う. file
    ! は必ず与えなければならず, hist_src と同じファイルへ出力
    ! しようとする場合は下層でエラーを生じる.
    !
    ! それ以降の引数は hist_src の設定を上書きするためのものである.
    !
    use gtdata_generic, only: Inquire, Get_Attr, Copy_Attr, Get, Put
!      use dc_url,    only:
    use dc_error,   only: StoreError, DC_NOERR, GT_EARGSIZEMISMATCH
!      use dc_string, only:
    use dc_present, only: present_select
    use dc_types,   only: string, token
    implicit none
    type(GT_HISTORY), intent(out), target :: hist_dest
    character(*),     intent(in)          :: file
    type(GT_HISTORY), intent(in), optional, target:: hist_src
    character(*),     intent(in), optional:: title, source, institution

!!!$      type(GT_HISTORY_AXIS), intent(in),optional :: axes(:)
!!!$      type(GT_HISTORY_AXIS), intent(in),optional :: addaxes(:)
!!!$      character(*),     intent(in), optional:: dims(:)
!!!$      integer,          intent(in), optional:: dimsizes(:)
!!!$      character(*),     intent(in), optional:: longnames(:)
!!!$      character(*),     intent(in), optional:: units(:)
    real,             intent(in), optional:: origin, interval

!!!$      character(*),     intent(in), optional:: xtypes(:)
    character(*),     intent(in), optional:: conventions, gt_version

    ! Internal Work
    type(GT_HISTORY), pointer:: src =>null()
    character(STRING) :: title_src, source_src, institution_src
    character(STRING) :: conventions_src, gt_version_src
    character(STRING), pointer:: dims(:) => null()
    integer          , pointer:: dimsizes(:) => null()
    character(STRING), pointer:: longnames(:) => null()
    character(STRING), pointer:: units(:)  => null()
    character(STRING), pointer:: xtypes(:) => null()
    integer  :: i, numdims
    logical        :: err
    real(DP),pointer :: dimvalue(:) => null()
    character(len = *),parameter:: subname = "HistoryCopy1"
  continue
    call BeginSub(subname, 'file=<%c>', c1=trim(file))

    if (present(hist_src)) then
      src => hist_src
    else
      src => default
    endif
    numdims = size(src % dimvars)

    call HistoryInquire1(history=src, title=title_src,  source=source_src, institution=institution_src,  dims=dims, dimsizes=dimsizes, longnames=longnames,  units=units, xtypes=xtypes,  conventions=conventions_src, gt_version=gt_version_src)

    call HistoryCreate1(file=trim(file),  title=trim(present_select('', title_src, title)),  source=trim(present_select('', source_src, source)),  institution=trim(present_select('', institution_src, institution)),  dims=dims, dimsizes=dimsizes, longnames=longnames, units=units,  origin=present_select(.false., src % origin, origin),  interval=present_select(0.0, src % interval, interval),  xtypes=xtypes,  history=hist_dest,  conventions=trim(present_select('', conventions_src, conventions)),  gt_version=trim(present_select('', gt_version_src, gt_version)) )

    !
    ! 次元変数が属性を持っている場合のことも考え, 最後に直接
    ! hist_dst % dimvars へ copy_attr (gtvarcopyattrall) をかける.
    !
    do i = 1, numdims
      call Copy_Attr(hist_dest % dimvars(i), src % dimvars (i), global=.false.)
    end do

    ! dimvars を Get してみて, 値を持っているようならデータを与えてしまう.
    do i = 1, numdims
      if (dimsizes(i) == 0) cycle
      call Get(src % dimvars(i), dimvalue, err)
      if (err) cycle
      call HistoryPutDoubleEx(dims(i), dimvalue, size(dimvalue), hist_dest)
      deallocate(dimvalue)
    end do

    deallocate(dims, dimsizes, longnames, units, xtypes)

    call EndSub(subname)
  end subroutine HistoryCopy1
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 以降の引数は、コピーの際に上書きする値です。

[Source]

  subroutine HistoryVarinfoCopy1(varinfo_dest, varinfo_src, err,  name, dims, longname, units, xtype)
    !
    !== GT_HISTORY_VARINFO 型変数コピー
    !
    ! GT_HISTORY_VARINFO 型の変数 *varinfo_src* を
    ! *varinfo_dest* にコピーします。
    ! *varinfo_src* は HistoryVarinfoCreate によって初期設定されている必要が
    ! あります。
    ! さらに属性を付加する場合には HistoryVarinfoAddAttr
    ! を用いてください。
    !
    ! *err* を与えておくと、コピーの際何らかの不具合が生じても
    ! 終了せずに err が真になって返ります。
    !
    ! *err* 以降の引数は、コピーの際に上書きする値です。
    !
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    use dc_present,only: present_select
    implicit none
    type(GT_HISTORY_VARINFO),intent(out) :: varinfo_dest
    type(GT_HISTORY_VARINFO),intent(in)  :: varinfo_src
    logical,               intent(out), optional :: err
    character(*) , intent(in), optional:: name     ! 次元変数名
    character(*) , intent(in), optional, target:: dims(:)  ! 依存する次元
    character(*) , intent(in), optional:: longname ! 次元変数の記述的名称
    character(*) , intent(in), optional:: units    ! 次元変数の単位
    character(*) , intent(in), optional:: xtype    ! 次元変数の型
    integer                      :: i
    character(TOKEN), pointer :: srcdims(:) =>null() ! 依存する次元
    character(STRING), parameter:: subname = "HistoryVarinfoCopy1"
  continue
    call BeginSub(subname)
    varinfo_dest % name     = present_select('', varinfo_src % name, name)
    varinfo_dest % longname = present_select('', varinfo_src % longname, longname)
    varinfo_dest % units    = present_select('', varinfo_src % units, units)
    varinfo_dest % xtype    = present_select('', varinfo_src % xtype, xtype)

    if (present(dims)) then
      srcdims => dims
    else
      srcdims => varinfo_src % dims
    endif

    allocate(  varinfo_dest % dims( size( srcdims ) )  )
    do i = 1, size(dims)
      varinfo_dest % dims(i) = srcdims(i)
    end do

    if (associated( varinfo_src % attrs ) ) then
      allocate(  varinfo_dest % attrs( size( varinfo_src % attrs) )  )
      call HistoryAttrCopy( from = varinfo_src % attrs,                 to = varinfo_dest % attrs, err = err)
    end if
    call EndSub(subname)
  end subroutine HistoryVarinfoCopy1
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

[Source]

  subroutine HistoryAxisCreate1( axis,  name, size, longname, units, xtype)
    !
    !== GT_HISTORY_AXIS 型変数作成
    !
    ! GT_HISTORY_AXIS 型変数を作成します。
    ! このサブルーチンによる設定の後、
    ! HistoryCreate の *axes* に与えます。
    ! さらに属性を付加する場合には HistoryAxisAddAttr
    ! を用いてください。
    !
    ! Constructor of GT_HISTORY_AXIS
    !
    use dc_types, only: STRING, TOKEN, DP
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    implicit none
    type(GT_HISTORY_AXIS),intent(out) :: axis
    character(*) , intent(in):: name     ! 次元変数名
    integer, intent(in):: size     ! 次元長 (配列サイズ)
    character(*) , intent(in):: longname ! 次元変数の記述的名称
    character(*) , intent(in):: units    ! 次元変数の単位
    character(*) , intent(in):: xtype    ! 次元変数の型
    character(len = *), parameter:: subname = "HistoryAxisCreate1"
  continue
    call BeginSub(subname)
    axis % name = name
    axis % length = size
    axis % longname = longname
    axis % units = units
    axis % xtype = xtype
    call EndSub(subname)
  end subroutine HistoryAxisCreate1
Subroutine :
varinfo :type(GT_HISTORY_VARINFO),intent(out)
name :character(*) , intent(in)
: 次元変数名
dims(:) :character(*) , intent(in)
: 依存する次元
longname :character(*) , intent(in)
: 次元変数の記述的名称
units :character(*) , intent(in)
: 次元変数の単位
xtype :character(*) , intent(in)
: 次元変数の型

GT_HISTORY_VARINFO 型変数作成

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

Constructor of GT_HISTORY_VARINFO

[Source]

  subroutine HistoryVarinfoCreate1( varinfo,  name, dims, longname, units, xtype)
    !
    !== GT_HISTORY_VARINFO 型変数作成
    !
    ! GT_HISTORY_VARINFO 型変数を作成します。
    ! このサブルーチンによる設定の後、
    ! HistoryAddVariable の *varinfo* に与えます。
    ! さらに属性を付加する場合には HistoryVarinfoAddAttr
    ! を用いてください。
    !
    ! Constructor of GT_HISTORY_VARINFO
    !
    use dc_types, only: STRING, TOKEN, DP
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    use dc_message, only: MessageNotify
    implicit none
    type(GT_HISTORY_VARINFO),intent(out) :: varinfo
    character(*) , intent(in):: name     ! 次元変数名
    character(*) , intent(in):: dims(:)  ! 依存する次元
    character(*) , intent(in):: longname ! 次元変数の記述的名称
    character(*) , intent(in):: units    ! 次元変数の単位
    character(*) , intent(in):: xtype    ! 次元変数の型

    ! Internal Work
    integer:: i, numdims
    character(len = *), parameter:: subname = "HistoryVarinfoCreate1"
  continue
    call BeginSub(subname)
    varinfo % name = name
    varinfo % longname = longname
    varinfo % units = units
    varinfo % xtype = xtype
    numdims = size(dims)
    allocate(varinfo % dims(numdims))
    do i = 1, numdims
      varinfo % dims(i) = dims(i)
      if (len(trim(dims(i))) > TOKEN) then
        call MessageNotify('W', subname,  'dimension name <%c> is trancated to <%c>',  c1=trim(dims(i)), c2=trim(varinfo % dims(i)))
      end if
    end do
    call EndSub(subname)
  end subroutine HistoryVarinfoCreate1
GT_HISTORY()
Derived Type :

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 :

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

この型の変数は 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 :

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

この型の変数は 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.

Subroutine :
varname :character(*), intent(in)
: 変数の名前。

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

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

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

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

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

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

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

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

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

[Source]

  subroutine HistoryAddAttrChar0(  varname, attrname, value, history)
    !
    !
    !== gtool4 データ内の変数への属性付加
    !
    ! gtool4 データおよびそのデータ内の変数に属性を付加します。
    ! このサブルーチンを用いる前に、 HistoryCreate による初期設定が
    ! 必要です。
    !
    ! 属性名 *attrname* の先頭にプラス "<b><tt>+</tt></b>" を付加する
    ! 場合は、gtool4 データ自体の属性 (大域属性) として属性が付加されます
    ! この場合、*varname* は無視されますが、その場合でも *varname* へは
    ! 引数の解説にもある通り有効な値を与えてください。
    !
    ! *HistoryAddAttr* は複数のサブルーチンの総称名です。*value* には
    ! いくつかの型を与えることが可能です。
    ! 下記のサブルーチンを参照ください。
    !
    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname
                                        ! 変数の名前。
                                        !
                                        ! ここで指定するものは、
                                        ! HistoryCreateの *dims* 、
                                        ! または HistoryAddVariable の
                                        ! *varname* で既に指定されてい
                                        ! なければなりません。
                                        ! 
    character(*), intent(in):: attrname
                                        ! 変数またはファイル全体に付
                                        ! 加する属性の名前
                                        !
                                        ! "<b><tt>+</tt></b>" (プラ
                                        ! ス) を属性名の先頭につける
                                        ! 場合には、ファイル全体に属
                                        ! 性を付加します。
                                        ! ファイル全体へ属性を付加
                                        ! する場合でも、 HistoryCreate
                                        ! の *dims* 、または
                                        ! HistoryAddVariable の
                                        ! *varname* で既に指定されてい
                                        ! る変数を *varname* に指定する
                                        ! 必要があります。
                                        ! 
    character(*), intent(in):: value
                                        ! 属性の値
                                        ! 
    type(GT_HISTORY), target, optional:: history
                                        ! 出力ファイルの設定に関する情報を
                                        ! 格納した構造体
                                        ! 
                                        ! ここに指定するものは、
                                        ! HistoryCreate によって初期設定
                                        ! されていなければなりません。
                                        ! 
    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrChar0"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(value))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, value)
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, value)
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :integer, intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrInt0(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    integer, intent(in):: value

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrInt0"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, (/value/))
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, (/value/))
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :logical, intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrLogical0(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    logical, intent(in):: value

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrLogical0"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, value)
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, value)
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :real(DP), intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrDouble0(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    real(DP), intent(in):: value

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrDouble0"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, (/value/))
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, (/value/))
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :real, intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrReal0(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    real, intent(in):: value

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrReal0"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, (/value/))
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, (/value/))
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :integer, intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrInt1(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    integer, intent(in):: value(:)

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrInt1"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, (/value/))
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, (/value/))
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :real(DP), intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrDouble1(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    real(DP), intent(in):: value(:)

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrDouble1"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, (/value/))
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, (/value/))
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :real, intent(in)
history :type(GT_HISTORY), target, optional

[Source]

  subroutine HistoryAddAttrReal1(  varname, attrname, value, history)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_PLUS
    use dc_error, only: DC_NOERR
    implicit none
    character(*), intent(in):: varname

    character(*), intent(in):: attrname

    real, intent(in):: value(:)

    type(GT_HISTORY), target, optional:: history

    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE):: var
    integer:: v_ord
    logical:: err
    character(len = *), parameter:: subname = "HistoryAddAttrReal1"
  continue
    call BeginSub(subname,  'varname=<%c> attrname=<%c>, value=<%c>',  c1=trim(varname), c2=trim(attrname), c3=trim(toChar(value)))
    ! 操作対象決定
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    if (varname == "") then
      ! とりあえず無駄だが大域属性を何度もつける
      do, v_ord = 1, size(hst%vars)
        call Put_Attr(hst%vars(v_ord), GT_PLUS // attrname, (/value/))
      enddo
    else
      call lookup_var_or_dim(hst, varname, var, err)
      if (.not. err) then
        call Put_Attr(var, attrname, (/value/))
      endif
    endif
    call EndSub(subname)
  end subroutine
Subroutine :
varinfo :type(GT_HISTORY_VARINFO), intent(in)
: 変数情報を格納した構造体

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

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

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

変数定義

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

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

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

[Source]

  subroutine HistoryAddVariable2(varinfo, history)
    !
    !== 変数定義
    !
    ! gtool4 データ内の変数の定義を行います。このサブルーチンを
    ! 用いる前に、 HistoryCreate による初期設定が必要です。
    !
    ! 既に gtool4 データが存在し、そのデータ内の変数と全く同じ
    ! 構造の変数を定義したい場合は HistoryCopyVariable を利用すると
    ! 便利です。
    !
    ! *HistoryAddVariable* というサブルーチン名は 2 つの別々の
    ! サブルーチンの総称名です。下記のサブルーチンも参照ください。
    !
    use dc_string, only: JoinChar
    implicit none
    type(GT_HISTORY_VARINFO), intent(in)             :: varinfo
                                        ! 変数情報を格納した構造体
                                        ! 
                                        ! ここに指定するものは、
                                        ! HistoryVarinfoCreate によって
                                        ! 初期設定されていなければなりません。
                                        ! 
    type(GT_HISTORY),         intent(inout), optional:: history
                                        ! 出力ファイルの設定に関する情報を
                                        ! 格納した構造体
                                        ! 
                                        ! ここに指定するものは、
                                        ! HistoryCreate によって初期設定
                                        ! されていなければなりません。
                                        ! 
    character(len = *), parameter:: subname = "HistoryAddVariable2"
  continue
    call BeginSub(subname, 'varname=<%c>, dims=<%c>, longname=<%c>',  c1=trim(varinfo%name), c2=trim(JoinChar(varinfo%dims)),    c3=trim(varinfo%longname)                               )
    call HistoryAddVariable1(trim(varinfo%name),  varinfo%dims, trim(varinfo%longname),  trim(varinfo%units), trim(varinfo%xtype), history)
    if (associated( varinfo % attrs )) then
      call HistoryAttrAdd( varinfo % name, varinfo % attrs, history )
    end if
    call EndSub(subname)
  end subroutine HistoryAddVariable2
Subroutine :
varname :character(len = *), intent(in)
: 定義する変数の名前

最大文字数は dc_type#TOKEN

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

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

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 (単精度実数型) となる。

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

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

変数定義

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

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

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

[Source]

  subroutine HistoryAddVariable1(varname, dims, longname, units,  xtype, history)
    !
    !== 変数定義
    !
    ! gtool4 データ内の変数の定義を行います。このサブルーチンを
    ! 用いる前に、 HistoryCreate による初期設定が必要です。
    !
    ! 既に gtool4 データが存在し、そのデータ内の変数と全く同じ
    ! 構造の変数を定義したい場合は HistoryCopyVariable を利用すると便
    ! 利です。
    !
    ! *HistoryAddVariable* というサブルーチン名は 2 つの別々の
    ! サブルーチンの総称名です。上記のサブルーチンも参照ください。
    !
    use netcdf_f77, only: NF_EBADDIM
    use dc_error, only: StoreError, DC_NOERR
    use dc_string, only: CPrintf
    use gtdata_generic, only: Inquire, Create, Slice, Put_Attr
    use dc_url, only: GT_ATMARK, UrlResolve
    use dc_types, only: STRING
    implicit none
    character(len = *), intent(in):: varname
                                        ! 定義する変数の名前
                                        ! 
                                        ! 最大文字数は dc_type#TOKEN
                                        ! 
    character(len = *), intent(in):: dims(:)
                                        ! 変数が依存する次元の名前
                                        !
                                        ! 時間の次元は配列の最後に指定
                                        ! しなければならない。
                                        ! ここで指定するものは、
                                        ! HistoryCreate にて dims で指定
                                        ! されていなければならない。
                                        ! 
    character(len = *), intent(in):: longname
                                        ! 変数の記述的名称
                                        !
                                        ! 最大文字数は dc_types#STRING
                                        ! 
    character(len = *), intent(in):: units
                                        ! 変数の単位
                                        ! 
                                        ! 最大文字数は dc_types#STRING
                                        ! 
    character(len = *), intent(in), optional:: xtype
                                        ! 変数のデータ型
                                        ! 
                                        ! デフォルトはfloat (単精度実数型)
                                        ! である。 有効なのは、
                                        ! double (倍精度実数型)、 int
                                        ! (整数型)である。 指定しない
                                        ! 場合や、無効な型を指定した
                                        ! 場合には、 float (単精度実数型)
                                        ! となる。
                                        ! 
    type(GT_HISTORY), intent(inout), optional, target:: history
                                        ! 出力ファイルの設定に関する情報を
                                        ! 格納した構造体
                                        ! 
                                        ! ここに指定するものは、
                                        ! HistoryCreate によって初期設定
                                        ! されていなければなりません。
                                        ! 
    type(GT_HISTORY), pointer:: hst =>null()
    type(GT_VARIABLE), pointer:: vwork(:) =>null(), dimvars(:) =>null()
    character(len = STRING):: fullname, url, cause_c
    integer, pointer:: count_work(:) =>null()
    integer:: nvars, numdims, i, dimord, stat
    character(len = *), parameter:: subname = "HistoryAddVariable1"
  continue
    call BeginSub(subname, 'name=%c', c1=varname)
    stat = DC_NOERR
    !----- 操作対象決定 -----
    if (present(history)) then
      hst => history
    else
      hst => default
    endif

    !----- 変数表拡張 -----
    if (associated(hst%vars)) then
      nvars = size(hst%vars(:))
      vwork => hst%vars
      count_work => hst%count
      nullify(hst%vars, hst%count)
      allocate(hst%vars(nvars + 1), hst%count(nvars + 1))
      hst%vars(1:nvars) = vwork(1:nvars)
      hst%count(1:nvars) = count_work(1:nvars)
      deallocate(vwork, count_work)
      count_work => hst%growable_indices
      nullify(hst%growable_indices)
      allocate(hst%growable_indices(nvars + 1))
      hst%growable_indices(1:nvars) = count_work(1:nvars)
      deallocate(count_work)
    else
      ! トリッキーだが、ここで count だけ 2 要素確保するのは、
      ! HistorySetTime による巻き戻しに備えるため。
      allocate(hst%vars(1), hst%count(2), hst%growable_indices(1))
      hst%count(2) = 0
    endif
    nvars = size(hst%vars(:))
    hst%growable_indices(nvars) = 0
    hst%count(nvars) = 0

    !----- 変数添字次元を決定 -----
    numdims = size(dims(:))
    allocate(dimvars(numdims))
    do, i = 1, numdims
      ! hst 内で, 次元変数名 dim(i) に当たる次元変数の ID である
      ! hst%dimvar(i) を dimvars(i) に, 添字を dimord に
      dimvars(i) = lookup_dimension(hst, dims(i), ord=dimord)
      if (dimord == 0) then
        stat = NF_EBADDIM
        cause_c = CPrintf('"%c" dimension is not found.', c1=trim(dims(i)))
        goto 999
      end if
      ! 無制限次元の添字と一致する場合に,
      ! その添字を hst%growable_indices(nvars) に
      if (dimord == hst%unlimited_index) then
        hst%growable_indices(nvars) = i
      endif
    enddo

    !----- 変数作成 -----
    call Inquire(hst%dimvars(1), url=url)
    fullname = UrlResolve((GT_ATMARK // trim(varname)), trim(url))
    call Create(hst%vars(nvars), trim(fullname), dimvars, xtype=xtype)
    ! 拡張可能次元があったらそれをサイズ 1 に拡張しておく
    if (hst%growable_indices(nvars) /= 0) then
      call Slice(hst%vars(nvars), hst%growable_indices(nvars),  start=1, count=1, stride=1)
    endif
    call put_attr(hst%vars(nvars), 'long_name', longname)
    call put_attr(hst%vars(nvars), 'units', units)
    deallocate(dimvars)
999 continue
    call StoreError(stat, subname, cause_c=cause_c)
    call EndSub(subname)
  end subroutine HistoryAddVariable1
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 には様々な型の引数を与えることが可能です。 下記のサブルーチンを参照ください。

[Source]

  subroutine HistoryAxisAddAttrChar0(  axis, attrname, value)
    !
    !
    !== GT_HISTORY_AXIS 型変数への属性付加
    !
    ! GT_HISTORY_AXIS 型の変数 *axis* へ属性を付加します。
    !
    ! *HistoryAxisAddAttr* は複数のサブルーチンの総称名です。
    ! value には様々な型の引数を与えることが可能です。
    ! 下記のサブルーチンを参照ください。
    !
    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    character(*), intent(in):: value
                                        ! 属性に与えられる値
                                        ! 
                                        ! 配列の場合でも、数値型以外
                                        ! では配列の 1 つ目の要素のみ
                                        ! 値として付加されます。
                                        ! 
    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrChar0"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(value))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Char'
    axis % attrs(attrs_num) % array     = .false.
    axis % attrs(attrs_num) % Charvalue = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrChar0
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :integer, intent(in)

[Source]

  subroutine HistoryAxisAddAttrInt0(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    integer, intent(in):: value

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrInt0"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Int'
    axis % attrs(attrs_num) % array     = .false.
    axis % attrs(attrs_num) % Intvalue = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrInt0
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :logical, intent(in)

[Source]

  subroutine HistoryAxisAddAttrLogical0(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    logical, intent(in):: value

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrLogical0"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Logical'
    axis % attrs(attrs_num) % array     = .false.
    axis % attrs(attrs_num) % Logicalvalue = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrLogical0
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :real(DP), intent(in)

[Source]

  subroutine HistoryAxisAddAttrDouble0(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    real(DP), intent(in):: value

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrDouble0"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Double'
    axis % attrs(attrs_num) % array     = .false.
    axis % attrs(attrs_num) % Doublevalue = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrDouble0
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value :real, intent(in)

[Source]

  subroutine HistoryAxisAddAttrReal0(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    real, intent(in):: value

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrReal0"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Real'
    axis % attrs(attrs_num) % array     = .false.
    axis % attrs(attrs_num) % Realvalue = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrReal0
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value(:) :integer, intent(in)

[Source]

  subroutine HistoryAxisAddAttrInt1(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    integer, intent(in):: value(:)

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrInt1"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Int'
    axis % attrs(attrs_num) % array                = .true.
    allocate(  axis % attrs(attrs_num) % Intarray( size(value) )  )
    axis % attrs(attrs_num) % Intarray    = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrInt1
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value(:) :real(DP), intent(in)

[Source]

  subroutine HistoryAxisAddAttrDouble1(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    real(DP), intent(in):: value(:)

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrDouble1"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Double'
    axis % attrs(attrs_num) % array                = .true.
    allocate(  axis % attrs(attrs_num) % Doublearray( size(value) )  )
    axis % attrs(attrs_num) % Doublearray    = value

    call EndSub(subname)
  end subroutine HistoryAxisAddAttrDouble1
Subroutine :
axis :type(GT_HISTORY_AXIS),intent(inout)
attrname :character(*), intent(in)
: 属性の名前
value(:) :real, intent(in)

[Source]

  subroutine HistoryAxisAddAttrReal1(  axis, attrname, value)
    !

    !
    use gtdata_generic, only: Put_Attr
    use dc_string     , only: toChar, JoinChar
    use dc_url        , only: GT_PLUS
    implicit none
    type(GT_HISTORY_AXIS),intent(inout) :: axis
    character(*), intent(in):: attrname ! 属性の名前
    real, intent(in):: value(:)

    type(GT_HISTORY_ATTR), pointer:: attrs_tmp(:)
    integer:: attrs_num
    character(STRING) :: name
    character(*), parameter:: subname = "HistoryAxisAddAttrReal1"
  continue
    call BeginSub(subname,  'attrname=<%c>, value=<%c>',  c1=trim(attrname), c2=trim(toChar(value)))
    call HistoryAxisInquire1( axis, name )
    call DbgMessage('axis name=<%c>', c1=trim(name))

    ! これまでの属性を保持しつつ配列を1つ増やす
    if ( .not. associated(axis % attrs) ) then
      allocate( axis % attrs(1) )
      attrs_num = 1
    else
      attrs_num = size( axis % attrs ) + 1
      ! 配列データの領域確保
      allocate( attrs_tmp(attrs_num - 1) )
      call HistoryAttrCopy( from = axis % attrs(1:attrs_num - 1),                  to = attrs_tmp(1:attrs_num - 1))
      deallocate( axis % attrs )
      allocate( axis % attrs(attrs_num) )
      call HistoryAttrCopy( from = attrs_tmp(1:attrs_num - 1),                  to = axis % attrs(1:attrs_num - 1))
      deallocate( attrs_tmp )
    endif

    axis % attrs(attrs_num) % attrname  = attrname
    axis % attrs(attrs_num) % attrtype  = 'Real'
    axis % attrs(attrs_num) % array                = .true.
    allocate(  axis % attrs(attrs_num) % Realarray( size(value) )  )
    axis % attrs(attrs_num) % Realarray    = value

    call EndSub(subname)
  end subroutine 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
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 以降の引数は、コピーの際に上書きする値です。

[Source]

  subroutine HistoryAxisCopy1(axis_dest, axis_src, err,  name, length, longname, units, xtype)
    !
    !== GT_HISTORY_AXIS 型変数コピー
    !
    ! GT_HISTORY_AXIS 型の変数 *axis_src* を
    ! *axis_dest* にコピーします。
    ! *axis_src* は HistoryAxisCreate によって初期設定されている必要が
    ! あります。
    ! さらに属性を付加する場合には HistoryAxisAddAttr
    ! を用いてください。
    !
    ! *err* を与えておくと、コピーの際何らかの不具合が生じても
    ! 終了せずに err が真になって返ります。
    ! 
    ! *err* 以降の引数は、コピーの際に上書きする値です。
    !
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    use dc_present,only: present_select
    implicit none
    type(GT_HISTORY_AXIS),intent(out) :: axis_dest ! コピー先 GT_HISTORY_AXIS
    type(GT_HISTORY_AXIS),intent(in)  :: axis_src  ! コピー元 GT_HISTORY_AXIS
    logical, intent(out), optional :: err
    character(*) , intent(in), optional:: name     ! 次元変数名
    integer, intent(in), optional:: length         ! 次元長 (配列サイズ)
    character(*) , intent(in), optional:: longname ! 次元変数の記述的名称
    character(*) , intent(in), optional:: units    ! 次元変数の単位
    character(*) , intent(in), optional:: xtype    ! 次元変数の型
    character(STRING), parameter:: subname = "HistoryAxisCopy1"
  continue
    call BeginSub(subname)
    axis_dest % name     = present_select('', axis_src % name, name)
    axis_dest % length   = present_select(.false., axis_src % length, length)
    axis_dest % longname = present_select('', axis_src % longname, longname)
    axis_dest % units    = present_select('', axis_src % units, units)
    axis_dest % xtype    = present_select('', axis_src % xtype, xtype)

    if (associated( axis_src % attrs ) ) then
      allocate(  axis_dest % attrs( size( axis_src % attrs) )  )
      call HistoryAttrCopy( from = axis_src % attrs,                 to = axis_dest % attrs, err = err)
    end if
    call EndSub(subname)
  end subroutine HistoryAxisCopy1
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

[Source]

  subroutine HistoryAxisCreate1( axis,  name, size, longname, units, xtype)
    !
    !== GT_HISTORY_AXIS 型変数作成
    !
    ! GT_HISTORY_AXIS 型変数を作成します。
    ! このサブルーチンによる設定の後、
    ! HistoryCreate の *axes* に与えます。
    ! さらに属性を付加する場合には HistoryAxisAddAttr
    ! を用いてください。
    !
    ! Constructor of GT_HISTORY_AXIS
    !
    use dc_types, only: STRING, TOKEN, DP
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    implicit none
    type(GT_HISTORY_AXIS),intent(out) :: axis
    character(*) , intent(in):: name     ! 次元変数名
    integer, intent(in):: size     ! 次元長 (配列サイズ)
    character(*) , intent(in):: longname ! 次元変数の記述的名称
    character(*) , intent(in):: units    ! 次元変数の単位
    character(*) , intent(in):: xtype    ! 次元変数の型
    character(len = *), parameter:: subname = "HistoryAxisCreate1"
  continue
    call BeginSub(subname)
    axis % name = name
    axis % length = size
    axis % longname = longname
    axis % units = units
    axis % xtype = xtype
    call EndSub(subname)
  end subroutine HistoryAxisCreate1
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 型の変数内の各情報を参照します。

[Source]

  subroutine HistoryAxisInquire1( axis,  name, size, longname, units, xtype)
    !
    !== GT_HISTORY_AXIS 型変数への問い合わせ
    !
    ! GT_HISTORY_AXIS 型の変数内の各情報を参照します。
    !
    use dc_types, only: STRING, TOKEN, DP
    use dc_trace, only: BeginSub, EndSub, DbgMessage
    implicit none
    type(GT_HISTORY_AXIS),intent(in) :: axis
    character(*) , intent(out), optional:: name     ! 次元変数名
    integer, intent(out), optional:: size     ! 次元長 (配列サイズ)
    character(*) , intent(out), optional:: longname ! 次元変数の記述的名称
    character(*) , intent(out), optional:: units    ! 次元変数の単位
    character(*) , intent(out), optional:: xtype    ! 次元変数の型
    character(len = *), parameter:: subname = "HistoryAxisInquire1"
  continue
    call BeginSub(subname)
    if (present(name)) then
      name     = axis % name
    end if
    if (present(size)) then
      size     = axis % length
    end if
    if (present(longname)) then
      longname = axis % longname
    end if
    if (present(units)) then
      units    = axis % units
    end if
    if (present(xtype)) then
      xtype    = axis % xtype
    end if
    call EndSub(subname)
  end subroutine HistoryAxisInquire1
Subroutine :
history :type(GT_HISTORY), intent(inout), optional, target
: 出力ファイルの設定に関する情報を 格納した構造体

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

終了処理

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

[Source]

  subroutine HistoryClose(history)
    !
    !== 終了処理
    !
    ! HistoryCreate で始まったデータ出力の終了処理をおこなうものです。
    ! プログラム内で HistoryCreate を用いた場合、プログラムを終了する
    ! 前に必ずこのサブルーチンを呼んで下さい。
    !
    use gtdata_generic, only: Close
    type(GT_HISTORY), intent(inout), optional, target:: history
                                        ! 出力ファイルの設定に関する情報を
                                        ! 格納した構造体
                                        ! 
                                        ! ここに指定するものは、
                                        ! HistoryCreate によって初期設定
                                        ! されていなければなりません。
                                        ! 
    type(GT_HISTORY), pointer:: hst =>null()
    integer:: i
    character(len = *), parameter:: subname = "HistoryClose"
  continue
    call BeginSub(subname)
    if (present(history)) then
      hst => history
    else
      hst => default
    endif
    do, i = 1, size(hst%dimvars)
      if (.not. hst%dim_value_written(i))         call set_fake_dim_value(hst, i)
      call Close(hst%dimvars(i))
    enddo
    deallocate(hst%dimvars)
    do, i = 1, size(hst%vars)
      call Close(hst%vars(i))
    enddo
    if (associated(hst%vars)) deallocate(hst%vars)
    if (associated(hst%count)) deallocate(hst%count)
    call EndSub(subname)
  end subroutine HistoryClose
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 が与えられない場合は default が参照される. HistoryCreate と同様に, 出力の初期設定を行う. file は必ず与えなければならず, hist_src と同じファイルへ出力 しようとする場合は下層でエラーを生じる.

それ以降の引数は hist_src の設定を上書きするためのものである.

[Source]

  subroutine HistoryCopy1(hist_dest, file, hist_src,  title, source, institution,  origin, interval,  conventions, gt_version)
    !
    ! hist_src の内容にコピーし, hist_dest へ返す.
    ! hist_src が与えられない場合は default が参照される.
    ! HistoryCreate と同様に, 出力の初期設定を行う. file
    ! は必ず与えなければならず, hist_src と同じファイルへ出力
    ! しようとする場合は下層でエラーを生じる.
    !
    ! それ以降の引数は hist_src の設定を上書きするためのものである.
    !
    use gtdata_generic, only: Inquire, Get_Attr, Copy_Attr, Get, Put
!      use dc_url,    only:
    use dc_error,   only: StoreError, DC_NOERR, GT_EARGSIZEMISMATCH
!      use dc_string, only:
    use dc_present, only: present_select
    use dc_types,   only: string, token
    implicit none
    type(GT_HISTORY), intent(out), target :: hist_dest
    character(*),     intent(in)          :: file
    type(GT_HISTORY), intent(in), optional, target:: hist_src
    character(*),     intent(in), optional:: title, source, institution

!!!$      type(GT_HISTORY_AXIS), intent(in),optional :: axes(:)
!!!$      type(GT_HISTORY_AXIS), intent(in),optional :: addaxes(:)
!!!$      character(*),     intent(in), optional:: dims(:)
!!!$      integer,          intent(in), optional:: dimsizes(:)
!!!$      character(*),     intent(in), optional:: longnames(:)
!!!$      character(*),     intent(in), optional:: units(:)
    real,             intent(in), optional:: origin, interval

!!!$      character(*),     intent(in), optional:: xtypes(:)
    character(*),     intent(in), optional:: conventions, gt_version

    ! Internal Work
    type(GT_HISTORY), pointer:: src =>null()
    character(STRING) :: title_src, source_src, institution_src
    character(STRING) :: conventions_src, gt_version_src
    character(STRING), pointer:: dims(:) => null()
    integer          , pointer:: dimsizes(:) => null()
    character(STRING), pointer:: longnames(:) => null()
    character(STRING), pointer:: units(:)  => null()
    character(STRING), pointer:: xtypes(:) => null()
    integer  :: i, numdims
    logical        :: err
    real(DP),pointer :: dimvalue(:) => null()
    character(len = *),parameter:: subname = "HistoryCopy1"
  continue
    call BeginSub(subname, 'file=&