\hypertarget{mapio_8h}{\section{mapio.\-h File Reference}
\label{mapio_8h}\index{mapio.\-h@{mapio.\-h}}
}
{\ttfamily \#include $<$stdio.\-h$>$}\\*
{\ttfamily \#include $<$stdlib.\-h$>$}\\*
{\ttfamily \#include $<$string.\-h$>$}\\*
{\ttfamily \#include $<$math.\-h$>$}\\*
{\ttfamily \#include $<$netcdf.\-h$>$}\\*
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structmapdata}{mapdata}
\begin{DoxyCompactList}\small\item\em Stores a submap of the netcdf G\-R\-D data. \end{DoxyCompactList}\item 
struct \hyperlink{structmapsrc}{mapsrc}
\begin{DoxyCompactList}\small\item\em Stores info needed for accessing G\-M\-T G\-R\-D file. \end{DoxyCompactList}\item 
struct \hyperlink{structmapbounds}{mapbounds}
\begin{DoxyCompactList}\small\item\em Stores info about the boundaries of a G\-M\-T G\-R\-D file. This information can be used to determine if a location is within the bounds of an existing Net\-C\-D\-F G\-R\-D file. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{mapio_8h_a8abfcc76130f3f991d124dd22d7e69bc}{N\-A\-N}~0
\item 
\#define \hyperlink{mapio_8h_aecbef6844384ce60959d3212d343d676}{M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G}~0
\begin{DoxyCompactList}\small\item\em If not equal to zero then debug output will be printed. \end{DoxyCompactList}\item 
\#define \hyperlink{mapio_8h_a1b5326512c2612412df165c4994e3759}{M\-A\-P\-I\-O\-\_\-\-O\-K}~1
\item 
\#define \hyperlink{mapio_8h_a0cc915e3d6ea5c7df77b66c20e7c1244}{M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R}~2
\item 
\#define \hyperlink{mapio_8h_a6087b078885c85e56612d327333720f8}{M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y}~4
\item 
\#define \hyperlink{mapio_8h_a3af6e49892149f63946b1245e5185892}{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}~0
\item 
\#define \hyperlink{mapio_8h_a26243b9bfc53aea952fe1907582fc505}{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}~1
\item 
\#define \hyperlink{mapio_8h_aca337a40bae730eea3530c8ad2c10be3}{M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}~2
\item 
\#define \hyperlink{mapio_8h_a7ab228dc509ad7cdfcc3c3f24e9f4045}{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}~0
\item 
\#define \hyperlink{mapio_8h_a4aa55f0db75a453c9217496c85377051}{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}~1
\item 
\#define \hyperlink{mapio_8h_a5ab35027f6840905886bf03cc9d5c11d}{M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}~2
\item 
\#define \hyperlink{mapio_8h_a3238f11b36450be45cb63d9e5806b079}{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K}~0
\item 
\#define \hyperlink{mapio_8h_af8a7901237d7b93e6a58a2506bf21553}{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S}~1
\item 
\#define \hyperlink{mapio_8h_a71af05f02360d98f822e6234167b3b0a}{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E}~2
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{mapio_8h_a2ba6e0bfae542ff5a326135c3cb9b40d}{check\-\_\-error} (int status, struct \hyperlink{structmapsrc}{mapsrc} $\ast$src)
\item 
void \hyperlink{mapio_8h_a301c88c9019432d421e18fe081ae5183}{mapsrc\-\_\-fill} (const char $\ast$file, struct \hyperlink{structmapsrc}{mapsrc} $\ast$src)
\begin{DoxyCompactList}\small\item\em Opens a G\-M\-T G\-R\-D file and read coordinate variables. \end{DoxyCompactList}\item 
void \hyperlink{mapio_8h_aabf8bef5fedae2f75ac4c304bcffbe5e}{mapsrc\-\_\-free} (struct \hyperlink{structmapsrc}{mapsrc} $\ast$src)
\begin{DoxyCompactList}\small\item\em Frees the memory used by a mapsrc structure. \end{DoxyCompactList}\item 
float \hyperlink{mapio_8h_a8230a09f645b102b4fd5f260fb1bad30}{mapsrc\-\_\-find} (struct \hyperlink{structmapsrc}{mapsrc} $\ast$src, double x, double y)
\begin{DoxyCompactList}\small\item\em Find a z value at a given point. \end{DoxyCompactList}\item 
struct \hyperlink{structmapsrc}{mapsrc} $\ast$ \hyperlink{mapio_8h_aa6428330fa7a571d20e7234d4d2aba75}{mapsrc\-\_\-init} (void)
\begin{DoxyCompactList}\small\item\em Initializes a mapsrc structure. \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{mapio_8h_abbc2f0cd2f191e800a3b3e78eb634756}{mapsrc\-\_\-tostring} (struct \hyperlink{structmapsrc}{mapsrc} $\ast$src)
\begin{DoxyCompactList}\small\item\em create a string of a mapsrc structure \end{DoxyCompactList}\item 
int \hyperlink{mapio_8h_a5fb205f56749e1213b1869d455b2c1a3}{mapdata\-\_\-fill} (struct \hyperlink{structmapsrc}{mapsrc} $\ast$src, struct \hyperlink{structmapdata}{mapdata} $\ast$data, double x, double y, double xwidth, double ywidth)
\begin{DoxyCompactList}\small\item\em Read a submap from a netcdf U\-T\-M G\-R\-D file into a mapdata structure. \end{DoxyCompactList}\item 
void \hyperlink{mapio_8h_aac471113c7492adaefeb0a897be51f1c}{mapdata\-\_\-free} (struct \hyperlink{structmapdata}{mapdata} $\ast$data, int free\-\_\-all)
\begin{DoxyCompactList}\small\item\em Free's the memory held by a mapdata structure. \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{mapio_8h_a270da9d3b5dcf304b1de7cb39d3a4650}{mapdata\-\_\-tostring} (struct \hyperlink{structmapdata}{mapdata} $\ast$data)
\begin{DoxyCompactList}\small\item\em create a string of a mapdata structure \end{DoxyCompactList}\item 
int \hyperlink{mapio_8h_aaacac2d74bfa7f23515981dc04287568}{nearest} (double key, const double $\ast$base, size\-\_\-t nmemb)
\begin{DoxyCompactList}\small\item\em Find the index of the nearest value. \end{DoxyCompactList}\item 
void \hyperlink{mapio_8h_a26cf79535a8835227a485d46a6f90997}{z\-\_\-print} (const float $\ast$z, int rows, int columns)
\item 
float \hyperlink{mapio_8h_ae358ba32806aaa555b155167813395a4}{get\-Z} (const float $\ast$z, int row, int column, int columns)
\item 
int \hyperlink{mapio_8h_a538cbe2c92bc89a4b7c75a83ac6b9cf2}{mapdata\-\_\-check} (struct \hyperlink{structmapdata}{mapdata} $\ast$data, struct \hyperlink{structmapsrc}{mapsrc} $\ast$src, double xcenter, double ycenter, double xwidth, double ywidth)
\begin{DoxyCompactList}\small\item\em Returns a code indicating the status of the mapdata. \end{DoxyCompactList}\item 
struct \hyperlink{structmapbounds}{mapbounds} $\ast$ \hyperlink{mapio_8h_a39854617464b3eb7e9ea1c88e93836d1}{mapbounds\-\_\-init} ()
\begin{DoxyCompactList}\small\item\em Create a mapbounds struct. \end{DoxyCompactList}\item 
int \hyperlink{mapio_8h_a007467e932d429d0dc03a92cc80123ca}{mapbounds\-\_\-fill1} (struct \hyperlink{structmapsrc}{mapsrc} $\ast$src, struct \hyperlink{structmapbounds}{mapbounds} $\ast$bounds)
\begin{DoxyCompactList}\small\item\em Fills a mapbounds structure from a mapsrc object. \end{DoxyCompactList}\item 
int \hyperlink{mapio_8h_af4e3c627db170771853e304f4f378f13}{mapbounds\-\_\-fill2} (const char $\ast$file, struct \hyperlink{structmapbounds}{mapbounds} $\ast$bounds)
\begin{DoxyCompactList}\small\item\em Fill in a mapbounds structure from a netcdf file. \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{mapio_8h_a40195a00749cd51a23b292ad6042e14f}{mapbounds\-\_\-tostring} (struct \hyperlink{structmapbounds}{mapbounds} $\ast$bounds)
\begin{DoxyCompactList}\small\item\em Return a string representation of a mapbounds struct. \end{DoxyCompactList}\item 
int \hyperlink{mapio_8h_a15ed12b63525a5e9b80e8483d8be9e6d}{mapbounds\-\_\-contains} (struct \hyperlink{structmapbounds}{mapbounds} $\ast$bounds, const double x, const double y)
\item 
int \hyperlink{mapio_8h_a87c593c5982d14693c3d23d4d97824a1}{mapdata\-\_\-checksize} (struct \hyperlink{structmapbounds}{mapbounds} $\ast$bounds, struct \hyperlink{structmapdata}{mapdata} $\ast$data, const double xwidth, const double ywidth)
\end{DoxyCompactItemize}


\subsection{Macro Definition Documentation}
\hypertarget{mapio_8h_a71af05f02360d98f822e6234167b3b0a}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E@{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E}}
\index{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E@{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E~2}}\label{mapio_8h_a71af05f02360d98f822e6234167b3b0a}
\hypertarget{mapio_8h_a3238f11b36450be45cb63d9e5806b079}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K@{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K}}
\index{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K@{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K~0}}\label{mapio_8h_a3238f11b36450be45cb63d9e5806b079}
\hypertarget{mapio_8h_af8a7901237d7b93e6a58a2506bf21553}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S@{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S}}
\index{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S@{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S~1}}\label{mapio_8h_af8a7901237d7b93e6a58a2506bf21553}
\hypertarget{mapio_8h_a5ab35027f6840905886bf03cc9d5c11d}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E@{M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}}
\index{M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E@{M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-D\-A\-T\-A\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E~2}}\label{mapio_8h_a5ab35027f6840905886bf03cc9d5c11d}
\hypertarget{mapio_8h_a7ab228dc509ad7cdfcc3c3f24e9f4045}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y@{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}}
\index{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y@{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y~0}}\label{mapio_8h_a7ab228dc509ad7cdfcc3c3f24e9f4045}
\hypertarget{mapio_8h_a4aa55f0db75a453c9217496c85377051}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D@{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}}
\index{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D@{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-D\-A\-T\-A\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D~1}}\label{mapio_8h_a4aa55f0db75a453c9217496c85377051}
\hypertarget{mapio_8h_aecbef6844384ce60959d3212d343d676}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G@{M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G}}
\index{M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G@{M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-I\-O\-\_\-\-D\-E\-B\-U\-G~0}}\label{mapio_8h_aecbef6844384ce60959d3212d343d676}


If not equal to zero then debug output will be printed. 

\begin{DoxyAuthor}{Author}
Copyright 2007 M\-B\-A\-R\-I. All rights reserved. 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
2007-\/09-\/11
\end{DoxyDate}
M\-A\-P\-I\-O is currently written to read a net\-C\-D\-F file ({\itshape G\-M\-T} version 2 G\-R\-D file) in U\-T\-M coordinates. (Generated with the -\/\-G3 flag in M\-B\-Ssystem).

Here's an example C\-D\-L for the G\-M\-T version 2 netcdf grids we'll be working with\-:


\begin{DoxyPre}
 netcdf canyonDataUTMG3 \{
 dimensions:
 x = 1022 ;
 y = 879 ;
 variables:
 double x(x) ;
 x:long\_name = "Easting (meters)" ;
 x:actual\_range = 597413.876506377, 598435.621004263 ;
 double y(y) ;
 y:long\_name = "Northing (meters)" ;
 y:actual\_range = 4071749.4760972, 4072627.48862688 ;
 float z(y, x) ;
 z:long\_name = "Depth (m)" ;
 z:\_FillValue = nanf ;
 z:actual\_range = 374.4248f, 536.1101f ;\end{DoxyPre}



\begin{DoxyPre}global attributes:
 :Conventions = "COARDS" ;
 :title = "Bathymetry Grid" ;
 :description = "\(\backslash\)n",
 "\(\backslash\)tProjection: UTM10N\(\backslash\)n",
 "\(\backslash\)tGrid created by mbgrid\(\backslash\)n",
 "\(\backslash\)tMB-system Version 5.1.0\(\backslash\)n",
 "\(\backslash\)tRun by <root> on <JacksonHole.stanford.edu> at <Thu Aug 30 00:44:23 2007>" ;
 :node\_offset = 0 ;
 \}
 \end{DoxyPre}


For this code, the projection is assumed to be U\-T\-M. We are ignoring the zone; you'll have to be smart enough to make sure all coordinates are within the same zone as the G\-R\-D file you are using. \hypertarget{mapio_8h_a1b5326512c2612412df165c4994e3759}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-I\-O\-\_\-\-O\-K@{M\-A\-P\-I\-O\-\_\-\-O\-K}}
\index{M\-A\-P\-I\-O\-\_\-\-O\-K@{M\-A\-P\-I\-O\-\_\-\-O\-K}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-I\-O\-\_\-\-O\-K}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-I\-O\-\_\-\-O\-K~1}}\label{mapio_8h_a1b5326512c2612412df165c4994e3759}
\hypertarget{mapio_8h_a6087b078885c85e56612d327333720f8}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y@{M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y}}
\index{M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y@{M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-I\-O\-\_\-\-O\-U\-T\-O\-F\-M\-E\-M\-O\-R\-Y~4}}\label{mapio_8h_a6087b078885c85e56612d327333720f8}
\hypertarget{mapio_8h_a0cc915e3d6ea5c7df77b66c20e7c1244}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R@{M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R}}
\index{M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R@{M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-I\-O\-\_\-\-R\-E\-A\-D\-E\-R\-R\-O\-R~2}}\label{mapio_8h_a0cc915e3d6ea5c7df77b66c20e7c1244}
\hypertarget{mapio_8h_aca337a40bae730eea3530c8ad2c10be3}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E@{M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}}
\index{M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E@{M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-S\-R\-C\-\_\-\-F\-I\-L\-L\-\_\-\-F\-A\-I\-L\-U\-R\-E~2}}\label{mapio_8h_aca337a40bae730eea3530c8ad2c10be3}
\hypertarget{mapio_8h_a3af6e49892149f63946b1245e5185892}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y@{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}}
\index{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y@{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-E\-M\-P\-T\-Y~0}}\label{mapio_8h_a3af6e49892149f63946b1245e5185892}
\hypertarget{mapio_8h_a26243b9bfc53aea952fe1907582fc505}{\index{mapio.\-h@{mapio.\-h}!M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D@{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}}
\index{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D@{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}!mapio.h@{mapio.\-h}}
\subsubsection[{M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\-A\-P\-S\-R\-C\-\_\-\-I\-S\-\_\-\-F\-I\-L\-L\-E\-D~1}}\label{mapio_8h_a26243b9bfc53aea952fe1907582fc505}
\hypertarget{mapio_8h_a8abfcc76130f3f991d124dd22d7e69bc}{\index{mapio.\-h@{mapio.\-h}!N\-A\-N@{N\-A\-N}}
\index{N\-A\-N@{N\-A\-N}!mapio.h@{mapio.\-h}}
\subsubsection[{N\-A\-N}]{\setlength{\rightskip}{0pt plus 5cm}\#define N\-A\-N~0}}\label{mapio_8h_a8abfcc76130f3f991d124dd22d7e69bc}


\subsection{Function Documentation}
\hypertarget{mapio_8h_a2ba6e0bfae542ff5a326135c3cb9b40d}{\index{mapio.\-h@{mapio.\-h}!check\-\_\-error@{check\-\_\-error}}
\index{check\-\_\-error@{check\-\_\-error}!mapio.h@{mapio.\-h}}
\subsubsection[{check\-\_\-error}]{\setlength{\rightskip}{0pt plus 5cm}int check\-\_\-error (
\begin{DoxyParamCaption}
\item[{int}]{status, }
\item[{struct {\bf mapsrc} $\ast$}]{src}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a2ba6e0bfae542ff5a326135c3cb9b40d}
\hypertarget{mapio_8h_ae358ba32806aaa555b155167813395a4}{\index{mapio.\-h@{mapio.\-h}!get\-Z@{get\-Z}}
\index{get\-Z@{get\-Z}!mapio.h@{mapio.\-h}}
\subsubsection[{get\-Z}]{\setlength{\rightskip}{0pt plus 5cm}float get\-Z (
\begin{DoxyParamCaption}
\item[{const float $\ast$}]{z, }
\item[{int}]{row, }
\item[{int}]{column, }
\item[{int}]{columns}
\end{DoxyParamCaption}
)}}\label{mapio_8h_ae358ba32806aaa555b155167813395a4}
\hypertarget{mapio_8h_a15ed12b63525a5e9b80e8483d8be9e6d}{\index{mapio.\-h@{mapio.\-h}!mapbounds\-\_\-contains@{mapbounds\-\_\-contains}}
\index{mapbounds\-\_\-contains@{mapbounds\-\_\-contains}!mapio.h@{mapio.\-h}}
\subsubsection[{mapbounds\-\_\-contains}]{\setlength{\rightskip}{0pt plus 5cm}int mapbounds\-\_\-contains (
\begin{DoxyParamCaption}
\item[{struct {\bf mapbounds} $\ast$}]{bounds, }
\item[{const double}]{x, }
\item[{const double}]{y}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a15ed12b63525a5e9b80e8483d8be9e6d}
\hypertarget{mapio_8h_a007467e932d429d0dc03a92cc80123ca}{\index{mapio.\-h@{mapio.\-h}!mapbounds\-\_\-fill1@{mapbounds\-\_\-fill1}}
\index{mapbounds\-\_\-fill1@{mapbounds\-\_\-fill1}!mapio.h@{mapio.\-h}}
\subsubsection[{mapbounds\-\_\-fill1}]{\setlength{\rightskip}{0pt plus 5cm}int mapbounds\-\_\-fill1 (
\begin{DoxyParamCaption}
\item[{struct {\bf mapsrc} $\ast$}]{src, }
\item[{struct {\bf mapbounds} $\ast$}]{bounds}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a007467e932d429d0dc03a92cc80123ca}


Fills a mapbounds structure from a mapsrc object. 

function\-: mapbounds\-\_\-fill1

Fills in a mapbounds structure based on info in the src stucture 
\begin{DoxyParams}{Parameters}
{\em src} & The mapsrc data structure \\
\hline
{\em bounds} & The mapbounds data structure to populate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
T\-O\-D\-O...return a meaninful error code 
\end{DoxyReturn}
\hypertarget{mapio_8h_af4e3c627db170771853e304f4f378f13}{\index{mapio.\-h@{mapio.\-h}!mapbounds\-\_\-fill2@{mapbounds\-\_\-fill2}}
\index{mapbounds\-\_\-fill2@{mapbounds\-\_\-fill2}!mapio.h@{mapio.\-h}}
\subsubsection[{mapbounds\-\_\-fill2}]{\setlength{\rightskip}{0pt plus 5cm}int mapbounds\-\_\-fill2 (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{file, }
\item[{struct {\bf mapbounds} $\ast$}]{bounds}
\end{DoxyParamCaption}
)}}\label{mapio_8h_af4e3c627db170771853e304f4f378f13}


Fill in a mapbounds structure from a netcdf file. 

function\-: mapbounds\-\_\-fill2

Fills in a maounds structure based on data in the netcdf file \hypertarget{mapio_8h_a39854617464b3eb7e9ea1c88e93836d1}{\index{mapio.\-h@{mapio.\-h}!mapbounds\-\_\-init@{mapbounds\-\_\-init}}
\index{mapbounds\-\_\-init@{mapbounds\-\_\-init}!mapio.h@{mapio.\-h}}
\subsubsection[{mapbounds\-\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mapbounds}$\ast$ mapbounds\-\_\-init (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a39854617464b3eb7e9ea1c88e93836d1}


Create a mapbounds struct. 

function\-: mapbounds\-\_\-init

Allocates memory for a mapbounds struct as sets all values to 0. The structure's memory will need to be freed when done with the structure. \begin{DoxyReturn}{Returns}
A mapbounds structure 
\end{DoxyReturn}
\hypertarget{mapio_8h_a40195a00749cd51a23b292ad6042e14f}{\index{mapio.\-h@{mapio.\-h}!mapbounds\-\_\-tostring@{mapbounds\-\_\-tostring}}
\index{mapbounds\-\_\-tostring@{mapbounds\-\_\-tostring}!mapio.h@{mapio.\-h}}
\subsubsection[{mapbounds\-\_\-tostring}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mapbounds\-\_\-tostring (
\begin{DoxyParamCaption}
\item[{struct {\bf mapbounds} $\ast$}]{bounds}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a40195a00749cd51a23b292ad6042e14f}


Return a string representation of a mapbounds struct. 

function\-: mapbounds\-\_\-tostring

String rep of a mapbounds struct 
\begin{DoxyParams}{Parameters}
{\em bounds} & A mapbounds struct \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A char$\ast$. Don't forget to free it when you're done with it 
\end{DoxyReturn}
\hypertarget{mapio_8h_a538cbe2c92bc89a4b7c75a83ac6b9cf2}{\index{mapio.\-h@{mapio.\-h}!mapdata\-\_\-check@{mapdata\-\_\-check}}
\index{mapdata\-\_\-check@{mapdata\-\_\-check}!mapio.h@{mapio.\-h}}
\subsubsection[{mapdata\-\_\-check}]{\setlength{\rightskip}{0pt plus 5cm}int mapdata\-\_\-check (
\begin{DoxyParamCaption}
\item[{struct {\bf mapdata} $\ast$}]{data, }
\item[{struct {\bf mapsrc} $\ast$}]{src, }
\item[{double}]{xcenter, }
\item[{double}]{ycenter, }
\item[{double}]{xwidth, }
\item[{double}]{ywidth}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a538cbe2c92bc89a4b7c75a83ac6b9cf2}


Returns a code indicating the status of the mapdata. 

function\-: mapdata\-\_\-check

T\-O\-D\-O 
\begin{DoxyParams}{Parameters}
{\em data} & T\-He mapdata structure \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An integer indicating the status of the data structure 
\end{DoxyReturn}
\hypertarget{mapio_8h_a87c593c5982d14693c3d23d4d97824a1}{\index{mapio.\-h@{mapio.\-h}!mapdata\-\_\-checksize@{mapdata\-\_\-checksize}}
\index{mapdata\-\_\-checksize@{mapdata\-\_\-checksize}!mapio.h@{mapio.\-h}}
\subsubsection[{mapdata\-\_\-checksize}]{\setlength{\rightskip}{0pt plus 5cm}int mapdata\-\_\-checksize (
\begin{DoxyParamCaption}
\item[{struct {\bf mapbounds} $\ast$}]{bounds, }
\item[{struct {\bf mapdata} $\ast$}]{data, }
\item[{const double}]{xwidth, }
\item[{const double}]{ywidth}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a87c593c5982d14693c3d23d4d97824a1}
\hypertarget{mapio_8h_a5fb205f56749e1213b1869d455b2c1a3}{\index{mapio.\-h@{mapio.\-h}!mapdata\-\_\-fill@{mapdata\-\_\-fill}}
\index{mapdata\-\_\-fill@{mapdata\-\_\-fill}!mapio.h@{mapio.\-h}}
\subsubsection[{mapdata\-\_\-fill}]{\setlength{\rightskip}{0pt plus 5cm}int mapdata\-\_\-fill (
\begin{DoxyParamCaption}
\item[{struct {\bf mapsrc} $\ast$}]{src, }
\item[{struct {\bf mapdata} $\ast$}]{data, }
\item[{double}]{x, }
\item[{double}]{y, }
\item[{double}]{xwidth, }
\item[{double}]{ywidth}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a5fb205f56749e1213b1869d455b2c1a3}


Read a submap from a netcdf U\-T\-M G\-R\-D file into a mapdata structure. 

function\-: mapdata\-\_\-fill

Reads in a rectangular block of bathymetry data from a file (defined by src). The size of the rectangle is based on the params but will N\-O\-T be exaclty as specified by xwidth and ywidth. 
\begin{DoxyParams}{Parameters}
{\em src} & The mapsrc structure definining where we are reading data from \\
\hline
{\em data} & A mapdata structure for storing the submap \\
\hline
{\em x} & The easting position of the vehicle. In the same U\-T\-M coordinate system as the src map. \\
\hline
{\em y} & The northing position of the vehicle. In the same U\-T\-M coordinate system as the src map. \\
\hline
{\em xwidth} & The width of the submap in meters to retrive. \\
\hline
{\em ywidth} & The width of the submap in meters to retrieve \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An integer code of M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-K if all is O\-K, M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-O\-U\-T\-\_\-\-O\-F\-\_\-\-B\-O\-U\-N\-D\-S if the x or y coordinate is outside the boundaries fo the map reference by src, or M\-A\-P\-B\-O\-U\-N\-D\-S\-\_\-\-N\-E\-A\-R\-\_\-\-E\-D\-G\-E if you x,y position is near the edge (resulting in a truncated submap) 
\end{DoxyReturn}
\hypertarget{mapio_8h_aac471113c7492adaefeb0a897be51f1c}{\index{mapio.\-h@{mapio.\-h}!mapdata\-\_\-free@{mapdata\-\_\-free}}
\index{mapdata\-\_\-free@{mapdata\-\_\-free}!mapio.h@{mapio.\-h}}
\subsubsection[{mapdata\-\_\-free}]{\setlength{\rightskip}{0pt plus 5cm}void mapdata\-\_\-free (
\begin{DoxyParamCaption}
\item[{struct {\bf mapdata} $\ast$}]{data, }
\item[{int}]{free\-\_\-all}
\end{DoxyParamCaption}
)}}\label{mapio_8h_aac471113c7492adaefeb0a897be51f1c}


Free's the memory held by a mapdata structure. 

function\-: mapdata\-\_\-free 
\begin{DoxyParams}{Parameters}
{\em data} & The mapdata structure who's memory we want to free \\
\hline
{\em free\-\_\-all} & If equal to 0 then the structure itself will not be freed, only the internal pointers. All structure values will be set to 0. if not equal to 1 then the data structure's memory will be release. \\
\hline
\end{DoxyParams}
\hypertarget{mapio_8h_a270da9d3b5dcf304b1de7cb39d3a4650}{\index{mapio.\-h@{mapio.\-h}!mapdata\-\_\-tostring@{mapdata\-\_\-tostring}}
\index{mapdata\-\_\-tostring@{mapdata\-\_\-tostring}!mapio.h@{mapio.\-h}}
\subsubsection[{mapdata\-\_\-tostring}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mapdata\-\_\-tostring (
\begin{DoxyParamCaption}
\item[{struct {\bf mapdata} $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a270da9d3b5dcf304b1de7cb39d3a4650}


create a string of a mapdata structure 

function\-: mapdata\-\_\-tostring 
\begin{DoxyParams}{Parameters}
{\em data} & The mapdata structure \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A string. Don't forget to free it when you're done. 
\end{DoxyReturn}
\hypertarget{mapio_8h_a301c88c9019432d421e18fe081ae5183}{\index{mapio.\-h@{mapio.\-h}!mapsrc\-\_\-fill@{mapsrc\-\_\-fill}}
\index{mapsrc\-\_\-fill@{mapsrc\-\_\-fill}!mapio.h@{mapio.\-h}}
\subsubsection[{mapsrc\-\_\-fill}]{\setlength{\rightskip}{0pt plus 5cm}void mapsrc\-\_\-fill (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{file, }
\item[{struct {\bf mapsrc} $\ast$}]{src}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a301c88c9019432d421e18fe081ae5183}


Opens a G\-M\-T G\-R\-D file and read coordinate variables. 

function\-: mapsrc\-\_\-fill

Opens a G\-M\-T version 2 G\-R\-D file (netcdf). It stores the needed information, such as ids to the netcdf file, variables, and the data for the x and y coordinate variables. Note that 'struct mapsrc' contains references to arrays which must be released. If an error occurs on fill a flag will be set in the \hyperlink{structmapsrc_a4066046c632e3404b45abf37c068c1ff}{mapsrc.\-status} field. 
\begin{DoxyParams}{Parameters}
{\em file} & The path of the file to read. \\
\hline
{\em src} & The mapsrc structure for storing the information about the netcdf data file. \\
\hline
\end{DoxyParams}
\hypertarget{mapio_8h_a8230a09f645b102b4fd5f260fb1bad30}{\index{mapio.\-h@{mapio.\-h}!mapsrc\-\_\-find@{mapsrc\-\_\-find}}
\index{mapsrc\-\_\-find@{mapsrc\-\_\-find}!mapio.h@{mapio.\-h}}
\subsubsection[{mapsrc\-\_\-find}]{\setlength{\rightskip}{0pt plus 5cm}float mapsrc\-\_\-find (
\begin{DoxyParamCaption}
\item[{struct {\bf mapsrc} $\ast$}]{src, }
\item[{double}]{x, }
\item[{double}]{y}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a8230a09f645b102b4fd5f260fb1bad30}


Find a z value at a given point. 

function\-: mapsrc\-\_\-find

Find a z-\/value in a map at a given x, y location 
\begin{DoxyParams}{Parameters}
{\em src} & The mapsrc structure pointing to the map you want to read \\
\hline
{\em x} & The x coordinate in meters U\-T\-M (use same zone as net\-C\-D\-F file). \\
\hline
{\em y} & The y coordinate in meters U\-T\-M (use same zone as net\-C\-D\-F file). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The z value in meters of the point nearest to the x, y location N\-A\-N is returned if the x,y coordinate falls outside the boundaries of the map. 
\end{DoxyReturn}
\hypertarget{mapio_8h_aabf8bef5fedae2f75ac4c304bcffbe5e}{\index{mapio.\-h@{mapio.\-h}!mapsrc\-\_\-free@{mapsrc\-\_\-free}}
\index{mapsrc\-\_\-free@{mapsrc\-\_\-free}!mapio.h@{mapio.\-h}}
\subsubsection[{mapsrc\-\_\-free}]{\setlength{\rightskip}{0pt plus 5cm}void mapsrc\-\_\-free (
\begin{DoxyParamCaption}
\item[{struct {\bf mapsrc} $\ast$}]{src}
\end{DoxyParamCaption}
)}}\label{mapio_8h_aabf8bef5fedae2f75ac4c304bcffbe5e}


Frees the memory used by a mapsrc structure. 

function\-: mapsrc\-\_\-free

A mapsrc structure references to arrays. This function will free those arrays as well as the parent structure. 
\begin{DoxyParams}{Parameters}
{\em src} & Is the mapsrc structure to be freed \\
\hline
\end{DoxyParams}
\hypertarget{mapio_8h_aa6428330fa7a571d20e7234d4d2aba75}{\index{mapio.\-h@{mapio.\-h}!mapsrc\-\_\-init@{mapsrc\-\_\-init}}
\index{mapsrc\-\_\-init@{mapsrc\-\_\-init}!mapio.h@{mapio.\-h}}
\subsubsection[{mapsrc\-\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf mapsrc}$\ast$ mapsrc\-\_\-init (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}\label{mapio_8h_aa6428330fa7a571d20e7234d4d2aba75}


Initializes a mapsrc structure. 

function\-: mapsrc\-\_\-init

Allocates memory for a mapsrc structure and sets the status flags. You will need to call 'mapsrc\-\_\-free' on the structure to release it's memory when you are finished with it. \begin{DoxyReturn}{Returns}
A mapsrc structure. 
\end{DoxyReturn}
\hypertarget{mapio_8h_abbc2f0cd2f191e800a3b3e78eb634756}{\index{mapio.\-h@{mapio.\-h}!mapsrc\-\_\-tostring@{mapsrc\-\_\-tostring}}
\index{mapsrc\-\_\-tostring@{mapsrc\-\_\-tostring}!mapio.h@{mapio.\-h}}
\subsubsection[{mapsrc\-\_\-tostring}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ mapsrc\-\_\-tostring (
\begin{DoxyParamCaption}
\item[{struct {\bf mapsrc} $\ast$}]{src}
\end{DoxyParamCaption}
)}}\label{mapio_8h_abbc2f0cd2f191e800a3b3e78eb634756}


create a string of a mapsrc structure 

function\-: mapsrc\-\_\-tostring 
\begin{DoxyParams}{Parameters}
{\em src} & The mapsrc structure \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A string. Don't forget to free it when you're done. 
\end{DoxyReturn}
\hypertarget{mapio_8h_aaacac2d74bfa7f23515981dc04287568}{\index{mapio.\-h@{mapio.\-h}!nearest@{nearest}}
\index{nearest@{nearest}!mapio.h@{mapio.\-h}}
\subsubsection[{nearest}]{\setlength{\rightskip}{0pt plus 5cm}int nearest (
\begin{DoxyParamCaption}
\item[{double}]{key, }
\item[{const double $\ast$}]{base, }
\item[{size\-\_\-t}]{nmemb}
\end{DoxyParamCaption}
)}}\label{mapio_8h_aaacac2d74bfa7f23515981dc04287568}


Find the index of the nearest value. 

function\-: nearest

Finds the index of the nearest value in a double array to a key value. this is a naive implementation but should get us going. 
\begin{DoxyParams}{Parameters}
{\em key} & The key value \\
\hline
{\em base} & The double array that you're searcng to find the nearest value in. This implementation of nearest assumes the arrays are sorted ascending. \\
\hline
{\em nmemb} & The number of elements in the base array \\
\hline
\end{DoxyParams}
\hypertarget{mapio_8h_a26cf79535a8835227a485d46a6f90997}{\index{mapio.\-h@{mapio.\-h}!z\-\_\-print@{z\-\_\-print}}
\index{z\-\_\-print@{z\-\_\-print}!mapio.h@{mapio.\-h}}
\subsubsection[{z\-\_\-print}]{\setlength{\rightskip}{0pt plus 5cm}void z\-\_\-print (
\begin{DoxyParamCaption}
\item[{const float $\ast$}]{z, }
\item[{int}]{rows, }
\item[{int}]{columns}
\end{DoxyParamCaption}
)}}\label{mapio_8h_a26cf79535a8835227a485d46a6f90997}
