gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gdncvarinquireia.f90
Go to the documentation of this file.
1!> @file gdncvarinquireia.f90
2!>
3!> @author GFD Dennou Club
4!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Inquire dimension lengths of a netCDF variable (array version)
9!> @enden
10!>
11!> @ja
12!> @brief netCDF 変数の次元長を問い合わせる (配列版)
13!> @endja
14!>
15
16!>
17!> @en
18!> @brief Get dimension lengths for a variable
19!>
20!> Returns the length of each dimension for the specified variable.
21!> The dimlen array must have at least ndims elements.
22!> @enden
23!>
24!> @ja
25!> @brief 変数の次元長を取得
26!>
27!> 指定された変数の各次元の長さを返します。
28!> dimlen 配列は少なくとも ndims 個の要素を持つ必要があります。
29!> @endja
30!>
31!> @param[in] var @en Variable handle @enden @ja 変数ハンドル @endja
32!> @param[out] dimlen @en Array to store dimension lengths @enden @ja 次元長を格納する配列 @endja
33!>
34subroutine gdncvarinquireia(var, dimlen)
36 ! use gtdata_netcdf_internal, only: GD_NC_VARIABLE_ENTRY
38 use netcdf, only: nf90_noerr, nf90_inquire_dimension
39 type(gd_nc_variable), intent(in):: var
40 integer, intent(out):: dimlen(:)
41 type(gd_nc_variable_entry):: ent
42 integer:: stat, i
43
44 dimlen(:) = -1
45
46 stat = vtable_lookup(var, ent)
47 if (stat /= nf90_noerr) return
48
49 if (ent%varid > 0) then
50 if (.not. associated(ent%dimids)) return
51 do, i = 1, min(size(dimlen), size(ent%dimids))
52 stat = nf90_inquire_dimension(ent%fileid, ent%dimids(i), len = dimlen(i))
53 if (stat /= nf90_noerr ) exit
54 enddo
55 else
56 stat = nf90_inquire_dimension(ent%fileid, ent%dimid, len = dimlen(1))
57 if (stat /= nf90_noerr ) dimlen(1) = -1
58 endif
59end subroutine
subroutine gdncvarinquireia(var, dimlen)
integer function, public vtable_lookup(var, entry)