\hypertarget{gdncvaropen_8f90}{}\section{gtdata/gtdata\+\_\+netcdf/gdncvaropen.f90 File Reference}
\label{gdncvaropen_8f90}\index{gtdata/gtdata\+\_\+netcdf/gdncvaropen.\+f90@{gtdata/gtdata\+\_\+netcdf/gdncvaropen.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
recursive subroutine \hyperlink{gdncvaropen_8f90_acc5d6d572e949b20a4634b154c919291}{gdncvaropen} (var, url, writable, err)
\end{DoxyCompactItemize}


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



Definition at line 13 of file gdncvaropen.\+f90.



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


\begin{DoxyCode}
13   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
14   \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}
15   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__internal}{gtdata\_netcdf\_internal}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\_add}
16   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__file__generic}{gtdata\_netcdf\_file\_generic}\textcolor{keywordtype}{, only}: \hyperlink{gdncfileopen_8f90_a4f95f1f240238c6a431b39ea8e7c6f47}{gdncfileopen}
17   \textcolor{keywordtype}{use }\hyperlink{namespacedc__url}{dc\_url}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}
18   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}
19   \textcolor{keywordtype}{use }\hyperlink{namespacedc__trace}{dc\_trace}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}, \hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}
20   \textcolor{keywordtype}{use }netcdf\textcolor{keywordtype}{, only}: nf90\_noerr, nf90\_max\_name, nf90\_enotvar, nf90\_ebaddim, &
21     & nf90\_inq\_varid, nf90\_inq\_dimid, nf90\_inquire\_variable, nf90\_inquire
22   \textcolor{keywordtype}{implicit none}
23   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(out)}:: var
24   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: url
25   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: writable
26   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
27   \textcolor{keywordtype}{character(len = STRING)}:: filename, varname
28   \textcolor{keywordtype}{character(len = NF90\_MAX\_NAME)}:: dimname
29   \textcolor{keywordtype}{integer}:: stat, nvars, i
30   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__search}{gd\_nc\_variable\_search}):: e
31   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{'GDNcVarOpen'}
32 \textcolor{keywordflow}{continue}
33   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subname)
34   \textcolor{keyword}{call }\hyperlink{interfacedc__url_1_1urlsplit}{urlsplit}(url, file=filename, var=varname)
35   \textcolor{keywordflow}{if} (filename == \textcolor{stringliteral}{""}) filename = \textcolor{stringliteral}{"gtool.nc"}
36   \textcolor{keyword}{call }\hyperlink{gdncfileopen_8f90_a4f95f1f240238c6a431b39ea8e7c6f47}{gdncfileopen}(e%fileid, trim(filename), stat=stat, writable=writable, err=err )
37   \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{goto} 999
38   \textcolor{comment}{!}
39   \textcolor{comment}{! 名前から変数を探し出す}
40   \textcolor{comment}{!}
41   \textcolor{keywordflow}{if} (varname /= \textcolor{stringliteral}{''}) \textcolor{keywordflow}{then}
42     e%varid = 0
43     stat = nf90\_inq\_varid(e%fileid, trim(varname), e%varid)
44     \textcolor{keywordflow}{if} (stat == nf90\_enotvar) \textcolor{keywordflow}{then}
45       e%varid = 0
46       stat = nf90\_noerr
47 \textcolor{keywordflow}{    endif}
48   \textcolor{keywordflow}{else}
49     \textcolor{comment}{! 名前が空ならできれば次元変数でない最初の変数をとりだす}
50     stat = nf90\_inquire(e%fileid, nvariables = nvars)
51     \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{goto} 999
52     e%varid = 1
53     \textcolor{keywordflow}{do}, i = 1, nvars
54       stat = nf90\_inquire\_variable(e%fileid, i, name = dimname)
55       \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
56       stat = nf90\_inq\_dimid(e%fileid, dimname, e%dimid)
57       \textcolor{keywordflow}{if} (stat == nf90\_noerr) cycle
58       \textcolor{keywordflow}{if} (stat /= nf90\_ebaddim) \textcolor{keywordflow}{goto} 999
59       e%varid = i
60       stat = nf90\_noerr
61       \textcolor{keywordflow}{exit}
62 \textcolor{keywordflow}{    enddo}
63 \textcolor{keywordflow}{  endif}
64   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
65   \textcolor{comment}{!}
66   \textcolor{comment}{! 次元id を調べる}
67   \textcolor{comment}{!}
68   stat = nf90\_inq\_dimid(e%fileid, trim(varname), e%dimid)
69   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{then}
70     \textcolor{keywordflow}{if} (e%varid <= 0) \textcolor{keywordflow}{goto} 999
71     e%dimid = 0
72 \textcolor{keywordflow}{  endif}
73   \textcolor{comment}{!}
74   stat = \hyperlink{namespacegtdata__netcdf__internal_ae0fc3a443b08733d689ce0aad981eb71}{vtable\_add}(var, e)
75   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 999
76   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname, \textcolor{stringliteral}{'an=%d file=%d var=%d'}, i=(/var%id, e%fileid, e%varid/))
77   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, err)
78   \textcolor{keywordflow}{return}
79   \textcolor{comment}{!}
80   \textcolor{comment}{! エラー処理 (正常完了時も呼ぶ)}
81   \textcolor{comment}{!}
82 999 \textcolor{keywordflow}{continue}
83   var = \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(-1)
84   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname, \textcolor{stringliteral}{'an=%d err'}, i=(/var%id/))
85   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, err, cause\_c=url)
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gdncvaropen_8f90_acc5d6d572e949b20a4634b154c919291_cgraph}
\end{center}
\end{figure}
