overwrite に .true. を設定すると上書き可能モード (デフォルト: 上書き不可)。 err を与えた場合、エラー時はプログラム終了せず .false. が返されます。
61 use netcdf, only: nf90_noerr, nf90_float, nf90_int, nf90_double, nf90_char, &
62 & nf90_def_var, nf90_def_dim
65 implicit none
66 type(GD_NC_VARIABLE), intent(out):: var
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
72 type(GD_NC_VARIABLE_SEARCH):: ent
73 character(len = string):: filename, varname, cause_c
74 integer:: stat
75 integer:: nc_xtype
76 character(len = *), parameter:: subname = "GDNcVarCreateD"
77continue
78 call beginsub(subname,
'url=<%c>, xtype=<%c>, length=<%d>', &
79 & c1=trim(url), c2=trim(xtype), i=(/length/))
80 cause_c = trim(url)
81
82
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
89
90
91 nc_xtype = nf90_float
92 if (
strieq(xtype,
"double"))
then
93 nc_xtype = nf90_double
94 else if (
strieq(xtype,
"DOUBLEPRECISION"))
then
95 nc_xtype = nf90_double
96 end if
97 if (
strieq(xtype,
"int"))
then
98 nc_xtype = nf90_int
99 else if (
strieq(xtype,
"INTEGER"))
then
100 nc_xtype = nf90_int
101 end if
102 if (
strieq(xtype,
"char"))
then
103 nc_xtype = nf90_char
104 else if (
strieq(xtype,
"CHARACTER"))
then
105 nc_xtype = nf90_char
106 end if
107
108
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
114
116 if (stat /= nf90_noerr) goto 999
117
118999 continue
119 call storeerror(stat, subname, err, cause_c=cause_c)
121 call endsub(subname,
'stat=%d', i=(/stat/))
subroutine, public storeerror(number, where, err, cause_c, cause_i)
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)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
integer function, public vtable_add(var, entry)