1 subroutine da_put_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_put_var_2d_int_cdf")
24 cdfid = ncopn(file, NCWRITE, rcode)
26 if ( rcode == 0 ) then
27 if (debug) write(unit=stdout,fmt='(2a)') ' open netcdf file ', trim(file)
29 write(unit=stdout, fmt='(2a)') ' error opening netcdf file ', trim(file)
33 id_data = ncvid(cdfid, var, rcode)
35 rcode = nf_inq_var(cdfid, id_data, varnam, ivtype, ndims, dimids, natts)
38 write(unit=stdout, fmt='(3a,i6)') ' number of dims for ',var,' ',ndims
42 rcode = nf_inq_dimlen(cdfid, dimids(i), idims(i))
44 write(unit=stdout, fmt='(a,2i6)') ' dimension ',i,idims(i)
45 write(unit=stdout, fmt='(a,i6)') ' ivtype=', ivtype
46 write(unit=stdout, fmt='(a, a)') ' varnam=', trim(varnam)
50 ! check the dimensions
52 if ((i1 /= idims(1)) .or. &
53 (i2 /= idims(2)) .or. &
54 (time > idims(3)) ) then
56 write(unit=stdout,fmt=*) ' error in 2d_var_int read, dimension problem '
57 write(unit=stdout,fmt=*) i1, idims(1)
58 write(unit=stdout,fmt=*) i2, idims(2)
59 write(unit=stdout,fmt=*) time, idims(4)
60 write(unit=stdout,fmt=*) ' error stop '
74 call ncvpt(cdfid,id_data,istart,iend,data,rcode)
76 call ncclos(cdfid,rcode)
78 ! if (trace_use) call da_trace_exit("da_put_var_2d_int_cdf")
80 end subroutine da_put_var_2d_int_cdf