1 subroutine da_get_var_2d_int_cdf(file, var, data, i1, i2, time, debug)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
11 integer, intent(in) :: i1, i2, time
12 character (len=*), intent(in) :: file
13 logical, intent(in) :: debug
14 character (len=*), intent(in) :: var
15 integer, intent(out) :: data(i1,i2)
17 integer :: cdfid, rcode, id_data
18 character (len=80) :: varnam
19 integer :: ndims, natts, idims(10), istart(10),iend(10), dimids(10)
22 ! if (trace_use) call da_trace_entry("da_get_var_2d_int_cdf")
24 cdfid = ncopn(file, NCNOWRIT, rcode)
27 write(unit=stdout, fmt='(2a)') ' error opening netcdf file ', trim(file)
31 id_data = ncvid(cdfid, var, rcode)
33 rcode = nf_inq_var(cdfid, id_data, varnam, ivtype, ndims, dimids, natts)
36 write(unit=stdout, fmt='(3a,i6)') ' get_var_2d_real_cdf: dims for ',var,' ',ndims
40 rcode = nf_inq_dimlen(cdfid, dimids(i), idims(i))
42 write(unit=stdout, fmt='(a,2i6)') ' dimension ',i,idims(i)
43 write(unit=stdout, fmt='(a,i6)') ' ivtype=', ivtype
44 write(unit=stdout, fmt='(a, a)') ' varnam=', trim(varnam)
48 ! check the dimensions
50 if ((i1 /= idims(1)) .or. &
51 (i2 /= idims(2)) .or. &
52 (time > idims(3)) ) then
54 write(unit=stdout,fmt=*) ' error in 2d_var_real read, dimension problem '
55 write(unit=stdout,fmt=*) i1, idims(1)
56 write(unit=stdout,fmt=*) i2, idims(2)
57 write(unit=stdout,fmt=*) time, idims(4)
58 write(unit=stdout,fmt=*) ' error stop '
72 call ncvgt(cdfid,id_data,istart,iend,data,rcode)
75 write(unit=stdout, fmt='(a, i8)') ' Sample data=', data(1,1)
78 call ncclos(cdfid,rcode)
80 ! if (trace_use) call da_trace_exit("da_get_var_2d_int_cdf")
82 end subroutine da_get_var_2d_int_cdf