! -*- coding: utf-8; mode: f90 -*-
!-------------------------------------------------------------------------------------
! Copyright (c) 2000-2016 Gtool Development Group. All rights reserved.
!-------------------------------------------------------------------------------------
! ** Important**
!
! This file is generated from gtvargetpointernum.erb by ERB included Ruby 2.3.1.
! Please do not edit this file directly. @see "gtvargetpointernum.erb"
!-------------------------------------------------------------------------------------
!
!++
!= 繝昴う繝ｳ繧ｿ驟榊�縺ｸ縺ｮ謨ｰ蛟､繝��繧ｿ縺ｮ蜈･蜉�
!
! Authors::   Yasuhiro MORIKAWA, Eizi TOYODA
! Version::   $Id: gtvargetpointernum.rb2f90,v 1.5 2009-05-25 09:55:58 morikawa Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
! 莉･荳九�繧ｵ繝悶Ν繝ｼ繝√Φ縲�未謨ｰ縺ｯ gtdata_generic 縺九ｉ gtdata_generic#Get
! 縺ｨ縺励※謠蝉ｾ帙＆繧後∪縺吶�

  !
                                          !
  !== 繝昴う繝ｳ繧ｿ驟榊�縺ｸ縺ｮ謨ｰ蛟､繝��繧ｿ縺ｮ蜈･蜉�
  !
  ! 螟画焚 *var* 縺九ｉ *value* 縺ｫ謨ｰ蛟､繝��繧ｿ縺悟�蜉帙＆繧後∪縺吶�
  ! *value* 縺ｯ繝昴う繝ｳ繧ｿ驟榊�縺ｧ縺ゅｊ縲∵焚蛟､繝��繧ｿ縺ｮ繧ｵ繧､繧ｺ縺ｫ蜷医ｏ縺帙◆
  ! 驟榊�繧ｵ繧､繧ｺ縺瑚�蜍慕噪縺ｫ蜑ｲ繧贋ｻ倥￠繧峨ｌ縺ｾ縺吶�
  ! *Get* 縺ｯ隍�焚縺ｮ繧ｵ繝悶Ν繝ｼ繝√Φ縺ｮ邱冗ｧｰ蜷阪〒縺ゅｊ縲�
  ! 1 縲� 7 谺｡蜈��繝昴う繝ｳ繧ｿ繧剃ｸ弱∴繧九％縺ｨ縺悟庄閭ｽ縺ｧ縺吶�
  ! 縺ｾ縺� *value* 縺ｫ蝗ｺ螳夐聞驟榊�繧剃ｸ弱∴繧九％縺ｨ縺悟庄閭ｽ縺ｪ謇狗ｶ壹″繧ゅ≠繧翫∪縺吶�
  ! 荳玖ｨ倥ｒ蜿ら�縺励※縺上□縺輔＞縲�
  !
  ! *value* 縺梧里縺ｫ蜑ｲ繧贋ｻ倥￠繧峨ｌ縺ｦ縺翫ｊ縲∽ｸ斐▽蜈･蜉帙☆繧区焚蛟､繝��繧ｿ縺ｨ驟榊�
  ! 繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医√お繝ｩ繝ｼ (繧ｳ繝ｼ繝� dc_error#GT_EBADALLOCATESIZE)
  ! 繧堤函縺倥∪縺吶ょ次蜑�噪縺ｫ縺ｯ *value* 繧堤ｩｺ迥ｶ諷九↓縺励※荳弱∴繧九％縺ｨ繧�
  ! 謗ｨ螂ｨ縺励∪縺吶ゆｸ榊ｮ夂憾諷九〒荳弱∴繧九％縺ｨ縺ｯ莠域悄縺帙〓蜍穂ｽ懊ｒ諡帙￥蜿ｯ閭ｽ諤ｧ縺�
  ! 縺ゅｋ縺溘ａ遖∵ｭ｢縺励∪縺吶�
  !
  ! 謨ｰ蛟､繝��繧ｿ蜈･蜉帙ｄ荳願ｨ倥�蜑ｲ繧贋ｻ倥￠縺ｮ髫帙↓繧ｨ繝ｩ繝ｼ縺檎函縺倥◆蝣ｴ蜷医√Γ繝�そ繝ｼ繧ｸ
  ! 繧貞�蜉帙＠縺ｦ繝励Ο繧ｰ繝ｩ繝�縺ｯ蠑ｷ蛻ｶ邨ゆｺ�＠縺ｾ縺吶�*err* 繧剃ｸ弱∴縺ｦ縺ゅｋ蝣ｴ蜷医↓縺ｯ
  ! 縺ｮ蠑墓焚縺ｫ .true. 縺瑚ｿ斐ｊ縲√�繝ｭ繧ｰ繝ｩ繝�縺ｯ邨ゆｺ�＠縺ｾ縺帙ｓ縲�
  !
  ! 蜈･蜉帙＠繧医≧縺ｨ縺吶ｋ繝��繧ｿ縺ｮ蝙九′蠑墓焚縺ｮ蝙九→逡ｰ縺ｪ繧句�ｴ蜷医√ョ繝ｼ繧ｿ縺ｯ蠑墓焚縺ｮ
  ! 蝙九↓螟画鋤縺輔ｌ縺ｾ縺吶� 縺薙�螟画鋤縺ｯ netCDF 縺ｮ讖溯�繧堤畑縺�※縺�∪縺吶�
  ! 隧ｳ縺励￥縺ｯ {netCDF 譌･譛ｬ隱樒沿繝槭ル繝･繧｢繝ｫ}[link:../xref.htm#label-10]
  ! 縺ｮ 3.3 蝙句､画鋤 繧貞盾辣ｧ縺励※縺上□縺輔＞縲�
  !
  !
  ! This subroutine returns multi-dimensional data to argument "value".
  ! You need to provide GT_VARIABLE variable to argument "var".
  ! If you provide logical argument "err", .true. is returned
  ! instead of abort with messages when error is occurred.

subroutine GTVarGetPointerDouble1(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(1), cause_i, data_rank
  logical                         :: invalid_check(1)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble1'
  continue
  cause_i = 0
  cause_c = ''
  n(1) = -1
  stat = DC_NOERR
  call map_set_rank(var, 1, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  if (n(1) < 0) then
    ! count_compact 縺ｧ縺ｯ縺ｪ縺��縺ｧ縲√ぞ繝ｭ谺｡蜈�喧縺励※縺�ｋ縺ｨ n = -1 縺ｨ縺ｪ繧�
    n(1) = 1
  endif
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 1'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = array1dim_tmp
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble1

subroutine GTVarGetPointerDouble2(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:,:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(2), cause_i, data_rank
  logical                         :: invalid_check(2)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble2'
  continue
  cause_i = 0
  cause_c = ''
  n(2) = -1
  stat = DC_NOERR
  call map_set_rank(var, 2, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 2'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble2

subroutine GTVarGetPointerDouble3(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:,:,:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(3), cause_i, data_rank
  logical                         :: invalid_check(3)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble3'
  continue
  cause_i = 0
  cause_c = ''
  n(3) = -1
  stat = DC_NOERR
  call map_set_rank(var, 3, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 3'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble3

subroutine GTVarGetPointerDouble4(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:,:,:,:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(4), cause_i, data_rank
  logical                         :: invalid_check(4)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble4'
  continue
  cause_i = 0
  cause_c = ''
  n(4) = -1
  stat = DC_NOERR
  call map_set_rank(var, 4, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 4'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble4

subroutine GTVarGetPointerDouble5(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:,:,:,:,:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(5), cause_i, data_rank
  logical                         :: invalid_check(5)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble5'
  continue
  cause_i = 0
  cause_c = ''
  n(5) = -1
  stat = DC_NOERR
  call map_set_rank(var, 5, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 5'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble5

subroutine GTVarGetPointerDouble6(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:,:,:,:,:,:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(6), cause_i, data_rank
  logical                         :: invalid_check(6)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble6'
  continue
  cause_i = 0
  cause_c = ''
  n(6) = -1
  stat = DC_NOERR
  call map_set_rank(var, 6, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call Get_Slice(var, dimord=6, count=n(6), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 6'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .not. size(value,6) == n(6) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5),  &
      & n(6))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble6

subroutine GTVarGetPointerDouble7(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetDouble
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, DP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(DP), pointer :: value(:,:,:,:,:,:,:) !(out)
  real(DP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(7), cause_i, data_rank
  logical                         :: invalid_check(7)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerDouble7'
  continue
  cause_i = 0
  cause_c = ''
  n(7) = -1
  stat = DC_NOERR
  call map_set_rank(var, 7, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call Get_Slice(var, dimord=6, count=n(6), count_compact=.false.)
  call Get_Slice(var, dimord=7, count=n(7), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 7'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .not. size(value,6) == n(6) .or. &
      & .not. size(value,7) == n(7) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5),  &
      & n(6),  &
      & n(7))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetDouble(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerDouble7

subroutine GTVarGetPointerReal1(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(1), cause_i, data_rank
  logical                         :: invalid_check(1)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal1'
  continue
  cause_i = 0
  cause_c = ''
  n(1) = -1
  stat = DC_NOERR
  call map_set_rank(var, 1, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  if (n(1) < 0) then
    ! count_compact 縺ｧ縺ｯ縺ｪ縺��縺ｧ縲√ぞ繝ｭ谺｡蜈�喧縺励※縺�ｋ縺ｨ n = -1 縺ｨ縺ｪ繧�
    n(1) = 1
  endif
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 1'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = array1dim_tmp
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal1

subroutine GTVarGetPointerReal2(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:,:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(2), cause_i, data_rank
  logical                         :: invalid_check(2)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal2'
  continue
  cause_i = 0
  cause_c = ''
  n(2) = -1
  stat = DC_NOERR
  call map_set_rank(var, 2, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 2'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal2

subroutine GTVarGetPointerReal3(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:,:,:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(3), cause_i, data_rank
  logical                         :: invalid_check(3)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal3'
  continue
  cause_i = 0
  cause_c = ''
  n(3) = -1
  stat = DC_NOERR
  call map_set_rank(var, 3, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 3'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal3

subroutine GTVarGetPointerReal4(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:,:,:,:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(4), cause_i, data_rank
  logical                         :: invalid_check(4)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal4'
  continue
  cause_i = 0
  cause_c = ''
  n(4) = -1
  stat = DC_NOERR
  call map_set_rank(var, 4, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 4'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal4

subroutine GTVarGetPointerReal5(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:,:,:,:,:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(5), cause_i, data_rank
  logical                         :: invalid_check(5)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal5'
  continue
  cause_i = 0
  cause_c = ''
  n(5) = -1
  stat = DC_NOERR
  call map_set_rank(var, 5, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 5'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal5

subroutine GTVarGetPointerReal6(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:,:,:,:,:,:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(6), cause_i, data_rank
  logical                         :: invalid_check(6)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal6'
  continue
  cause_i = 0
  cause_c = ''
  n(6) = -1
  stat = DC_NOERR
  call map_set_rank(var, 6, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call Get_Slice(var, dimord=6, count=n(6), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 6'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .not. size(value,6) == n(6) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5),  &
      & n(6))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal6

subroutine GTVarGetPointerReal7(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetReal
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING, SP
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  real(SP), pointer :: value(:,:,:,:,:,:,:) !(out)
  real(SP), allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(7), cause_i, data_rank
  logical                         :: invalid_check(7)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerReal7'
  continue
  cause_i = 0
  cause_c = ''
  n(7) = -1
  stat = DC_NOERR
  call map_set_rank(var, 7, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call Get_Slice(var, dimord=6, count=n(6), count_compact=.false.)
  call Get_Slice(var, dimord=7, count=n(7), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 7'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .not. size(value,6) == n(6) .or. &
      & .not. size(value,7) == n(7) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5),  &
      & n(6),  &
      & n(7))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetReal(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerReal7

subroutine GTVarGetPointerInt1(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(1), cause_i, data_rank
  logical                         :: invalid_check(1)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt1'
  continue
  cause_i = 0
  cause_c = ''
  n(1) = -1
  stat = DC_NOERR
  call map_set_rank(var, 1, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  if (n(1) < 0) then
    ! count_compact 縺ｧ縺ｯ縺ｪ縺��縺ｧ縲√ぞ繝ｭ谺｡蜈�喧縺励※縺�ｋ縺ｨ n = -1 縺ｨ縺ｪ繧�
    n(1) = 1
  endif
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 1'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = array1dim_tmp
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt1

subroutine GTVarGetPointerInt2(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:,:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(2), cause_i, data_rank
  logical                         :: invalid_check(2)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt2'
  continue
  cause_i = 0
  cause_c = ''
  n(2) = -1
  stat = DC_NOERR
  call map_set_rank(var, 2, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 2'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt2

subroutine GTVarGetPointerInt3(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:,:,:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(3), cause_i, data_rank
  logical                         :: invalid_check(3)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt3'
  continue
  cause_i = 0
  cause_c = ''
  n(3) = -1
  stat = DC_NOERR
  call map_set_rank(var, 3, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 3'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt3

subroutine GTVarGetPointerInt4(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:,:,:,:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(4), cause_i, data_rank
  logical                         :: invalid_check(4)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt4'
  continue
  cause_i = 0
  cause_c = ''
  n(4) = -1
  stat = DC_NOERR
  call map_set_rank(var, 4, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 4'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt4

subroutine GTVarGetPointerInt5(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:,:,:,:,:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(5), cause_i, data_rank
  logical                         :: invalid_check(5)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt5'
  continue
  cause_i = 0
  cause_c = ''
  n(5) = -1
  stat = DC_NOERR
  call map_set_rank(var, 5, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 5'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt5

subroutine GTVarGetPointerInt6(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:,:,:,:,:,:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(6), cause_i, data_rank
  logical                         :: invalid_check(6)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt6'
  continue
  cause_i = 0
  cause_c = ''
  n(6) = -1
  stat = DC_NOERR
  call map_set_rank(var, 6, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call Get_Slice(var, dimord=6, count=n(6), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 6'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .not. size(value,6) == n(6) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5),  &
      & n(6))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt6

subroutine GTVarGetPointerInt7(var, value, err)
  use gtdata_types,          only: GT_VARIABLE
  use gtdata_generic,        only: Get_Slice, GTVarGetInt
  use gtdata_internal_map,   only: map_set_rank
  use gtdata_netcdf_generic, only: Get
  use gtdata_netcdf_types,   only: GD_NC_VARIABLE
  use dc_types,              only: STRING
  use dc_trace,              only: DbgMessage
  use dc_error,              only: StoreError, DC_NOERR, &
    & GT_EBADALLOCATESIZE, GT_ENOMOREDIMS, GT_ERANKMISMATCH
  use dc_string,             only: toChar
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, pointer :: value(:,:,:,:,:,:,:) !(out)
  integer, allocatable :: array1dim_tmp(:)
  logical, intent(out), optional  :: err
  integer                         :: stat, n(7), cause_i, data_rank
  logical                         :: invalid_check(7)
  character(STRING)               :: cause_c
  character(*), parameter :: subname = 'GTVarGetPointerInt7'
  continue
  cause_i = 0
  cause_c = ''
  n(7) = -1
  stat = DC_NOERR
  call map_set_rank(var, 7, stat)
  if (stat /= DC_NOERR) goto 999
  call Get_Slice(var, dimord=1, count=n(1), count_compact=.false.)
  call Get_Slice(var, dimord=2, count=n(2), count_compact=.false.)
  call Get_Slice(var, dimord=3, count=n(3), count_compact=.false.)
  call Get_Slice(var, dimord=4, count=n(4), count_compact=.false.)
  call Get_Slice(var, dimord=5, count=n(5), count_compact=.false.)
  call Get_Slice(var, dimord=6, count=n(6), count_compact=.false.)
  call Get_Slice(var, dimord=7, count=n(7), count_compact=.false.)
  call DbgMessage('n(:)=%*d', i=n, n=(/size(n)/))
  invalid_check = n > 0
  if (.not. all(invalid_check)) then
    stat = GT_ERANKMISMATCH
    data_rank = count(invalid_check)
    cause_c = trim(toChar(data_rank)) // ' and 7'
    goto 999
  end if
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�↑縺代ｌ縺ｰ allocate 縺吶ｋ.
  ! value 縺梧里縺ｫ allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺悟叙蠕励☆繧九ョ繝ｼ繧ｿ縺ｨ蜷後§縺ｧ
  ! 縺ゅｌ縺ｰ縺昴�縺ｾ縺ｾ蜿門ｾ�.
  ! value 縺� allocate 縺輔ｌ縺ｦ縺�※繧ｵ繧､繧ｺ縺檎焚縺ｪ繧句�ｴ蜷医�繧ｨ繝ｩ繝ｼ.
  if ( associated(value) ) then
    if ( &
      & .not. size(value,1) == n(1) .or. &
      & .not. size(value,2) == n(2) .or. &
      & .not. size(value,3) == n(3) .or. &
      & .not. size(value,4) == n(4) .or. &
      & .not. size(value,5) == n(5) .or. &
      & .not. size(value,6) == n(6) .or. &
      & .not. size(value,7) == n(7) .or. &
      & .false.                             ) then
      stat = GT_EBADALLOCATESIZE
      if (stat /= DC_NOERR) goto 999
    else
      call DbgMessage('@ value is already allocated')
    endif
  else
    call DbgMessage('@ allocate value')
    allocate( value (&
      & n(1),  &
      & n(2),  &
      & n(3),  &
      & n(4),  &
      & n(5),  &
      & n(6),  &
      & n(7))  &
      &  )
  endif
  if (allocated(array1dim_tmp)) then
    deallocate(array1dim_tmp)
  end if
  allocate(array1dim_tmp(product(n)))
  call GTVarGetInt(var, array1dim_tmp, product(n), err)
  !    call DbgMessage('max=%f min=%f', d=(/maxval(value), minval(value)/))
  value = reshape(array1dim_tmp, n)
999 continue
  call StoreError(stat, subname, err, cause_i=cause_i, cause_c=cause_c)
end subroutine GTVarGetPointerInt7