14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
38 use dc_string, only: strhead
41 use dc_trace, only: beginsub, endsub, dbgmessage
42 implicit none
43 type(GT_VARIABLE), intent(out):: var
44 character(len = *), intent(in):: url
45 type(GT_VARIABLE), intent(in), optional:: dims(:)
46 character(len = *), intent(in), optional:: xtype
47 character(len = *), intent(in), optional:: long_name
48 logical, intent(in), optional:: overwrite
49 logical, intent(out), optional:: err
50 type(GD_NC_VARIABLE), allocatable:: gdnc_dims(:)
51 type(GD_NC_VARIABLE):: gdnc
52 integer, allocatable:: allcount(:)
53 integer:: i, ndims, stat, cause_i
54 character(len = TOKEN):: myxtype
55 character(len = *), parameter:: subname = "GTVarCreate"
56 character(len = *), parameter:: version = &
57 & '$Name: $' // &
58 & '$Id: gtvarcreate.f90,v 1.4 2009-05-25 09:55:58 morikawa Exp $'
59continue
61 ndims = 0
62 cause_i = 0
63 if (present(dims)) ndims = size(dims)
64 call beginsub(subname, 'url=%c ndims=%d', c1=trim(url), i=(/ndims/), &
65 & version=version)
66
67 if (present(err)) err = .false.
68 if (present(xtype)) then
69 myxtype = xtype
70 else
71 myxtype = "float"
72 endif
73 if (present(dims)) then
74 allocate(gdnc_dims(ndims), allcount(ndims))
75 do, i = 1, ndims
76 call var_class(dims(i), cid=gdnc_dims(i)%id)
77 call dbgmessage('dim=%d mapid=%d -> cid=%d', i=(/i, dims(i)%mapid, gdnc_dims(i)%id/))
78 call inquire(gdnc_dims(i), dimlen=allcount(i))
79 enddo
80 call create(var=gdnc, url=url, dims=gdnc_dims, xtype=myxtype, &
81 & overwrite=overwrite, err=err)
82 else
83 ndims = 0
84 allocate(gdnc_dims(1), allcount(1))
85 call create(var=gdnc, url=url, dims=gdnc_dims(1:0), &
86 & xtype=myxtype, overwrite=overwrite, err=err)
87 endif
88 call map_create(var, vtb_class_netcdf, gdnc%id, ndims, allcount, stat)
90 cause_i = ndims
91 goto 999
92 end if
93 deallocate(gdnc_dims, allcount)
94 if (present(long_name)) then
95 call put_attr(gdnc,
'long_name', long_name, err=err)
96 endif
98 call dbgmessage('var%%mapid=%d', i=(/var % mapid/))
99999 continue
100 call storeerror(stat, subname, err, cause_i=cause_i)
101 call endsub(subname)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public gt_efake
integer, parameter, public dc_noerr
Provides kind type parameter values.
integer, parameter, public token
Character length for word, token
subroutine, public var_class(var, class, cid)
subroutine, public map_create(var, class, cid, ndims, allcount, stat)
subroutine gtvar_dump(var)