<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>B.2.4 Native binary grid files</TITLE> <META NAME="description" CONTENT="B.2.4 Native binary grid files"> <META NAME="keywords" CONTENT="GMT_Docs"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="GMT_Docs.css"> <LINK REL="previous" HREF="node187.html"> <LINK REL="up" HREF="node182.html"> <LINK REL="next" HREF="node189.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html5395" HREF="node189.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html5389" HREF="node182.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html5385" HREF="node187.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html5391" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html5393" HREF="node258.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html5396" HREF="node189.html">B.3 Sun raster files</A> <B> Up:</B> <A NAME="tex2html5390" HREF="node182.html">B.2 Grid files</A> <B> Previous:</B> <A NAME="tex2html5386" HREF="node187.html">B.2.3 Boundary Conditions for</A> <B> <A NAME="tex2html5392" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html5394" HREF="node258.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION001924000000000000000"></A> <A NAME="29922"></A> <BR> B.2.4 Native binary grid files </H2> <P> The old style native grid file format that was common in earlier version of <A NAME="tex2html1750" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> is still supported, although the use of netCDF<A NAME="29923"></A> files is strongly recommended. The file starts with a header of 892 bytes containing a number of attributes defining the content. The <A NAME="tex2html1751" HREF="../man/grdedit.html"><I><B>grdedit</B></I></A><A NAME="30232"></A> utility program will allow you to edit parts of the header of an existing grid file. The attributes listed in Table <A HREF="#tbl:grdheader">B.2</A> are contained within the header record in the order given (except the <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-array which is not part of the header structure, but makes up the rest of the file). As this header was designed long before 64-bit architectures became available, the jump from the first three integers to the subsequent doubles in the structure does not occur on a 16-byte alignment. While <A NAME="tex2html1752" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> handles the reading of these structures correctly, enterprising programmers must take care to read this header correctly (see our code for details). <P> <BR><P></P> <DIV ALIGN="CENTER"><A NAME="30052"></A> <TABLE> <CAPTION><STRONG>Table:</STRONG> <A NAME="tex2html1747" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> grid file header record. <B>TYPE</B> can be <B>char</B>, <B>short</B>, <B>int</B>, <B>float</B>, or <B>double</B>.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1"> <TR><TD ALIGN="CENTER" COLSPAN=1><I>Parameter</I></TD> <TD ALIGN="CENTER" COLSPAN=1><I>Description</I></TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>nx</I></TH> <TD ALIGN="LEFT">Number of nodes in the <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img4.png" ALT="$x$">-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>ny</I></TH> <TD ALIGN="LEFT">Number of nodes in the y-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>int</B> <I>node_offset</I></TH> <TD ALIGN="LEFT">0 for grid line registration, 1 for pixel registration</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>x_min</I></TH> <TD ALIGN="LEFT">Minimum <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img4.png" ALT="$x$">-value of region</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>x_max</I></TH> <TD ALIGN="LEFT">Maximum <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img4.png" ALT="$x$">-value of region</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>y_min</I></TH> <TD ALIGN="LEFT">Minimum <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img32.png" ALT="$y$">-value of region</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>y_max</I></TH> <TD ALIGN="LEFT">Maximum <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img32.png" ALT="$y$">-value of region</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>z_min</I></TH> <TD ALIGN="LEFT">Minimum <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-value in data set</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>z_max</I></TH> <TD ALIGN="LEFT">Maximum <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-value in data set</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>x_inc</I></TH> <TD ALIGN="LEFT">Node spacing in <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img4.png" ALT="$x$">-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>y_inc</I></TH> <TD ALIGN="LEFT">Node spacing in <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img32.png" ALT="$y$">-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>z_scale_factor</I></TH> <TD ALIGN="LEFT">Factor to multiply <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-values after read</TD> </TR> <TR><TH ALIGN="LEFT"><B>double</B> <I>z_add_offset</I></TH> <TD ALIGN="LEFT">Offset to add to scaled <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-values</TD> </TR> <TR><TH ALIGN="LEFT"><B>char</B> <I>x_units</I>[80]</TH> <TD ALIGN="LEFT">Units of the <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img4.png" ALT="$x$">-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>char</B> <I>y_units</I>[80]</TH> <TD ALIGN="LEFT">Units of the <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img32.png" ALT="$y$">-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>char</B> <I>z_units</I>[80]</TH> <TD ALIGN="LEFT">Units of the <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-dimension</TD> </TR> <TR><TH ALIGN="LEFT"><B>char</B> <I>title</I>[80]</TH> <TD ALIGN="LEFT">Descriptive title of the data set</TD> </TR> <TR><TH ALIGN="LEFT"><B>char</B> <I>command</I>[320]</TH> <TD ALIGN="LEFT">Command line that produced the grid file</TD> </TR> <TR><TH ALIGN="LEFT"><B>char</B> <I>remark</I>[160]</TH> <TD ALIGN="LEFT">Any additional comments</TD> </TR> <TR><TH ALIGN="LEFT"><B>TYPE</B> <I>z</I>[nx*ny]</TH> <TD ALIGN="LEFT">1-D array with <IMG WIDTH="10" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img22.png" ALT="$z$">-values in scanline format</TD> </TR> </TABLE> <A NAME="tbl:grdheader"></A></DIV></TD></TR> </TABLE> </DIV><P></P> <BR> <A NAME="29984"></A> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html5395" HREF="node189.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html5389" HREF="node182.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html5385" HREF="node187.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html5391" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html5393" HREF="node258.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html5396" HREF="node189.html">B.3 Sun raster files</A> <B> Up:</B> <A NAME="tex2html5390" HREF="node182.html">B.2 Grid files</A> <B> Previous:</B> <A NAME="tex2html5386" HREF="node187.html">B.2.3 Boundary Conditions for</A> <B> <A NAME="tex2html5392" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html5394" HREF="node258.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2011-02-27 </ADDRESS> </BODY> </HTML>