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=*), 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 ! if (trace_use) call da_trace_entry("da_get_att_cdf")
19
20 status = NF_OPEN(file, NF_NOWRITE, cdfid)
21
22 status = NF_inQ_VARID(cdfid, var, varid)
23
24 if (status == 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 status = NF_inQ_VARNATTS(cdfid, varid, natts)
32
33 do n=1, natts
34 status = NF_inQ_ATTNAME(cdfid, varid, n, att_name)
35
36 write(unit=stdout, fmt='(a,i2,2a)') &
37 'att_name(',n,')=', trim(att_name)
38 end do
39
40 status = NF_close(cdfid)
41
42 ! if (trace_use) call da_trace_exit("da_get_att_cdf")
43
44 end subroutine da_get_att_cdf
45
46