gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gdncvarcreated.f90
Go to the documentation of this file.
1
21
54subroutine gdncvarcreated(var, url, xtype, length, overwrite, err)
57 use dc_string, only: strieq
58 use dc_types, only: string
59 use dc_url, only: urlsplit
61 use netcdf, only: nf90_noerr, nf90_float, nf90_int, nf90_double, nf90_char, &
62 & nf90_def_var, nf90_def_dim
64 use dc_error, only: storeerror
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
87 stat = gdncfiledefinemode(ent%fileid)
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 !
115 stat = vtable_add(var, ent)
116 if (stat /= nf90_noerr) goto 999
117
118999 continue
119 call storeerror(stat, subname, err, cause_c=cause_c)
120 if (stat /= nf90_noerr) var = gd_nc_variable(-1)
121 call endsub(subname, 'stat=%d', i=(/stat/))
122end subroutine gdncvarcreated
subroutine gdncvarcreated(var, url, xtype, length, overwrite, err)
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
文字型変数の操作
Definition dc_string.f90:83
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
変数 URL の文字列解析
Definition dc_url.f90:61
integer function, public vtable_add(var, entry)