\hypertarget{gtvarcreate_8f90}{}\section{gtdata/gtvarcreate.f90 File Reference}
\label{gtvarcreate_8f90}\index{gtdata/gtvarcreate.\+f90@{gtdata/gtvarcreate.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gtvarcreate_8f90_a6c97f35e71876edfdcf4945d775d0ce8}{gtvarcreate} (var, url, dims, xtype, long\+\_\+name, overwrite, err)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gtvarcreate_8f90_a6c97f35e71876edfdcf4945d775d0ce8}\label{gtvarcreate_8f90_a6c97f35e71876edfdcf4945d775d0ce8}} 
\index{gtvarcreate.\+f90@{gtvarcreate.\+f90}!gtvarcreate@{gtvarcreate}}
\index{gtvarcreate@{gtvarcreate}!gtvarcreate.\+f90@{gtvarcreate.\+f90}}
\subsubsection{\texorpdfstring{gtvarcreate()}{gtvarcreate()}}
{\footnotesize\ttfamily subroutine gtvarcreate (\begin{DoxyParamCaption}\item[{type(gt\+\_\+variable), intent(out)}]{var,  }\item[{character(len = $\ast$), intent(in)}]{url,  }\item[{type(gt\+\_\+variable), dimension(\+:), intent(in), optional}]{dims,  }\item[{character(len = $\ast$), intent(in), optional}]{xtype,  }\item[{character(len = $\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{logical, intent(in), optional}]{overwrite,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



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



References dc\+\_\+trace\+::beginsub(), dc\+\_\+trace\+::dbgmessage(), dc\+\_\+error\+::dc\+\_\+noerr, dc\+\_\+trace\+::endsub(), dc\+\_\+error\+::gt\+\_\+efake, gtdata\+\_\+internal\+\_\+map\+::gtvar\+\_\+dump(), gtdata\+\_\+internal\+\_\+map\+::map\+\_\+create(), dc\+\_\+error\+::storeerror(), dc\+\_\+types\+::token, and gtdata\+\_\+internal\+\_\+map\+::var\+\_\+class().


\begin{DoxyCode}
14   \textcolor{comment}{!}
15   \textcolor{comment}{!== 従属変数の作成}
16   \textcolor{comment}{!}
17   \textcolor{comment}{! 場所 *url* に次元 *dims* を持った変数つまり GT\_VARIABLE 型}
18   \textcolor{comment}{! の実体を作成し、それを第 1 引数 *var* にセットします。}
19   \textcolor{comment}{! Open されたものと同様、第1引数 *var* は後で必ず}
20   \textcolor{comment}{! Close されなければなりません。}
21   \textcolor{comment}{!}
22   \textcolor{comment}{! 型 *xtype* を省略すると "+float+" と}
23   \textcolor{comment}{! みなされます。既存変数があるとき失敗しますが、}
24   \textcolor{comment}{! overwrite == .true. であれば上書きして続行します。}
25   \textcolor{comment}{! (まだ *overwrite* の動作は保障されていません)。}
26   \textcolor{comment}{! dims の省略は 0 次元変数の設定を意味します。}
27   \textcolor{comment}{!}
28   \textcolor{comment}{! 作成の際にエラーが生じた場合、メッセージを出力してプログラムは}
29   \textcolor{comment}{! 強制終了します。*err* を与えてある場合にはこの引数に .true.}
30   \textcolor{comment}{! が返り、プログラムは終了しません。}
31   \textcolor{comment}{!}
32   \textcolor{comment}{!}
33   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}
34   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__internal__map}{gtdata\_internal\_map}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__internal__map_a86b920031832bea17e70a6bf4623c3d9}{var\_class}, vtb\_class\_netcdf, vtb\_class\_memory,
       &
35     & \hyperlink{namespacegtdata__internal__map_ab8c5494c00d4dd85417e891b762f77d9}{map\_create}, \hyperlink{namespacegtdata__internal__map_acbda65a71acbd7d3ba6175c6f4fceff0}{gtvar\_dump}
36   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__generic}{gtdata\_netcdf\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__generic_1_1create}{create}, \hyperlink{interfacegtdata__generic_1_1put__attr}{put\_attr}, 
      \hyperlink{interfacegtdata__generic_1_1inquire}{inquire}
37   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__types}{gtdata\_netcdf\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}
38   \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__string_1_1strhead}{strhead}
39   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}, \hyperlink{namespacedc__error_a3c706700d7fb6c0ff705558066f8e583}{gt\_efake}
40   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
41   \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}
42   \textcolor{keywordtype}{implicit none}
43   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(out)}:: var
44   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: url
45   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__types_1_1gt__variable}{gt\_variable}), \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: dims(:)
46   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: xtype
47   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: long\_name
48   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: overwrite
49   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
50   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{allocatable}:: gdnc\_dims(:)
51   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}):: gdnc
52   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{allocatable}:: allcount(:)
53   \textcolor{keywordtype}{integer}:: i, ndims, stat, cause\_i
54   \textcolor{keywordtype}{character(len = TOKEN)}:: myxtype
55   \textcolor{keywordtype}{character(len = *)},      \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"GTVarCreate"}
56   \textcolor{keywordtype}{character(len = *)},      \textcolor{keywordtype}{parameter}:: version = &
57     & \textcolor{stringliteral}{'$Name:  $'} // &
58     & \textcolor{stringliteral}{'$Id: gtvarcreate.f90,v 1.4 2009-05-25 09:55:58 morikawa Exp $'}
59 continue
60   stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
61   ndims = 0
62   cause\_i = 0
63   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dims)) ndims = \textcolor{keyword}{size}(dims)
64   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subname, \textcolor{stringliteral}{'url=%c ndims=%d'}, c1=trim(url), i=(/ndims/), &
65     & version=version)
66   \textcolor{keywordflow}{if} (\hyperlink{interfacedc__string_1_1strhead}{strhead}(url, \textcolor{stringliteral}{"memory:"})) \textcolor{keywordflow}{then}
67     \textcolor{comment}{! メモリ変数の作成}
68     stat = \hyperlink{namespacedc__error_a3c706700d7fb6c0ff705558066f8e583}{gt\_efake}
69     \textcolor{keywordflow}{goto} 999
70   \textcolor{keywordflow}{else}
71     \textcolor{comment}{! gdnc 変数の作成}
72     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(err)) err = .false.
73     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(xtype)) \textcolor{keywordflow}{then}
74       myxtype = xtype
75     \textcolor{keywordflow}{else}
76       myxtype = \textcolor{stringliteral}{"float"}
77 \textcolor{keywordflow}{    endif}
78     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dims)) \textcolor{keywordflow}{then}
79       \textcolor{keyword}{allocate}(gdnc\_dims(ndims), allcount(ndims))
80       \textcolor{keywordflow}{do}, i = 1, ndims
81         \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a86b920031832bea17e70a6bf4623c3d9}{var\_class}(dims(i), cid=gdnc\_dims(i)%id)
82         \textcolor{keyword}{call }\hyperlink{namespacedc__trace_a2a38fceb4cf9baf298d63456238c3fea}{dbgmessage}(\textcolor{stringliteral}{'dim=%d mapid=%d -> cid=%d'}, i=(/i, dims(i)%mapid, gdnc\_dims(i)%id/))
83         \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1inquire}{inquire}(gdnc\_dims(i), dimlen=allcount(i))
84 \textcolor{keywordflow}{      enddo}
85       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(var=gdnc, url=url, dims=gdnc\_dims, xtype=myxtype, &
86         & overwrite=overwrite, err=err)
87     \textcolor{keywordflow}{else}
88       ndims = 0
89       \textcolor{keyword}{allocate}(gdnc\_dims(1), allcount(1)) \textcolor{comment}{! dummy}
90       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1create}{create}(var=gdnc, url=url, dims=gdnc\_dims(1:0), &
91         & xtype=myxtype, overwrite=overwrite, err=err)
92 \textcolor{keywordflow}{    endif}
93     \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_ab8c5494c00d4dd85417e891b762f77d9}{map\_create}(var, vtb\_class\_netcdf, gdnc%id, ndims, allcount, stat)
94     \textcolor{keywordflow}{if} (stat /= \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}) \textcolor{keywordflow}{then}
95       cause\_i = ndims
96       \textcolor{keywordflow}{goto} 999
97 \textcolor{keywordflow}{    end if}
98     \textcolor{keyword}{deallocate}(gdnc\_dims, allcount)
99     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(long\_name)) \textcolor{keywordflow}{then}
100       \textcolor{keyword}{call }\hyperlink{interfacegtdata__generic_1_1put__attr}{put\_attr}(gdnc, \textcolor{stringliteral}{'long\_name'}, long\_name, err=err)
101 \textcolor{keywordflow}{    endif}
102 \textcolor{keywordflow}{  endif}
103   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_acbda65a71acbd7d3ba6175c6f4fceff0}{gtvar\_dump}(var)
104   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_a2a38fceb4cf9baf298d63456238c3fea}{dbgmessage}(\textcolor{stringliteral}{'var%%mapid=%d'}, i=(/var % mapid/))
105 999 \textcolor{keywordflow}{continue}
106   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, err, cause\_i=cause\_i)
107   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname)
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcreate_8f90_a6c97f35e71876edfdcf4945d775d0ce8_cgraph}
\end{center}
\end{figure}
