!--
! *** Caution!! ***
!
! This file is generated from "historygetattr.rb2f90" by Ruby 2.3.3.
! Please do not edit this file directly.
!
! [JAPANESE]
!
! ※※※ 注意!!! ※※※
!
! このファイルは "historygetattr.rb2f90" から Ruby 2.3.3
! によって自動生成されたファイルです.
! このファイルを直接編集しませんようお願い致します.
!
!
!++
!
!= gtool4 netCDF データ中の属性の入力
!= Input attributes in gtool4 netCDF data
!
! Authors::   Yasuhiro MORIKAWA
! Version::   $Id: historygetattr.rb2f90,v 1.3 2010-06-17 00:56:23 morikawa Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2006. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
! 以下のサブルーチン, 関数は gtool_history から gtool_history_generic#HistoryGetAttr
! として提供されます.
!
! Following subroutines and functions are provided as
! gtool_history_generic#HistoryGetAttr from gtool_history.
!
  subroutine HistoryGettAttrChar0( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
                        !
    !== gtool4 データ内の変数の属性の取得
    !
    ! gtool4 データおよびそのデータ内の変数に設定されている属性を取得します。
    !
    ! 属性名 *attrname* の先頭にプラス "<b><tt>+</tt></b>" を付加する
    ! 場合は、gtool4 データ自体の属性 (大域属性) として属性が取得されます。
    ! この場合、*varname* は無視されますが、
    ! その場合でも *varname* へはデータ内に存在する変数名を与えてください。
    !
    ! 取得する属性が存在しない場合、以下の値が返ります。
    !
    ! character :: "" (空文字)
    ! real      :: netcdf_f77#NF_FILL_FLOAT
    ! real(DP)  :: netcdf_f77#NF_FILL_DOUBLE
    ! integer   :: netcdf_f77#NF_FILL_INT
    !
    ! *HistoryGetAttr* は複数のサブルーチンの総称名です。*value* には
    ! いくつかの型を与えることが可能です。
    ! 下記のサブルーチンを参照ください。
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
                                                  ! netCDF ファイル名.
    character(*), intent(in):: varname
                                                  ! 変数名.
    character(*), intent(in):: attrname
                                                  ! 属性の名称.
                              !
                              ! "<b><tt>+</tt></b>" (プラス)
                              ! を属性名の先頭につける場合には,
                              ! 大域属性を取得します.
    character(*), intent(out):: value
                                                  ! 属性の値.
                              !
    logical, intent(in), optional:: flag_mpi_split
                                                  ! MPI 使用時にこの引数に .true. を与えると,
                              ! *file* 引数に "_rankXXXXXX"
                              ! (X は [0-9] の数値で, ノード番号を指す)
                              ! を付加したファイル名を各ノードで読み込みます.
                              ! 例えば, *file* に "input.nc" を与えた場合.
                              ! ノード 0 では "input_rank000000.nc",
                              ! ノード 12 では "input_rank000012.nc"
                              ! を読み込みます.
                              ! デフォルトは .false. です.
                              !
                              ! When MPI is used, if ".true." is given,
                              ! a filename that "_rankXXXXXX"
                              ! (X is [0-9] that indicates node number)
                              ! is added to *file* argument is loaded
                              ! on each node.
                              ! For example, "input.nc" is given to *file*,
                              ! "input_rank000000.nc", "input_rank000012.nc"
                              ! are loaded on node 0 and node 12.
                              ! Default value is ".false.".
                              !
    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_VARIABLE):: var
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrChar0"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
  subroutine HistoryGettAttrInt0( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
    character(*), intent(in):: varname
    character(*), intent(in):: attrname
    integer, intent(out):: value
    logical, intent(in), optional:: flag_mpi_split
    logical, intent(out), optional:: err
    type(GT_VARIABLE):: var
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrInt0"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
  subroutine HistoryGettAttrInt1( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
    character(*), intent(in):: varname
    character(*), intent(in):: attrname
    integer, intent(out):: value(:)
    logical, intent(in), optional:: flag_mpi_split
    logical, intent(out), optional:: err
    type(GT_VARIABLE):: var
                        integer:: default
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrInt1"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
                                              default = NF90_FILL_INT
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
                          & , default &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
  subroutine HistoryGettAttrReal0( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
    character(*), intent(in):: varname
    character(*), intent(in):: attrname
    real, intent(out):: value
    logical, intent(in), optional:: flag_mpi_split
    logical, intent(out), optional:: err
    type(GT_VARIABLE):: var
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrReal0"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
  subroutine HistoryGettAttrReal1( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
    character(*), intent(in):: varname
    character(*), intent(in):: attrname
    real, intent(out):: value(:)
    logical, intent(in), optional:: flag_mpi_split
    logical, intent(out), optional:: err
    type(GT_VARIABLE):: var
                        real:: default
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrReal1"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
                                              default = NF90_FILL_FLOAT
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
                          & , default &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
  subroutine HistoryGettAttrDouble0( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
    character(*), intent(in):: varname
    character(*), intent(in):: attrname
    real(DP), intent(out):: value
    logical, intent(in), optional:: flag_mpi_split
    logical, intent(out), optional:: err
    type(GT_VARIABLE):: var
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrDouble0"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
  subroutine HistoryGettAttrDouble1( &
    & file, varname, attrname, & ! (in)
    & value, &                   ! (out)
    & flag_mpi_split, &          ! (in) optional
    & err &                      ! (out) optional
    & )
    !
    !
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: Get_Attr, Open, Close
    use dc_types, only: STRING, DP
    use dc_string, only: toChar, JoinChar
    use dc_url, only: GT_ATMARK, GT_COMMA, GT_EQUAL, UrlSplit, UrlMerge, GT_PLUS
    use dc_error, only: StoreError, DC_NOERR, NF90_ENOTVAR, HST_EMPINOAXISDATA
    use dc_message, only: MessageNotify
    use dc_trace, only: BeginSub, EndSub
    use dc_present, only: present_and_true
    use dc_error, only: StoreError, DC_NOERR, GT_ENOTURL
    use netcdf, only: NF90_FILL_FLOAT, NF90_FILL_DOUBLE, NF90_FILL_INT
    implicit none
    character(*), intent(in):: file
    character(*), intent(in):: varname
    character(*), intent(in):: attrname
    real(DP), intent(out):: value(:)
    logical, intent(in), optional:: flag_mpi_split
    logical, intent(out), optional:: err
    type(GT_VARIABLE):: var
                        real(DP):: default
    character(STRING):: file_work, url
    integer:: stat
    character(STRING):: cause_c
    character(len = *), parameter:: subname = "HistoryGetAttrDouble1"
    !--
    interface ! historyget.rb2f90 で定義されているものを使用
      function file_rename_mpi( file ) result(result)
        use dc_types, only: STRING
        character(*), intent(in):: file
        character(STRING):: result
      end function file_rename_mpi
    end interface
    !++
  continue
    call BeginSub(subname, &
      & 'file=<%c> varname=<%c> attrname=<%c>', &
      & c1=trim(file), c2=trim(varname), c3=trim(attrname) )
    stat = DC_NOERR
    cause_c = ''
    ! ファイル名の変更 (MPI 用)
    ! Change filename (for MPI)
    !
    file_work = file
    if ( present_and_true( flag_mpi_split ) ) &
      & file_work = file_rename_mpi( file_work )
    ! 変数 URL の作成
    ! Create variable URL
    !
    url = UrlMerge( file_work, varname )
    ! ファイルオープン
    ! File open
    !
    call Open( var, url, err = err )
    if ( present_and_true(err) ) then
      stat = GT_ENOTURL
      cause_c = url
      goto 999
    end if
    ! デフォルト値の設定
    ! Set default value
    !
                                              default = NF90_FILL_DOUBLE
    ! 属性の取得
    ! Get an attribute
    !
    call Get_Attr( var, attrname, value &
                          & , default &
      & )
    ! ファイルオープン
    ! File open
    !
    call Close( var )
999 continue
    call StoreError(stat, subname, err, cause_c=cause_c)
    call EndSub(subname)
  end subroutine
!--
! vi:set readonly sw=4 ts=8:
!
!Local Variables:
!mode: f90
!buffer-read-only: t
!End:
!
!++
