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=80), intent(in) :: file
12    character (len=*), intent(in) :: var
13    logical, intent(in) :: debug
14    integer, intent(out), dimension(4) :: dims
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    cdfid = ncopn(file, NCNOWRIT, rcode)
23 
24    if (rcode == 0) then
25       if (debug) write(unit=stdout,fmt=*) ' open netcdf file ', trim(file)
26    else
27       write(unit=stdout,fmt=*) ' error openiing netcdf file ', trim(file)
28       stop
29    end if
30 
31    id_time = ncvid(cdfid, var, rcode)
32 
33    rcode = nf_inq_var(cdfid, id_time, varnam, ivtype, ndims, dimids, natts)
34    if (debug) then
35       write(unit=stdout,fmt=*) ' number of dims for ',var,' ',ndims
36    end if
37    do i=1,ndims
38       rcode = nf_inq_dimlen(cdfid, dimids(i), dims(i))
39       if (debug) write(unit=stdout,fmt=*) ' dimension ',i,dims(i)
40    end do
41 
42    call ncclos(cdfid,rcode)
43 
44 end subroutine da_get_dims_cdf
45 
46