\subsection{Create a horizontal Grid: {\tt gridCreate}} \index{gridCreate} \label{gridCreate} The function {\tt gridCreate} creates a horizontal Grid. \subsubsection*{Usage} \begin{verbatim} int gridCreate(int gridtype, int 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\_LAMBERT}, {\tt GRID\_SPECTRAL}, {\tt GRID\_GME}, {\tt GRID\_CURVILINEAR} and {\tt GRID\_CELL}. \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=C, backgroundcolor=\color{zebg}, basicstyle=\footnotesize] #include "cdi.h" ... #define NLON 12 #define NLAT 6 ... double lons[NLON] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; double lats[NLAT] = {-75, -45, -15, 15, 45, 75}; int gridID; ... gridID = gridCreate(GRID_LONLAT, NLON*NLAT); gridDefXsize(gridID, NLON); gridDefYsize(gridID, NLAT); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); ... \end{lstlisting} \subsection{Destroy a horizontal Grid: {\tt gridDestroy}} \index{gridDestroy} \label{gridDestroy} \subsubsection*{Usage} \begin{verbatim} void gridDestroy(int 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} int gridDuplicate(int 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} int gridInqType(int 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\_LAMBERT}, {\tt GRID\_SPECTRAL}, {\tt GRID\_GME}, {\tt GRID\_CURVILINEAR} and {\tt GRID\_CELL}. \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} int gridInqSize(int 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} void gridDefXsize(int gridID, int 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} void gridInqXsize(int 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} void gridDefYsize(int gridID, int 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} void gridInqYsize(int 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} void gridDefXvals(int gridID, double *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} int gridInqXvals(int gridID, double *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} \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} void gridDefYvals(int gridID, double *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} int gridInqYvals(int gridID, double *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} \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} void gridDefXbounds(int gridID, double *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} int gridInqXbounds(int gridID, double *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} \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} void gridDefYbounds(int gridID, double *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} int gridInqYbounds(int gridID, double *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} \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} void gridDefXname(int gridID, const char *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} void gridInqXname(int gridID, const char *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} \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} void gridDefXlongname(int gridID, const char *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} void gridInqXlongname(int gridID, const char *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} \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} void gridDefXunits(int gridID, const char *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} void gridInqXunits(int gridID, const char *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} \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} void gridDefYname(int gridID, const char *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} void gridInqYname(int gridID, const char *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} \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} void gridDefYlongname(int gridID, const char *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} void gridInqXlongname(int gridID, const char *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} \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} void gridDefYunits(int gridID, const char *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} void gridInqYunits(int gridID, const char *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} \subsubsection*{Result} {\tt gridInqYunits} returns the units of the Y-axis to the parameter units. \subsection{Define the parameter of a Lambert grid: {\tt gridDefLambert}} \index{gridDefLambert} \label{gridDefLambert} The function {\tt gridDefLambert} defines the parameter of a Lambert grid. \subsubsection*{Usage} \begin{verbatim} void gridDefLambert(int gridID, double originLon, double originLat, double lonParY, double lat1, double lat2, double xinc, double yinc); \end{verbatim} \hspace*{4mm}\begin{minipage}[]{15cm} \begin{deflist}{\tt originLon\ } \item[{\tt gridID}] Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}} \item[{\tt originLon}] Longitude of the first grid point \item[{\tt originLat}] Latitude of the first grid point \item[{\tt lonParY}] The East longitude of the meridian which is parallel to the Y-axis \item[{\tt lat1}] First latitude from the pole at which the secant cone cuts the sphere \item[{\tt lat2}] Second latitude at which the secant cone cuts the sphere \item[{\tt xinc}] X-direction grid lenght in meter \item[{\tt yinc}] Y-direction grid lenght in meter \end{deflist} \end{minipage} \subsection{Get the parameter of a Lambert grid: {\tt gridInqLambert}} \index{gridInqLambert} \label{gridInqLambert} The function {\tt gridInqLambert} returns the parameter of a Lambert grid. \subsubsection*{Usage} \begin{verbatim} void gridInqLambert(int gridID, double *originLon, double *originLat, double *lonParY, double *lat1, double *lat2, double *xinc, double *yinc); \end{verbatim} \hspace*{4mm}\begin{minipage}[]{15cm} \begin{deflist}{\tt originLon\ } \item[{\tt gridID}] Grid ID, from a previous call to {\htmlref{\tt gridCreate}{gridCreate}} \item[{\tt originLon}] Longitude of the first grid point \item[{\tt originLat}] Latitude of the first grid point \item[{\tt lonParY}] The East longitude of the meridian which is parallel to the Y-axis \item[{\tt lat1}] First latitude from the pole at which the secant cone cuts the sphere \item[{\tt lat2}] Second latitude at which the secant cone cuts the sphere \item[{\tt xinc}] X-direction grid lenght in meter \item[{\tt yinc}] Y-direction grid lenght in meter \end{deflist} \end{minipage}