gdncsearchdim.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

integer function gdncsearchdim (var, dimname)
 

Function/Subroutine Documentation

◆ gdncsearchdim()

integer function gdncsearchdim ( type(gd_nc_variable), intent(in)  var,
character(*), intent(in)  dimname 
)

Definition at line 11 of file gdncsearchdim.f90.

References dc_trace::beginsub(), dc_trace::endsub(), dc_error::gt_enomoredims, and gtdata_netcdf_internal::vtable_lookup().

11  !
12  ! 次元変数 ID の取得
13  !
17  use netcdf, only: nf90_ebaddim, nf90_noerr, nf90_inq_dimid
18  use dc_error
19  use dc_trace, only: beginsub, endsub
20  implicit none
21  type(gd_nc_variable), intent(in):: var
22  character(*), intent(in):: dimname
23  type(gd_nc_variable_entry):: ent
24  integer:: stat, dimid, i
25  character(*), parameter:: subname = 'GDNcSearchDim'
26 continue
27  call beginsub(subname, 'var=%d dimname=%c', i=(/var%id/), c1=trim(dimname))
28  result = nf90_ebaddim
29  stat = vtable_lookup(var, ent)
30  if (stat /= nf90_noerr) goto 999
31 
32  stat = nf90_inq_dimid(ent%fileid, dimname, dimid)
33  if (stat /= nf90_noerr) goto 999
34 
35  if (dimid == ent%dimid) then
36  result = 1
37  goto 999
38  endif
39 
40  if (.not. associated(ent%dimids)) then
41  stat = gt_enomoredims
42  goto 999
43  endif
44  do, i = 1, size(ent%dimids)
45  if (ent%dimids(i) == dimid) then
46  result = i
47  goto 999
48  endif
49  enddo
50 
51 999 continue
52  call endsub(subname, 'result=%d', i=(/result/))
53  return
integer function, public vtable_lookup(var, entry)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
Definition: dc_trace.f90:351
integer, parameter, public gt_enomoredims
Definition: dc_error.f90:528
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
Definition: dc_trace.f90:446
Here is the call graph for this function: