\hypertarget{gdncvaropenbydimord_8f90}{}\section{gtdata/gtdata\+\_\+netcdf/gdncvaropenbydimord.f90 File Reference}
\label{gdncvaropenbydimord_8f90}\index{gtdata/gtdata\+\_\+netcdf/gdncvaropenbydimord.\+f90@{gtdata/gtdata\+\_\+netcdf/gdncvaropenbydimord.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gdncvaropenbydimord_8f90_a4abcf8525590d06d25cbc5aaac6c6ccf}{gdncvaropenbydimord} (var, src\+\_\+var, dimord, err)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gdncvaropenbydimord_8f90_a4abcf8525590d06d25cbc5aaac6c6ccf}\label{gdncvaropenbydimord_8f90_a4abcf8525590d06d25cbc5aaac6c6ccf}} 
\index{gdncvaropenbydimord.\+f90@{gdncvaropenbydimord.\+f90}!gdncvaropenbydimord@{gdncvaropenbydimord}}
\index{gdncvaropenbydimord@{gdncvaropenbydimord}!gdncvaropenbydimord.\+f90@{gdncvaropenbydimord.\+f90}}
\subsubsection{\texorpdfstring{gdncvaropenbydimord()}{gdncvaropenbydimord()}}
{\footnotesize\ttfamily subroutine gdncvaropenbydimord (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(out)}]{var,  }\item[{type(gd\+\_\+nc\+\_\+variable), intent(in)}]{src\+\_\+var,  }\item[{integer, intent(in)}]{dimord,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



Definition at line 11 of file gdncvaropenbydimord.\+f90.



References gdncfileclose(), gdncfilereopen(), dc\+\_\+error\+::gt\+\_\+enomoredims, dc\+\_\+error\+::storeerror(), gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+add(), and gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+lookup().


\begin{DoxyCode}
11   \textcolor{comment}{!}
12   \textcolor{comment}{! 既に開かれた変数 *src\_var* の *dimord* 番目の次元にあたる変数を}
13   \textcolor{comment}{! 開き *var* に格納します。}
14   \textcolor{comment}{!}
15   \textcolor{comment}{! 変数を開く際にエラーが生じた場合、メッセージを出力してプログラムは}
16   \textcolor{comment}{! 強制終了します。*err* を与えてある場合にはこの引数に .true.}
17   \textcolor{comment}{! が返り、プログラムは終了しません。}
18   \textcolor{comment}{!}
19   \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__entry}{gd\_nc\_variable\_entry}, \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__search}{gd\_nc\_variable\_search}
20   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__internal}{gtdata\_netcdf\_internal}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}{vtable\_lookup}, 
      \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\_add}
21   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__file__generic}{gtdata\_netcdf\_file\_generic}\textcolor{keywordtype}{, only}: \hyperlink{gdncfilereopen_8f90_a642e55a67940177cbb599123e98ec6f1}{gdncfilereopen}, 
      \hyperlink{gdncfileclose_8f90_a66baca675a6538aeb500f29c3e36f905}{gdncfileclose}
22   \textcolor{keywordtype}{use }netcdf\textcolor{keywordtype}{, only}: nf90\_max\_name, nf90\_noerr, nf90\_einval, nf90\_enotvar, &
23     & nf90\_inquire\_dimension, nf90\_inq\_varid
24   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}
25   \textcolor{keywordtype}{implicit none}
26   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(out)}:: var
27   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(in)}:: src\_var
28   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: dimord
29   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
30   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__entry}{gd\_nc\_variable\_entry}):: src\_ent
31   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__search}{gd\_nc\_variable\_search}):: ent
32   \textcolor{keywordtype}{character(len = NF90\_MAX\_NAME)}:: dimname
33   \textcolor{keywordtype}{integer}:: stat
34 \textcolor{keywordflow}{continue}
35   stat = \hyperlink{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}{vtable\_lookup}(src\_var, src\_ent)
36   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
37   \textcolor{comment}{!}
38   \textcolor{keywordflow}{if} (dimord <= 0) \textcolor{keywordflow}{then}
39     \textcolor{comment}{!}
40     \textcolor{comment}{! dimord == 0 の特別扱いは廃止 (gtdata 層でやる)。}
41     \textcolor{comment}{! (同じハンドルを返すと参照カウントが増えないので多重クローズが}
42     \textcolor{comment}{! 禁止されてしまい、Open のセマンティクスに不適合なため。)}
43     \textcolor{comment}{!}
44     var = src\_var
45     stat = nf90\_einval
46     \textcolor{keywordflow}{goto} 999
47 \textcolor{keywordflow}{  endif}
48   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(src\_ent%dimids)) \textcolor{keywordflow}{then}
49     stat = \hyperlink{namespacedc__error_adbe5d07dca84213ae01fef87caf04be3}{gt\_enomoredims}
50     \textcolor{keywordflow}{goto} 999
51   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (dimord > \textcolor{keyword}{size}(src\_ent%dimids)) \textcolor{keywordflow}{then}
52     stat = \hyperlink{namespacedc__error_adbe5d07dca84213ae01fef87caf04be3}{gt\_enomoredims}
53     \textcolor{keywordflow}{goto} 999
54 \textcolor{keywordflow}{  endif}
55   \textcolor{comment}{!}
56   \textcolor{comment}{! 決定された次元 id を使って変数 id の確定を試みる}
57   \textcolor{comment}{!}
58   ent%fileid = src\_ent%fileid
59   ent%dimid = src\_ent%dimids(dimord)
60   stat = nf90\_inquire\_dimension(ent%fileid, ent%dimid, name = dimname)
61   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
62   stat = nf90\_inq\_varid(ent%fileid, dimname, ent%varid)
63   \textcolor{keywordflow}{if} (stat == nf90\_enotvar) \textcolor{keywordflow}{then}
64     \textcolor{comment}{! 変数が対応しなければ無視するだけ}
65     ent%varid = 0
66     stat = nf90\_noerr
67   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{then}
68     \textcolor{keywordflow}{goto} 999
69 \textcolor{keywordflow}{  endif}
70   \textcolor{comment}{!}
71   \textcolor{comment}{! 成功しそうなので参照カウント値を増やす}
72   \textcolor{keyword}{call }\hyperlink{gdncfilereopen_8f90_a642e55a67940177cbb599123e98ec6f1}{gdncfilereopen}(ent%fileid)
73   \textcolor{comment}{! 不適合な変数が開かれている場合は vtable\_add が変数部を無視する。}
74   stat = \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\_add}(var, ent)
75   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{then}
76     \textcolor{keyword}{call }\hyperlink{gdncfileclose_8f90_a66baca675a6538aeb500f29c3e36f905}{gdncfileclose}(ent%fileid)
77     \textcolor{keywordflow}{goto} 999
78 \textcolor{keywordflow}{  endif}
79 
80 999 \textcolor{keywordflow}{continue}
81   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, \textcolor{stringliteral}{'GDNcVarOpenByDimOrd'}, err, cause\_i=dimord)
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gdncvaropenbydimord_8f90_a4abcf8525590d06d25cbc5aaac6c6ccf_cgraph}
\end{center}
\end{figure}
