

\subsection{Create a horizontal Grid: {\tt gridCreate}}
\index{gridCreate}
\label{gridCreate}

The function {\tt gridCreate} creates a horizontal Grid.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridCreate(INTEGER gridtype, INTEGER size)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridtype\ }
\item[{\tt gridtype}]
The type of the grid, one of the set of predefined {\CDI} grid types.
                     The valid {\CDI} grid types are {\tt GRID\_GENERIC}, {\tt GRID\_GAUSSIAN},
                     {\tt GRID\_LONLAT}, {\tt GRID\_LCC}, {\tt GRID\_SPECTRAL},
                     {\tt GRID\_GME}, {\tt GRID\_CURVILINEAR}, {\tt GRID\_UNSTRUCTURED} and
                     {\tt GRID\_REFERENCE}
\item[{\tt size}]
Number of gridpoints.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridCreate} returns an identifier to the Grid.


\subsubsection*{Example}

Here is an example using {\tt gridCreate} to create a regular lon/lat Grid:

\begin{lstlisting}[language=Fortran, backgroundcolor=\color{pyellow}, basicstyle=\small, columns=flexible]

    INCLUDE 'cdi.h'
       ...
    #define  nlon  12
    #define  nlat   6
       ...
    REAL*8 lons(nlon) = (/0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/)
    REAL*8 lats(nlat) = (/-75, -45, -15, 15, 45, 75/)
    INTEGER gridID
       ...
    gridID = gridCreate(GRID_LONLAT, nlon*nlat)
    CALL gridDefXsize(gridID, nlon)
    CALL gridDefYsize(gridID, nlat)
    CALL gridDefXvals(gridID, lons)
    CALL gridDefYvals(gridID, lats)
       ...
\end{lstlisting}


\subsection{Destroy a horizontal Grid: {\tt gridDestroy}}
\index{gridDestroy}
\label{gridDestroy}
\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDestroy(INTEGER gridID)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.

\end{deflist}
\end{minipage}


\subsection{Duplicate a horizontal Grid: {\tt gridDuplicate}}
\index{gridDuplicate}
\label{gridDuplicate}

The function {\tt gridDuplicate} duplicates a horizontal Grid.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridDuplicate(INTEGER gridID)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}},
                    {\htmlref{\tt gridDuplicate}{gridDuplicate}} or {\htmlref{\tt vlistInqVarGrid}{vlistInqVarGrid}}.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridDuplicate} returns an identifier to the duplicated Grid.



\subsection{Get the type of a Grid: {\tt gridInqType}}
\index{gridInqType}
\label{gridInqType}

The function {\tt gridInqType} returns the type of a Grid.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridInqType(INTEGER gridID)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqType} returns the type of the grid,
one of the set of predefined {\CDI} grid types.
The valid {\CDI} grid types are {\tt GRID\_GENERIC}, {\tt GRID\_GAUSSIAN},
{\tt GRID\_LONLAT}, {\tt GRID\_LCC}, {\tt GRID\_SPECTRAL}, {\tt GRID\_GME},
{\tt GRID\_CURVILINEAR}, {\tt GRID\_UNSTRUCTURED} and {\tt GRID\_REFERENCE}.



\subsection{Get the size of a Grid: {\tt gridInqSize}}
\index{gridInqSize}
\label{gridInqSize}

The function {\tt gridInqSize} returns the size of a Grid.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridInqSize(INTEGER gridID)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqSize} returns the number of grid points of a Grid.



\subsection{Define the number of values of a X-axis: {\tt gridDefXsize}}
\index{gridDefXsize}
\label{gridDefXsize}

The function {\tt gridDefXsize} defines the number of values of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefXsize(INTEGER gridID, INTEGER xsize)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt xsize}]
Number of values of a X-axis.

\end{deflist}
\end{minipage}


\subsection{Get the number of values of a X-axis: {\tt gridInqXsize}}
\index{gridInqXsize}
\label{gridInqXsize}

The function {\tt gridInqXsize} returns the number of values of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqXsize(INTEGER gridID)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqXsize} returns the number of values of a X-axis.



\subsection{Define the number of values of a Y-axis: {\tt gridDefYsize}}
\index{gridDefYsize}
\label{gridDefYsize}

The function {\tt gridDefYsize} defines the number of values of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefYsize(INTEGER gridID, INTEGER ysize)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt ysize}]
Number of values of a Y-axis.

\end{deflist}
\end{minipage}


\subsection{Get the number of values of a Y-axis: {\tt gridInqYsize}}
\index{gridInqYsize}
\label{gridInqYsize}

The function {\tt gridInqYsize} returns the number of values of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqYsize(INTEGER gridID)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqYsize} returns the number of values of a Y-axis.



\subsection{Define the values of a X-axis: {\tt gridDefXvals}}
\index{gridDefXvals}
\label{gridDefXvals}

The function {\tt gridDefXvals} defines all values of the X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefXvals(INTEGER gridID, const REAL*8 xvals)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt xvals}]
X-values of the grid.

\end{deflist}
\end{minipage}


\subsection{Get all values of a X-axis: {\tt gridInqXvals}}
\index{gridInqXvals}
\label{gridInqXvals}

The function {\tt gridInqXvals} returns all values of the X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridInqXvals(INTEGER gridID, REAL*8 xvals)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt xvals}]
Pointer to the location into which the X-values are read.
                    The caller must allocate space for the returned values.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

Upon successful completion {\tt gridInqXvals} returns the number of values and
the values are stored in {\tt xvals}.
Otherwise, 0 is returned and {\tt xvals} is empty.



\subsection{Define the values of a Y-axis: {\tt gridDefYvals}}
\index{gridDefYvals}
\label{gridDefYvals}

The function {\tt gridDefYvals} defines all values of the Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefYvals(INTEGER gridID, const REAL*8 yvals)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt yvals}]
Y-values of the grid.

\end{deflist}
\end{minipage}


\subsection{Get all values of a Y-axis: {\tt gridInqYvals}}
\index{gridInqYvals}
\label{gridInqYvals}

The function {\tt gridInqYvals} returns all values of the Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridInqYvals(INTEGER gridID, REAL*8 yvals)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt yvals}]
Pointer to the location into which the Y-values are read.
                    The caller must allocate space for the returned values.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

Upon successful completion {\tt gridInqYvals} returns the number of values and
the values are stored in {\tt yvals}.
Otherwise, 0 is returned and {\tt yvals} is empty.



\subsection{Define the bounds of a X-axis: {\tt gridDefXbounds}}
\index{gridDefXbounds}
\label{gridDefXbounds}

The function {\tt gridDefXbounds} defines all bounds of the X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefXbounds(INTEGER gridID, const REAL*8 xbounds)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt xbounds\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt xbounds}]
X-bounds of the grid.

\end{deflist}
\end{minipage}


\subsection{Get the bounds of a X-axis: {\tt gridInqXbounds}}
\index{gridInqXbounds}
\label{gridInqXbounds}

The function {\tt gridInqXbounds} returns the bounds of the X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridInqXbounds(INTEGER gridID, REAL*8 xbounds)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt xbounds\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt xbounds}]
Pointer to the location into which the X-bounds are read.
                    The caller must allocate space for the returned values.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

Upon successful completion {\tt gridInqXbounds} returns the number of bounds and
the bounds are stored in {\tt xbounds}.
Otherwise, 0 is returned and {\tt xbounds} is empty.



\subsection{Define the bounds of a Y-axis: {\tt gridDefYbounds}}
\index{gridDefYbounds}
\label{gridDefYbounds}

The function {\tt gridDefYbounds} defines all bounds of the Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefYbounds(INTEGER gridID, const REAL*8 ybounds)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt ybounds\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt ybounds}]
Y-bounds of the grid.

\end{deflist}
\end{minipage}


\subsection{Get the bounds of a Y-axis: {\tt gridInqYbounds}}
\index{gridInqYbounds}
\label{gridInqYbounds}

The function {\tt gridInqYbounds} returns the bounds of the Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    INTEGER FUNCTION gridInqYbounds(INTEGER gridID, REAL*8 ybounds)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt ybounds\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt ybounds}]
Pointer to the location into which the Y-bounds are read.
                    The caller must allocate space for the returned values.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

Upon successful completion {\tt gridInqYbounds} returns the number of bounds and
the bounds are stored in {\tt ybounds}.
Otherwise, 0 is returned and {\tt ybounds} is empty.



\subsection{Define the name of a X-axis: {\tt gridDefXname}}
\index{gridDefXname}
\label{gridDefXname}

The function {\tt gridDefXname} defines the name of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefXname(INTEGER gridID, CHARACTER*(*) name)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt name}]
Name of the X-axis.

\end{deflist}
\end{minipage}


\subsection{Get the name of a X-axis: {\tt gridInqXname}}
\index{gridInqXname}
\label{gridInqXname}

The function {\tt gridInqXname} returns the name of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqXname(INTEGER gridID, CHARACTER*(*) name)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt name}]
Name of the X-axis. The caller must allocate space for the 
                    returned string. The maximum possible length, in characters, of
                    the string is given by the predefined constant CDI\_MAX\_NAME.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqXname} returns the name of the X-axis to the parameter name.



\subsection{Define the longname of a X-axis: {\tt gridDefXlongname}}
\index{gridDefXlongname}
\label{gridDefXlongname}

The function {\tt gridDefXlongname} defines the longname of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefXlongname(INTEGER gridID, CHARACTER*(*) longname)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt longname\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt longname}]
Longname of the X-axis.

\end{deflist}
\end{minipage}


\subsection{Get the longname of a X-axis: {\tt gridInqXlongname}}
\index{gridInqXlongname}
\label{gridInqXlongname}

The function {\tt gridInqXlongname} returns the longname of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqXlongname(INTEGER gridID, CHARACTER*(*) longname)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt longname\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt longname}]
Longname of the X-axis. The caller must allocate space for the 
                    returned string. The maximum possible length, in characters, of
                    the string is given by the predefined constant CDI\_MAX\_NAME.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqXlongname} returns the longname of the X-axis to the parameter longname.



\subsection{Define the units of a X-axis: {\tt gridDefXunits}}
\index{gridDefXunits}
\label{gridDefXunits}

The function {\tt gridDefXunits} defines the units of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefXunits(INTEGER gridID, CHARACTER*(*) units)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt units}]
Units of the X-axis.

\end{deflist}
\end{minipage}


\subsection{Get the units of a X-axis: {\tt gridInqXunits}}
\index{gridInqXunits}
\label{gridInqXunits}

The function {\tt gridInqXunits} returns the units of a X-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqXunits(INTEGER gridID, CHARACTER*(*) units)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt units}]
Units of the X-axis. The caller must allocate space for the 
                    returned string. The maximum possible length, in characters, of
                    the string is given by the predefined constant CDI\_MAX\_NAME.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqXunits} returns the units of the X-axis to the parameter units.



\subsection{Define the name of a Y-axis: {\tt gridDefYname}}
\index{gridDefYname}
\label{gridDefYname}

The function {\tt gridDefYname} defines the name of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefYname(INTEGER gridID, CHARACTER*(*) name)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt name}]
Name of the Y-axis.

\end{deflist}
\end{minipage}


\subsection{Get the name of a Y-axis: {\tt gridInqYname}}
\index{gridInqYname}
\label{gridInqYname}

The function {\tt gridInqYname} returns the name of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqYname(INTEGER gridID, CHARACTER*(*) name)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt name}]
Name of the Y-axis. The caller must allocate space for the 
                    returned string. The maximum possible length, in characters, of
                    the string is given by the predefined constant CDI\_MAX\_NAME.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqYname} returns the name of the Y-axis to the parameter name.



\subsection{Define the longname of a Y-axis: {\tt gridDefYlongname}}
\index{gridDefYlongname}
\label{gridDefYlongname}

The function {\tt gridDefYlongname} defines the longname of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefYlongname(INTEGER gridID, CHARACTER*(*) longname)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt longname\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt longname}]
Longname of the Y-axis.

\end{deflist}
\end{minipage}


\subsection{Get the longname of a Y-axis: {\tt gridInqYlongname}}
\index{gridInqYlongname}
\label{gridInqYlongname}

The function {\tt gridInqYlongname} returns the longname of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqXlongname(INTEGER gridID, CHARACTER*(*) longname)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt longname\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt longname}]
Longname of the Y-axis. The caller must allocate space for the 
                    returned string. The maximum possible length, in characters, of
                    the string is given by the predefined constant CDI\_MAX\_NAME.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqYlongname} returns the longname of the Y-axis to the parameter longname.



\subsection{Define the units of a Y-axis: {\tt gridDefYunits}}
\index{gridDefYunits}
\label{gridDefYunits}

The function {\tt gridDefYunits} defines the units of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridDefYunits(INTEGER gridID, CHARACTER*(*) units)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt units}]
Units of the Y-axis.

\end{deflist}
\end{minipage}


\subsection{Get the units of a Y-axis: {\tt gridInqYunits}}
\index{gridInqYunits}
\label{gridInqYunits}

The function {\tt gridInqYunits} returns the units of a Y-axis.

\subsubsection*{Usage}

\begin{verbatim}
    SUBROUTINE gridInqYunits(INTEGER gridID, CHARACTER*(*) units)
\end{verbatim}

\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt gridID\ }
\item[{\tt gridID}]
Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}}.
\item[{\tt units}]
Units of the Y-axis. The caller must allocate space for the 
                    returned string. The maximum possible length, in characters, of
                    the string is given by the predefined constant CDI\_MAX\_NAME.

\end{deflist}
\end{minipage}

\subsubsection*{Result}

{\tt gridInqYunits} returns the units of the Y-axis to the parameter units.

