61 use netcdf,
only: nf90_noerr, nf90_float, nf90_int, nf90_double, nf90_char, &
62 & nf90_def_var, nf90_def_dim
67 character(len = *),
intent(in):: url
68 character(len = *),
intent(in):: xtype
69 integer,
intent(in):: length
70 logical,
intent(in),
optional:: overwrite
71 logical,
intent(out),
optional:: err
73 character(len = string):: filename, varname, cause_c
76 character(len = *),
parameter:: subname =
"GDNcVarCreateD"
78 call beginsub(subname,
'url=<%c>, xtype=<%c>, length=<%d>', &
79 & c1=trim(url), c2=trim(xtype), i=(/length/))
83 call urlsplit(url, file=filename, var=varname)
84 call gdncfileopen(ent%fileid, filename, stat=stat, writable=.true., &
85 & overwrite=overwrite)
86 if (stat /= nf90_noerr)
goto 999
88 if (stat /= nf90_noerr)
goto 999
92 if (
strieq(xtype,
"double"))
then
93 nc_xtype = nf90_double
94 else if (
strieq(xtype,
"DOUBLEPRECISION"))
then
95 nc_xtype = nf90_double
97 if (
strieq(xtype,
"int"))
then
99 else if (
strieq(xtype,
"INTEGER"))
then
102 if (
strieq(xtype,
"char"))
then
104 else if (
strieq(xtype,
"CHARACTER"))
then
109 stat = nf90_def_dim(ent%fileid, trim(varname), len=length, dimid=ent%dimid)
110 if (stat /= nf90_noerr)
goto 999
111 stat = nf90_def_var(ent%fileid, trim(varname), &
112 & xtype=nc_xtype, dimids=(/ent%dimid/), varid=ent%varid)
113 if (stat /= nf90_noerr)
goto 999
116 if (stat /= nf90_noerr)
goto 999
119 call storeerror(stat, subname, err, cause_c=cause_c)
121 call endsub(subname,
'stat=%d', i=(/stat/))
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)