\hypertarget{gdncvarcreated_8f90}{}\section{gtdata/gtdata\+\_\+netcdf/gdncvarcreated.f90 File Reference}
\label{gdncvarcreated_8f90}\index{gtdata/gtdata\+\_\+netcdf/gdncvarcreated.\+f90@{gtdata/gtdata\+\_\+netcdf/gdncvarcreated.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gdncvarcreated_8f90_a5935359cf9079afd0302e05aa1d009db}{gdncvarcreated} (var, url, xtype, length, overwrite, err)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gdncvarcreated_8f90_a5935359cf9079afd0302e05aa1d009db}\label{gdncvarcreated_8f90_a5935359cf9079afd0302e05aa1d009db}} 
\index{gdncvarcreated.\+f90@{gdncvarcreated.\+f90}!gdncvarcreated@{gdncvarcreated}}
\index{gdncvarcreated@{gdncvarcreated}!gdncvarcreated.\+f90@{gdncvarcreated.\+f90}}
\subsubsection{\texorpdfstring{gdncvarcreated()}{gdncvarcreated()}}
{\footnotesize\ttfamily subroutine gdncvarcreated (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(out)}]{var,  }\item[{character(len = $\ast$), intent(in)}]{url,  }\item[{character(len = $\ast$), intent(in)}]{xtype,  }\item[{integer, intent(in)}]{length,  }\item[{logical, intent(in), optional}]{overwrite,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



Definition at line 14 of file gdncvarcreated.\+f90.



References dc\+\_\+trace\+::beginsub(), dc\+\_\+trace\+::dbgmessage(), dc\+\_\+trace\+::endsub(), gdncfiledefinemode(), gdncfileopen(), dc\+\_\+error\+::gt\+\_\+enomem, dc\+\_\+error\+::storeerror(), dc\+\_\+types\+::string, and gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+add().


\begin{DoxyCode}
14   \textcolor{comment}{!}
15   \textcolor{comment}{!== 次元変数作成}
16   \textcolor{comment}{!}
17   \textcolor{comment}{! 変数 URL *url* に次元変数を作成します.}
18   \textcolor{comment}{! 次元変数の長さを *length* に与えます.}
19   \textcolor{comment}{! 返される引数 *var* には変数 ID などの情報が格納されます.}
20   \textcolor{comment}{!}
21   \textcolor{comment}{! *overwrite* に .true. を設定すると上書き可能なモードになります.}
22   \textcolor{comment}{! デフォルトは上書き不可です.}
23   \textcolor{comment}{! *err* を与える場合, 次元変数生成時にエラーが生じても}
24   \textcolor{comment}{! プログラムを終了せず, *err* に .false. が返ります.}
25   \textcolor{comment}{!}
26   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__types}{gtdata\_netcdf\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}, 
      \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__search}{gd\_nc\_variable\_search}
27   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__internal}{gtdata\_netcdf\_internal}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\_add}
28   \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__string_1_1strieq}{strieq}
29   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
30   \textcolor{keywordtype}{use }\hyperlink{namespacedc__url}{dc\_url}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}
31   \textcolor{keywordtype}{use }\hyperlink{namespacedc__trace}{dc\_trace}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}, \hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}, \hyperlink{namespacedc__trace_a2a38fceb4cf9baf298d63456238c3fea}{dbgmessage}
32   \textcolor{keywordtype}{use }netcdf\textcolor{keywordtype}{, only}: nf90\_noerr, nf90\_float, nf90\_int, nf90\_double, nf90\_char, &
33     & nf90\_def\_var, nf90\_def\_dim
34   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__file__generic}{gtdata\_netcdf\_file\_generic}\textcolor{keywordtype}{, only}: \hyperlink{gdncfileopen_8f90_a4f95f1f240238c6a431b39ea8e7c6f47}{gdncfileopen}, 
      \hyperlink{gdncfiledefinemode_8f90_afbd7b3565fcb4698e5f7eadf62fb4b35}{gdncfiledefinemode}
35   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a253c222db80053c2ddcac9a384424949}{gt\_enomem}
36   \textcolor{keywordtype}{implicit none}
37   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(out)}:: var
38   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: url
39   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: xtype
40   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: length
41   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: overwrite
42   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
43   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__search}{gd\_nc\_variable\_search}):: ent
44   \textcolor{keywordtype}{character(len = string)}:: filename, varname, cause\_c
45   \textcolor{keywordtype}{integer}:: stat
46   \textcolor{keywordtype}{integer}:: nc\_xtype
47   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"GDNcVarCreateD"}
48 \textcolor{keywordflow}{continue}
49   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subname, \textcolor{stringliteral}{'url=<%c>, xtype=<%c>, length=<%d>'}, &
50     & c1=trim(url), c2=trim(xtype), i=(/length/))
51   cause\_c = trim(url)
52   \textcolor{comment}{!}
53   \textcolor{comment}{! --- ファイルを用意 ---}
54   \textcolor{keyword}{call }\hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}(url, file=filename, var=varname)
55   \textcolor{keyword}{call }\hyperlink{gdncfileopen_8f90_a4f95f1f240238c6a431b39ea8e7c6f47}{gdncfileopen}(ent%fileid, filename, stat=stat, writable=.true., &
56     & overwrite=overwrite)
57   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
58   stat = \hyperlink{gdncfiledefinemode_8f90_afbd7b3565fcb4698e5f7eadf62fb4b35}{gdncfiledefinemode}(ent%fileid)
59   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
60   \textcolor{comment}{!}
61   \textcolor{comment}{! --- 型の決定 ---}
62   nc\_xtype = nf90\_float
63   \textcolor{keywordflow}{if} (\hyperlink{interfacedc__string_1_1strieq}{strieq}(xtype, \textcolor{stringliteral}{"double"}) .or. \hyperlink{interfacedc__string_1_1strieq}{strieq}(xtype, \textcolor{stringliteral}{"DOUBLEPRECISION"})) \textcolor{keywordflow}{then}
64     nc\_xtype = nf90\_double
65 \textcolor{keywordflow}{  endif}
66   \textcolor{keywordflow}{if} (\hyperlink{interfacedc__string_1_1strieq}{strieq}(xtype, \textcolor{stringliteral}{"int"}) .or. \hyperlink{interfacedc__string_1_1strieq}{strieq}(xtype, \textcolor{stringliteral}{"INTEGER"})) \textcolor{keywordflow}{then}
67     nc\_xtype = nf90\_int
68 \textcolor{keywordflow}{  endif}
69   \textcolor{keywordflow}{if} (\hyperlink{interfacedc__string_1_1strieq}{strieq}(xtype, \textcolor{stringliteral}{"char"}) .or. \hyperlink{interfacedc__string_1_1strieq}{strieq}(xtype, \textcolor{stringliteral}{"CHARACTER"})) \textcolor{keywordflow}{then}
70     nc\_xtype = nf90\_char
71 \textcolor{keywordflow}{  endif}
72   \textcolor{comment}{!}
73   \textcolor{comment}{! --- 次元変数の作成 ---}
74   stat = nf90\_def\_dim(ent%fileid, trim(varname), len=length, dimid=ent%dimid)
75   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
76   stat = nf90\_def\_var(ent%fileid, trim(varname), &
77     & xtype=nc\_xtype, dimids=(/ent%dimid/), varid=ent%varid)
78   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
79   \textcolor{comment}{!}
80   stat = \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\_add}(var, ent)
81   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
82 
83 999 \textcolor{keywordflow}{continue}
84   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, err, cause\_c=cause\_c)
85   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(-1)
86   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname, \textcolor{stringliteral}{'stat=%d'}, i=(/stat/))
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gdncvarcreated_8f90_a5935359cf9079afd0302e05aa1d009db_cgraph}
\end{center}
\end{figure}
