<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>r.surf.nnbathy</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- <link rel="stylesheet" href="grassdocs.css" type="text/css"> -->
</head>
<body bgcolor="white">

<!-- <img src="grass.smlogo.gif" alt="GRASS logo"><hr align=center size=6 noshade> -->

<h2>NAME</h2>
<em><b>r.surf.nnbathy</b></em>  - Interpolate surface from rasterized input using <a href="http://www.marine.csiro.au/~sakov/">nn</a> natural neighbor intepolation library.
<h2>SYNOPSIS</h2>
<b>r.surf.nnbathy</b><br>
<b>r.surf.nnbathy help</b><br>
<b>r.surf.nnbathy</b> <b>input</b>=<em>name</em> <b>output</b>=<em>name</em>

<h3>Parameters:</h3>
<DL>
<DT><b>input</b>=<em>name</em></DT>
<DD>Input raster name</DD>

<DT><b>output</b>=<em>name</em></DT>
<DD>Output raster name</DD>

</DL>
<h2>DESCRIPTION</h2>

<em>r.surf.nnbathy</em> is a Bash and Awk script. It is an interface between the external <em>nnbathy</em> utility and Grass. <em>nnbathy</em> is a surface interpolation program, which uses <em>nn</em> - a natural neighbor interpolation library. <em>nnbathy</em> and <em>nn</em> were written by
<a href="http://www.marine.csiro.au/~sakov/">Pavel Sakov</a>. <em>nn</em> uses <em>triangle</em> software by
<a href="http://www.cs.berkeley.edu/~jrs/">Jonathan Shewchuk</a> for performing the Delaunay triangulation.

<P>
The <B>output</B> raster contains a continous surface interpolated from the <B>input</B> raster.
<P>
There is no limitation in regard to the shape and distribution of the input cells. The input could be e.g. open or closed elevation contour lines, elevation points, areas and any combination of these. Natural neighbor algorithm exactly follows the input data and is able to produce a good result from very clustered, heterogenous input. It will preserve any rapid value gradient present in the input. It doesn't produce artificial bulges or hollows between the distant input data, only a linear, continous surface. It might lead to bogus flat areas in case of kidney-like shaped contour lines in input.

<P>
<em>nnbathy</em>, if built with '-DNN_SERIAL' switch, is able to handle a grid of virtually any size, using very little memory. It reads, interpolates and writes one output point at a time only. This eliminates necessity to hold the whole output array in memory.

<P>
In order to install <em>nnbathy</em> with serial input processing enabled, do the following:

<ul>
1. Download nn.tar.gz from <a href="http://www.marine.csiro.au/~sakov/">http://www.marine.csiro.au/~sakov/</a><br>
2. tar xzvf nn.tar.gz<br>
3. cd nn<br>
4. ./configure<br>
5. make<br>
6. gcc -o nnbathy nnbathy.c -g -O2 -Wall -pedantic -I. -DNN_SERIAL libnn.a -lm<br>
7. chmod u+x ./nnbathy
</ul>

<P>
Now copy the <em>nnbathy</em> executable to a directory listed in your PATH.

<H2>NOTES & CAVEATS</H2>
<ul>
1. The output extent and resolution will match the current region settings.<br>
2. The output non-NULL area will be limited to the convex hull encompassing all the non-NULL input cells.<br>
3. The output is double floating point raster.<br>
4. Natural neighbor is a an <em>exact</em> interpolation algorithm, so all non-NULL input cells have their value exactly preserved in the output.<br>
5. The script will work with <em>nnbathy</em> version 1.63 and higher.<br>

<P>
I'd like to thank <a href="http://www.marine.csiro.au/~sakov/">Pavel Sakov</a> for all his support in regard to <em>nn</em> and <em>nnbathy</em> usage, and especially for implementing serial input processing.

</ul>
<h2>SEE ALSO</h2>

<B>v.to.rast</B><br>
<a href="http://www.marine.csiro.au/~sakov/">Pavel Sakov</a>

<h2>AUTHOR</h2>

Maciej Sieczka, Wroclaw, Poland, 2006<br>
Wroclaw University, Intitute of Plant Biology

<!-- <p><i>Last changed: $Date: 2006/02/01 09:18:56 $</i> -->
<HR>
<!-- <P><a href="index.html">Main index</a> - <a href="vector.html">vector index</a> - <a href="full_index.html">Full index</a> -->
</body>
</html>