gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gdncsearchdim.f90 File Reference

Search for dimension variable ID . More...

Go to the source code of this file.

Functions/Subroutines

integer function gdncsearchdim (var, dimname)

Detailed Description

Search for dimension variable ID

.

Author
Eizi TOYODA, Yasuhiro MORIKAWA

Definition in file gdncsearchdim.f90.

Function/Subroutine Documentation

◆ gdncsearchdim()

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

Get the dimension order for a named dimension

Returns the position (1-based) of the dimension in the variable's dimension list.

Parameters
[in]varVariable handle
[in]dimnameDimension name to search
Returns
Dimension order (1-based), or NF90_EBADDIM on error

Definition at line 35 of file gdncsearchdim.f90.

39 use netcdf, only: nf90_ebaddim, nf90_noerr, nf90_inq_dimid
40 use dc_error
41 use dc_trace, only: beginsub, endsub
42 implicit none
43 type(GD_NC_VARIABLE), intent(in):: var
44 character(*), intent(in):: dimname
45 type(GD_NC_VARIABLE_ENTRY):: ent
46 integer:: stat, dimid, i
47 character(*), parameter:: subname = 'GDNcSearchDim'
48continue
49 call beginsub(subname, 'var=%d dimname=%c', i=(/var%id/), c1=trim(dimname))
50 result = nf90_ebaddim
51 stat = vtable_lookup(var, ent)
52 if (stat /= nf90_noerr) goto 999
53
54 stat = nf90_inq_dimid(ent%fileid, dimname, dimid)
55 if (stat /= nf90_noerr) goto 999
56
57 if (dimid == ent%dimid) then
58 result = 1
59 goto 999
60 endif
61
62 if (.not. associated(ent%dimids)) then
63 stat = gt_enomoredims
64 goto 999
65 endif
66 do, i = 1, size(ent%dimids)
67 if (ent%dimids(i) == dimid) then
68 result = i
69 goto 999
70 endif
71 enddo
72
73999 continue
74 call endsub(subname, 'result=%d', i=(/result/))
75 return
Error handling module.
Definition dc_error.f90:454
integer, parameter, public gt_enomoredims
-101 or less: Data structure errors
Definition dc_error.f90:507
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
integer function, public vtable_lookup(var, entry)

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

Here is the call graph for this function: