gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gtvardeldim.f90 File Reference

次元の削除 More...

Go to the source code of this file.

Functions/Subroutines

subroutine gtvardeldim (var, dimord, err)

Detailed Description

次元の削除

Author
Eizi TOYODA, Yasuhiro MORIKAWA

このサブルーチンは gtdata_generic から gtdata_generic#Del_dim として提供されます。

Definition in file gtvardeldim.f90.

Function/Subroutine Documentation

◆ gtvardeldim()

subroutine gtvardeldim ( type(gt_variable), intent(in) var,
integer, intent(in) dimord,
logical, intent(out) err )

変数から次元を削除

変数 var の次元 dimord を削除します。 次元対応表の順位を下げ有効次元数をデクリメントするだけなので、 当該次元がすでに縮退していれば、この操作のあとでも入出力が可能です。

エラーが生じた場合、メッセージを出力してプログラムは強制終了します。 err を与えてある場合にはの引数に .true. が返り、プログラムは終了しません。

Note
NetCDF 実装においては、変数は削除されず別の名称に改名されるだけです。 これは netCDF API に変数の削除が欠けているためです。
Parameters
[in]var変数ハンドル
[in]dimord削除する次元順序番号
[out]errエラーフラグ

Definition at line 58 of file gtvardeldim.f90.

59 use gtdata_types, only: gt_variable
62 implicit none
63 type(gt_variable), intent(in):: var
64 integer, intent(in):: dimord
65 logical, intent(out):: err
66 type(gt_dimmap), allocatable:: map(:)
67 type(gt_dimmap):: tmpmap
68 integer:: ndimsp, stat
69 character(*), parameter:: subname = 'GTVarDelDim'
70continue
71 err = .true.
72 call beginsub(subname)
73 if (dimord < 1) then
74 call endsub(subname, "negative dimord=%d invalid", i=(/dimord/))
75 return
76 endif
77 call map_lookup(var, ndims=ndimsp)
78 if (ndimsp <= 0) then
79 call endsub(subname, "variable invalid")
80 return
81 else if (dimord > ndimsp) then
82 call endsub(subname, "dimord=%d not exist", i=(/dimord/))
83 return
84 endif
85
86 allocate(map(ndimsp))
87 call map_lookup(var, map=map)
88 tmpmap = map(dimord)
89 map(dimord: ndimsp-1) = map(dimord+1: ndimsp)
90 map(ndimsp) = tmpmap
91 call map_set(var, map, stat)
92 deallocate(map)
93
94 call map_set_ndims(var, ndims = ndimsp - 1, stat=stat)
95 err = stat /= 0
96 call endsub(subname)
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:661
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
subroutine, public map_lookup(var, vid, map, ndims)
subroutine map_set_ndims(var, ndims, stat)
subroutine map_set(var, map, stat)

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_trace::endsub(), gtdata_internal_map::map_lookup(), gtdata_internal_map::map_set(), and gtdata_internal_map::map_set_ndims().

Here is the call graph for this function: