da_get_dims_cdf.inc
References to this file elsewhere.
1 subroutine da_get_dims_cdf(file, var, dims, ndims, debug)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: TBD
5 !-----------------------------------------------------------------------
6
7 implicit none
8
9 #include "netcdf.inc"
10
11 character (len=*), intent(in) :: file
12 character (len=*), intent(in) :: var
13 logical, intent(in) :: debug
14 integer, intent(out) :: dims(4)
15 integer, intent(out) :: ndims
16
17 integer :: cdfid, rcode, id_time
18 character (len=80) :: varnam
19 integer :: natts, dimids(10)
20 integer :: i, ivtype
21
22 ! if (trace_use) call da_trace_entry("da_get_dims_cdf")
23
24 cdfid = ncopn(file, NCNOWRIT, rcode)
25
26 if (rcode == 0) then
27 if (debug) write(unit=stdout,fmt=*) ' open netcdf file ', trim(file)
28 else
29 write(unit=stdout,fmt=*) ' error openiing netcdf file ', trim(file)
30 stop
31 end if
32
33 id_time = ncvid(cdfid, var, rcode)
34
35 rcode = nf_inq_var(cdfid, id_time, varnam, ivtype, ndims, dimids, natts)
36 if (debug) then
37 write(unit=stdout,fmt=*) ' number of dims for ',var,' ',ndims
38 end if
39 do i=1,ndims
40 rcode = nf_inq_dimlen(cdfid, dimids(i), dims(i))
41 if (debug) write(unit=stdout,fmt=*) ' dimension ',i,dims(i)
42 end do
43
44 call ncclos(cdfid,rcode)
45
46 ! if (trace_use) call da_trace_exit("da_get_dims_cdf")
47
48 end subroutine da_get_dims_cdf
49
50