da_get_bdytimestr_cdf.inc
References to this file elsewhere.
1 subroutine da_get_bdytimestr_cdf(file, time_flag, bdytimestr, max_times, debug)
2
3 implicit none
4
5 #include "netcdf.inc"
6
7 integer, intent(in) :: max_times
8 logical, intent(in) :: debug
9 character(len=*), intent(in) :: file
10 character(len=*), intent(in) :: time_flag
11 character(len=80), intent(out) :: bdytimestr(max_times)
12
13 character(len=80) :: varnam, time1
14
15 integer :: cdfid, rcode, id_time
16 integer :: ndims, natts, idims(10), istart(10),iend(10), dimids(10)
17 integer :: i, ivtype
18
19 ! if (trace_use) call da_trace_entry("da_get_bdytimestr_cdf")
20
21 cdfid = ncopn(file, NCNOWRIT, rcode)
22
23 if (rcode == 0) then
24 if (debug) write(unit=stdout,fmt=*) ' open netcdf file ', trim(file)
25 else
26 write(unit=stdout,fmt=*) ' error openiing netcdf file ', trim(file)
27 stop
28 end if
29
30 varnam = 'md___' // trim(time_flag) // 'e_x_t_d_o_m_a_i_n_m_e_t_a_data_'
31
32 id_time = ncvid(cdfid, varnam, rcode)
33
34 rcode = nf_inq_var(cdfid, id_time, varnam, ivtype, ndims, dimids, natts)
35
36 if (debug) then
37 write(unit=stdout,fmt=*) ' number of dims for bdytime ',ndims
38 end if
39
40 do i=1,ndims
41 rcode = nf_inq_dimlen(cdfid, dimids(i), idims(i))
42 if (debug) write(unit=stdout,fmt=*) ' dimension ',i,idims(i)
43 end do
44
45 ! get the bdytime
46
47 do i=1,idims(2)
48 istart(1) = 1
49 iend(1) = idims(1)
50 istart(2) = i
51 iend(2) = 1
52
53 rcode = NF_GET_VARA_TEXT (cdfid, id_time, &
54 istart, iend, &
55 bdytimestr(i))
56 time1 = bdytimestr(i)
57
58 if (debug) write(unit=stdout,fmt=*) trim(file), time1(1:19)
59 bdytimestr(i) = time1(1:19)
60 end do
61
62 call ncclos(cdfid,rcode)
63
64 ! if (trace_use) call da_trace_exit("da_get_bdytimestr_cdf")
65
66 end subroutine da_get_bdytimestr_cdf
67
68