\hypertarget{gdncattrgetchar_8f90}{}\section{gtdata/gtdata\+\_\+netcdf/gdncattrgetchar.f90 File Reference}
\label{gdncattrgetchar_8f90}\index{gtdata/gtdata\+\_\+netcdf/gdncattrgetchar.\+f90@{gtdata/gtdata\+\_\+netcdf/gdncattrgetchar.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gdncattrgetchar_8f90_a98f8b316bd53c0b9a7d7094036b66a1e}{gdncattrgetchar} (var, name, value, default, stat)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gdncattrgetchar_8f90_a98f8b316bd53c0b9a7d7094036b66a1e}\label{gdncattrgetchar_8f90_a98f8b316bd53c0b9a7d7094036b66a1e}} 
\index{gdncattrgetchar.\+f90@{gdncattrgetchar.\+f90}!gdncattrgetchar@{gdncattrgetchar}}
\index{gdncattrgetchar@{gdncattrgetchar}!gdncattrgetchar.\+f90@{gdncattrgetchar.\+f90}}
\subsubsection{\texorpdfstring{gdncattrgetchar()}{gdncattrgetchar()}}
{\footnotesize\ttfamily subroutine gdncattrgetchar (\begin{DoxyParamCaption}\item[{type(gd\+\_\+nc\+\_\+variable), intent(in)}]{var,  }\item[{character(len = $\ast$), intent(in)}]{name,  }\item[{character(len = $\ast$), intent(out)}]{value,  }\item[{character(len = $\ast$), intent(in)}]{default,  }\item[{integer, intent(out)}]{stat }\end{DoxyParamCaption})}



Definition at line 4 of file gdncattrgetchar.\+f90.



References dc\+\_\+trace\+::beginsub(), dc\+\_\+trace\+::endsub(), dc\+\_\+error\+::gt\+\_\+echarshort, dc\+\_\+url\+::gt\+\_\+plus, and gtdata\+\_\+netcdf\+\_\+internal\+::vtable\+\_\+lookup().


\begin{DoxyCode}
4   \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}
5   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__internal}{gtdata\_netcdf\_internal}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}{vtable\_lookup}
6   \textcolor{keywordtype}{use }netcdf\textcolor{keywordtype}{, only}: nf90\_noerr, nf90\_global, nf90\_inquire\_attribute, nf90\_char, nf90\_get\_att, &
7     & nf90\_double, nf90\_float
8   \textcolor{keywordtype}{use }\hyperlink{namespacedc__url}{dc\_url}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__url_a373b7d2195c21ebf1458e79ad72dce0d}{gt\_plus}
9   \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__string_1_1tochar}{tochar}
10   \textcolor{keywordtype}{use }\hyperlink{namespacedc__trace}{dc\_trace}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}, \hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}
11   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}
12   \textcolor{keywordtype}{implicit none}
13   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}), \textcolor{keywordtype}{intent(in)}:: var
14   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: name
15   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(out)}:: value
16   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: default
17   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(out)}:: stat
18   \textcolor{keywordtype}{type}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable__entry}{gd\_nc\_variable\_entry}):: ent
19   \textcolor{keywordtype}{character(len = 64)}:: buffer
20   \textcolor{keywordtype}{double precision}, \textcolor{keywordtype}{allocatable}:: dbuf(:)
21   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{allocatable}:: ibuf(:)
22   \textcolor{keywordtype}{character}, \textcolor{keywordtype}{allocatable}:: cbuf(:)
23   \textcolor{keywordtype}{integer}:: xtype, attrlen, i, iname, varid
24   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{parameter}:: subname = \textcolor{stringliteral}{"GDNcAttrGetChar"}
25   \textcolor{keywordflow}{continue}
26   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_aca1efe8bae50b85f74980a8c4d704dd8}{beginsub}(subname, \textcolor{stringliteral}{"var=%d name=%c default=%c"}, i=(/var%id/), &
27     & c1=trim(name), c2=trim(default))
28   stat = \hyperlink{namespacegtdata__netcdf__internal_afe013c8012ec100bf1e94e5147c340de}{vtable\_lookup}(var, ent)
29   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 900
30   \textcolor{keywordflow}{if} (name(1:1) == \hyperlink{namespacedc__url_a373b7d2195c21ebf1458e79ad72dce0d}{gt\_plus}) \textcolor{keywordflow}{then}
31     varid = nf90\_global
32     iname = 2
33   \textcolor{keywordflow}{else}
34     varid = ent%varid
35     iname = 1
36 \textcolor{keywordflow}{  endif}
37   stat = nf90\_inquire\_attribute(ent%fileid, varid, name(iname:), xtype=xtype, len=attrlen)
38   \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 900
39   \textcolor{keywordflow}{if} (xtype == nf90\_char .and. attrlen <= len(buffer)) \textcolor{keywordflow}{then}
40     stat = nf90\_get\_att(ent%fileid, varid, name(iname:), buffer)
41     \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 900
42     \textcolor{keywordtype}{value} = buffer(1: attrlen)
43     \textcolor{keywordflow}{if} (attrlen > len(\textcolor{keywordtype}{value})) stat = \hyperlink{namespacedc__error_a0ff71d69e417cfbfc1490ff4466da417}{gt\_echarshort}
44   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (xtype == nf90\_char) \textcolor{keywordflow}{then}
45     \textcolor{comment}{! UNIDATA NetCDF ライブラリでは文字列引数の長さを}
46     \textcolor{comment}{! まったく取得していないので先頭が結合していれば OK のはず}
47     \textcolor{keyword}{allocate}(cbuf(attrlen))
48     stat = nf90\_get\_att(ent%fileid, varid, name(iname:), cbuf(1))
49     \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 900
50     \textcolor{keywordflow}{do}, i = 1, attrlen
51       value(i:i) = cbuf(i)
52 \textcolor{keywordflow}{    enddo}
53     \textcolor{keywordflow}{if} (attrlen < len(\textcolor{keywordtype}{value})) value(attrlen + 1: ) = \textcolor{stringliteral}{' '}
54     \textcolor{keywordflow}{if} (attrlen > len(\textcolor{keywordtype}{value})) stat = \hyperlink{namespacedc__error_a0ff71d69e417cfbfc1490ff4466da417}{gt\_echarshort}
55     \textcolor{keyword}{deallocate}(cbuf)
56   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (xtype == nf90\_double .or. xtype == nf90\_float) \textcolor{keywordflow}{then}
57     \textcolor{keyword}{allocate}(dbuf(attrlen))
58     stat = nf90\_get\_att(ent%fileid, varid, name(iname:), dbuf)
59     \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 900
60     \textcolor{keywordtype}{value} = \hyperlink{interfacedc__string_1_1tochar}{tochar}(dbuf)
61     \textcolor{keyword}{deallocate}(dbuf)
62   \textcolor{keywordflow}{else}
63     \textcolor{keyword}{allocate}(ibuf(attrlen))
64     stat = nf90\_get\_att(ent%fileid, varid, name(iname:), ibuf)
65     \textcolor{keywordflow}{if} (stat /= nf90\_noerr) \textcolor{keywordflow}{goto} 900
66     \textcolor{keywordtype}{value} = \hyperlink{interfacedc__string_1_1tochar}{tochar}(ibuf)
67     \textcolor{keyword}{deallocate}(ibuf)
68 \textcolor{keywordflow}{  endif}
69   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname)
70   \textcolor{keywordflow}{return}
71   \textcolor{comment}{! デフォルト処理}
72 900 \textcolor{keywordflow}{continue}
73   \textcolor{keywordtype}{value} = default
74   \textcolor{keyword}{call }\hyperlink{namespacedc__trace_ae44de97565a3bdd685789c7748b37e37}{endsub}(subname, \textcolor{stringliteral}{"value := default"})
75   \textcolor{keywordflow}{return}
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gdncattrgetchar_8f90_a98f8b316bd53c0b9a7d7094036b66a1e_cgraph}
\end{center}
\end{figure}
