<!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>4.19 The NaN data value</TITLE> <META NAME="description" CONTENT="4.19 The NaN data value"> <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="next" HREF="node75.html"> <LINK REL="previous" HREF="node73.html"> <LINK REL="up" HREF="node31.html"> <LINK REL="next" HREF="node75.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html3596" HREF="node75.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html3590" HREF="node31.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html3584" HREF="node73.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html3592" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html3594" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html3597" HREF="node75.html">4.20 GMT environment parameters</A> <B> Up:</B> <A NAME="tex2html3591" HREF="node31.html">4. General features</A> <B> Previous:</B> <A NAME="tex2html3585" HREF="node73.html">4.18 Options for COARDS-compliant</A> <B> <A NAME="tex2html3593" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html3595" HREF="node256.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION0012190000000000000000"></A> <A NAME="18601"></A> <A NAME="18602"></A> <BR> 4.19 The NaN data value </H1> <P> For a variety of data processing and plotting tasks there is a need to acknowledge that a data point is missing or unassigned. In the ``old days'' such information was passed by letting a value like -9999.99 take on the special meaning of ``this is not really a value, it is missing''. The problem with this scheme is that -9999.99 (or any other floating point value) may be a perfectly reasonable data value and in such a scenario would be skipped. The solution adopted in <A NAME="tex2html1228" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> is to use the IEEE concept Not-a-Number (NaN) for this purpose. Mathematically, a NaN is what you get if you do an undefined mathematical operation like <IMG WIDTH="28" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img84.png" ALT="$0/0$">; in ASCII data files they appear as the textstring NaN. This value is internally stored with a particular bit pattern defined by IEEE so that special action can be taken when it is encountered by programs. In particular, a library function called <TT>isnan</TT> is used to test if a floating point is a NaN. <A NAME="tex2html1229" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> uses these tests extensively to determine if a value is suitable for plotting or processing (if a NaN is used in a calculation the result would become NaN as well). Data points whose values equal NaN are not normally plotted (or plotted with the special NaN color given in <U>.gmtdefaults4</U>). Several tools such as <A NAME="tex2html1230" HREF="../man/xyz2grd.html"><I><B>xyz2grd</B></I></A><A NAME="19632"></A>, <A NAME="tex2html1231" HREF="../man/gmtmath.html"><I><B>gmtmath</B></I></A><A NAME="19637"></A>, and <A NAME="tex2html1232" HREF="../man/grdmath.html"><I><B>grdmath</B></I></A><A NAME="19642"></A> can convert user data to NaN and vice versa, thus facilitating arbitrary masking and clipping of data sets. Note that a few computers do not have native IEEE hardware support. At this point, this applies to some of the older Cray super-computers. Users on such machines may have to adopt the old `-9999.99'' scheme to achieve the desired results. <P> Data records that contain NaN values for the <I>x</I> or <I>y</I> columns (or the <I>z</I> column for cases when 3-D Cartesian data are expected) are usually skipped during reading. However, the presence of these bad records can be interpreted in two different ways, and this behavior is controlled by the <B>NAN_RECORDS</B> defaults parameter. The default setting (<I>gap</I>) considers such records to indicate a gap in an otherwise continuous series of points (e.g., a line), and programs can act upon this information, e.g., not to draw a line across the gap or to break the line into separate segments. The alternative setting (<I>bad</I>) makes no such interpretation and simply reports back how many bad records were skipped during reading. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html3596" HREF="node75.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html3590" HREF="node31.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html3584" HREF="node73.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html3592" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html3594" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html3597" HREF="node75.html">4.20 GMT environment parameters</A> <B> Up:</B> <A NAME="tex2html3591" HREF="node31.html">4. General features</A> <B> Previous:</B> <A NAME="tex2html3585" HREF="node73.html">4.18 Options for COARDS-compliant</A> <B> <A NAME="tex2html3593" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html3595" HREF="node256.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>