gdncsearchdim.f90
Go to the documentation of this file.
1 !
2 ! 次元変数 ID の取得
3 !
4 ! Authors:: Eizi TOYODA, Yasuhiro MORIKAWA
5 ! Version:: $Id: gdncsearchdim.f90,v 1.2 2009-05-25 09:51:59 morikawa Exp $
6 ! Tag Name:: $Name: $
7 ! Copyright:: Copyright (C) GFD Dennou Club, 2001-2009. All rights reserved.
8 ! License:: See COPYRIGHT[link:../../COPYRIGHT]
9 !
10 integer function gdncsearchdim(var, dimname) result(result)
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
54 end function gdncsearchdim
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 function gdncsearchdim(var, dimname)
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