da_get_att_cdf.inc

References to this file elsewhere.
1 subroutine da_get_att_cdf(file, var, 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 
15    integer :: cdfid, status, varid, n, natts
16    character (len=256) :: att_name
17 
18    status = NF_OPEN(file, NF_NOWRITE, cdfid)
19 
20    status = NF_inQ_VARID(cdfid, var, varid)
21 
22    if (status == 0) then
23       if (debug) write(unit=stdout,fmt=*) ' open netcdf file ', trim(file)
24    else
25       write(unit=stdout,fmt=*) ' error openiing netcdf file ', trim(file)
26       stop
27    end if
28 
29    status = NF_inQ_VARNATTS(cdfid, varid, natts)
30 
31    do n=1, natts
32       status = NF_inQ_ATTNAME(cdfid, varid, n, att_name)
33 
34       write(unit=*, fmt='(a,i2,2a)') &
35         'att_name(',n,')=', trim(att_name)
36    end do
37 
38    status = NF_close(cdfid)
39 
40 end subroutine da_get_att_cdf
41 
42