[GRASS-SVN] r63487 - in grass-addons/grass7: raster raster/r.surf.nnbathy vector/v.surf.nnbathy

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 12 03:30:11 PST 2014


Author: martinl
Date: 2014-12-12 03:30:11 -0800 (Fri, 12 Dec 2014)
New Revision: 63487

Added:
   grass-addons/grass7/raster/r.surf.nnbathy/
   grass-addons/grass7/raster/r.surf.nnbathy/Makefile
   grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.html
   grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.py
Removed:
   grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.html
   grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.py
Log:
bash version of r.surf.nnbathy replaced by Python version (step 2)

Added: grass-addons/grass7/raster/r.surf.nnbathy/Makefile
===================================================================
--- grass-addons/grass7/raster/r.surf.nnbathy/Makefile	                        (rev 0)
+++ grass-addons/grass7/raster/r.surf.nnbathy/Makefile	2014-12-12 11:30:11 UTC (rev 63487)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM=r.surf.nnbathy
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass-addons/grass7/raster/r.surf.nnbathy/Makefile
___________________________________________________________________
Added: svn:mime-type
   + text/x-makefile
Added: svn:eol-style
   + native

Copied: grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.html (from rev 63486, grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.html)
===================================================================
--- grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.html	2014-12-12 11:30:11 UTC (rev 63487)
@@ -0,0 +1,80 @@
+<h2>DESCRIPTION</h2>
+
+<em>r.surf.nnbathy</em> is an interface between the
+external <em>nnbathy</em> utility and <em>GRASS</em>.
+<em>nnbathy</em> is a surface interpolation program provided with
+<a href="https://code.google.com/p/nn-c/">nn</a> - a natural neighbor
+interpolation library, written by Pavel Sakov.
+
+<p>
+<em>r.surf.nnbathy</em> provides 3 interpolation algorithms. According to
+<em>nn</em> library documentation these are: Delaunay interpolation
+(<b>alg=l</b>), Watson's algortithm for Sibson natural neighbor
+interpolation (<b>alg=nn</b>) and Belikov and Semenov's algorithm for
+non-Sibsonian natural neighbor interpolation (<b>alg=ns</b>). For performing
+the underlaying Delaunay triangulation in all cases <em>nnbathy</em> uses
+<em>triangle</em> software by
+<a href="http://www.cs.berkeley.edu/~jrs/">Jonathan Richard Shewchuk</a>.
+
+<p>
+The <b>output</b> raster map is a continous surface interpolated from the
+<b>input</b> data.
+
+<h2>NOTES</h2>
+
+<em>nnbathy</em>, if built with '-DNN_SERIAL' (default as of nn 1.85), is
+able to create a grid of virtually any size. It interpolates and writes one
+output point at a time only. This eliminates the necessity to hold the whole
+output array in memory. However, even then all the input points are still
+held in the memory.
+
+<ol>
+<li>Requires <em>GRASS</em> 7 and <em>nnbathy</em> 1.76 or greater.</li>
+<li>Build <em>nnbathy</em> according to instructions provided with its source
+code and put it somewhere in your $PATH.</li>
+<li>The output raster map extent and resolution match the region settings at
+which the script was started.</li>
+<li>The output raster map non-NULL area is limited to the convex hull
+encompassing all the non-NULL input cells.</li>
+<li>The output is double precision floating point raster map (DCELL).</li>
+<li>Natural neighbor is a an <em>exact</em> interpolation algorithm, so all
+non-NULL input points have their value exactly preserved in the output.</li>
+<li>There is circa 0.2 KB memory overhead per each <em>input</em> cell.
+However, the <em>output</em> grid can be of any size, if <em>nnbathy</em> is
+built with -DNN_SERIAL switch.</li>
+<li><em>r.surf.nnbathy</em> creates 3 temporary files: ASCII x,y,z lists of
+the input points and output cells, and the output list converted into GRASS ASCII
+format. Then it makes a GRASS raster map from the latter - and only then it
+removes the 3 temp files, when the script terminates. Thus, at the script
+run time several times more disk space might be required, than the final
+GRASS raster map would actually occupy.</li>
+</ol>
+
+<h2>EXAMPLE</h2>
+
+TODO
+
+<h2>REFERENCES</h2>
+
+<ul>
+  <li><a href="https://code.google.com/p/nn-c/">nnbathy</a> library by Pavel Sakov</li>
+</ul>
+
+<h2>SEE ALSO</h2>
+
+<em>
+  <a href="v.surf.nnbathy.html">v.surf.nnbathy</a>
+</em> 
+
+
+<h2>AUTHOR</h2>
+
+Adam Laza, Czech Technical University in Prague (mentor: Martin Landa)
+
+<p>
+based on v.surf.nnbathy from GRASS 6 by<br>
+Hamish Bowman, Otago University, New Zealand<br>
+Based on <em>r.surf.nnbathy</em> by Maciej Sieczka<br>
+
+<p>
+<i>Last changed: $Date$</i>

Copied: grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.py (from rev 63486, grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.py)
===================================================================
--- grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.py	                        (rev 0)
+++ grass-addons/grass7/raster/r.surf.nnbathy/r.surf.nnbathy.py	2014-12-12 11:30:11 UTC (rev 63487)
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE:     r.surf.nnbathy
+#
+# AUTHOR(S):  Adam Laza (mentor: Martin Landa)
+#             (based on v.surf.nnbathy from GRASS 6)
+#
+# PURPOSE:    Interpolate raster surface using the "nnbathy" natural
+#             neighbor interpolation program.
+#
+# COPYRIGHT:  (c) 2014 Adam Laza, and the GRASS Development Team
+#
+# LICENSE:    This program is free software under the GNU General Public
+#             License (>=v2). Read the file COPYING that comes with
+#             GRASS for details.
+#
+#############################################################################
+#
+# NOTES:
+#
+# 1. Requires nnbathy executable v 1.75 or later. Follow the instruction in
+#    html manual page to obtain it.
+#
+# 2. When creating the input raster map, make sure it's extents cover
+#    your whole region of interest, the cells you wish to interplate on are
+#    NULL, and the resolution is correct. Same as most GRASS raster modules
+#    this one is region sensitive too.
+
+#%Module
+#% description: Interpolates a raster map using the nnbathy natural neighbor interpolation program.
+#% keywords: vector
+#% keywords: surface
+#% keywords: interpolation
+#% keywords: natural
+#% keywords: neighbor
+#%end
+#%option G_OPT_R_INPUT
+#% key: input
+#% type: string
+#% description: Name of input raster map
+#% guisection: Input data
+#% required : yes
+#%end
+#%option G_OPT_R_OUTPUT
+#% key: output
+#% description: Name of output raster map
+#%end
+#%option
+#% key: algorithm
+#% type: string
+#% options: l,nn,ns
+#% answer: nn
+#% descriptions: l;Linear;nn;Sibson natural neighbor;ns;Non-Sibsonian natural neighbor
+#% description: Settings
+#%end
+
+import os
+import sys
+
+from grass.script.core import parser
+import grass.script as grass
+
+def main():
+    sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'nnbathy'))
+    from nnbathy import Nnbathy_raster
+    obj = Nnbathy_raster(options)
+    obj.compute()
+    obj.create_output()
+
+if __name__ == "__main__":
+    options, flags = parser()
+    main()

Deleted: grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.html
===================================================================
--- grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.html	2014-12-12 11:25:23 UTC (rev 63486)
+++ grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.html	2014-12-12 11:30:11 UTC (rev 63487)
@@ -1,80 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.surf.nnbathy</em> is an interface between the
-external <em>nnbathy</em> utility and <em>GRASS</em>.
-<em>nnbathy</em> is a surface interpolation program provided with
-<a href="https://code.google.com/p/nn-c/">nn</a> - a natural neighbor
-interpolation library, written by Pavel Sakov.
-
-<p>
-<em>r.surf.nnbathy</em> provides 3 interpolation algorithms. According to
-<em>nn</em> library documentation these are: Delaunay interpolation
-(<b>alg=l</b>), Watson's algortithm for Sibson natural neighbor
-interpolation (<b>alg=nn</b>) and Belikov and Semenov's algorithm for
-non-Sibsonian natural neighbor interpolation (<b>alg=ns</b>). For performing
-the underlaying Delaunay triangulation in all cases <em>nnbathy</em> uses
-<em>triangle</em> software by
-<a href="http://www.cs.berkeley.edu/~jrs/">Jonathan Richard Shewchuk</a>.
-
-<p>
-The <b>output</b> raster map is a continous surface interpolated from the
-<b>input</b> data.
-
-<h2>NOTES</h2>
-
-<em>nnbathy</em>, if built with '-DNN_SERIAL' (default as of nn 1.85), is
-able to create a grid of virtually any size. It interpolates and writes one
-output point at a time only. This eliminates the necessity to hold the whole
-output array in memory. However, even then all the input points are still
-held in the memory.
-
-<ol>
-<li>Requires <em>GRASS</em> 7 and <em>nnbathy</em> 1.76 or greater.</li>
-<li>Build <em>nnbathy</em> according to instructions provided with its source
-code and put it somewhere in your $PATH.</li>
-<li>The output raster map extent and resolution match the region settings at
-which the script was started.</li>
-<li>The output raster map non-NULL area is limited to the convex hull
-encompassing all the non-NULL input cells.</li>
-<li>The output is double precision floating point raster map (DCELL).</li>
-<li>Natural neighbor is a an <em>exact</em> interpolation algorithm, so all
-non-NULL input points have their value exactly preserved in the output.</li>
-<li>There is circa 0.2 KB memory overhead per each <em>input</em> cell.
-However, the <em>output</em> grid can be of any size, if <em>nnbathy</em> is
-built with -DNN_SERIAL switch.</li>
-<li><em>r.surf.nnbathy</em> creates 3 temporary files: ASCII x,y,z lists of
-the input points and output cells, and the output list converted into GRASS ASCII
-format. Then it makes a GRASS raster map from the latter - and only then it
-removes the 3 temp files, when the script terminates. Thus, at the script
-run time several times more disk space might be required, than the final
-GRASS raster map would actually occupy.</li>
-</ol>
-
-<h2>EXAMPLE</h2>
-
-TODO
-
-<h2>REFERENCES</h2>
-
-<ul>
-  <li><a href="https://code.google.com/p/nn-c/">nnbathy</a> library by Pavel Sakov</li>
-</ul>
-
-<h2>SEE ALSO</h2>
-
-<em>
-  <a href="v.surf.nnbathy.html">v.surf.nnbathy</a>
-</em> 
-
-
-<h2>AUTHOR</h2>
-
-Adam Laza, Czech Technical University in Prague (mentor: Martin Landa)
-
-<p>
-based on v.surf.nnbathy from GRASS 6 by<br>
-Hamish Bowman, Otago University, New Zealand<br>
-Based on <em>r.surf.nnbathy</em> by Maciej Sieczka<br>
-
-<p>
-<i>Last changed: $Date$</i>

Deleted: grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.py
===================================================================
--- grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.py	2014-12-12 11:25:23 UTC (rev 63486)
+++ grass-addons/grass7/vector/v.surf.nnbathy/r.surf.nnbathy.py	2014-12-12 11:30:11 UTC (rev 63487)
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-############################################################################
-#
-# MODULE:     r.surf.nnbathy
-#
-# AUTHOR(S):  Adam Laza (mentor: Martin Landa)
-#             (based on v.surf.nnbathy from GRASS 6)
-#
-# PURPOSE:    Interpolate raster surface using the "nnbathy" natural
-#             neighbor interpolation program.
-#
-# COPYRIGHT:  (c) 2014 Adam Laza, and the GRASS Development Team
-#
-# LICENSE:    This program is free software under the GNU General Public
-#             License (>=v2). Read the file COPYING that comes with
-#             GRASS for details.
-#
-#############################################################################
-#
-# NOTES:
-#
-# 1. Requires nnbathy executable v 1.75 or later. Follow the instruction in
-#    html manual page to obtain it.
-#
-# 2. When creating the input raster map, make sure it's extents cover
-#    your whole region of interest, the cells you wish to interplate on are
-#    NULL, and the resolution is correct. Same as most GRASS raster modules
-#    this one is region sensitive too.
-
-#%Module
-#% description: Interpolates a raster map using the nnbathy natural neighbor interpolation program.
-#% keywords: vector
-#% keywords: surface
-#% keywords: interpolation
-#% keywords: natural
-#% keywords: neighbor
-#%end
-#%option G_OPT_R_INPUT
-#% key: input
-#% type: string
-#% description: Name of input raster map
-#% guisection: Input data
-#% required : yes
-#%end
-#%option G_OPT_R_OUTPUT
-#% key: output
-#% description: Name of output raster map
-#%end
-#%option
-#% key: algorithm
-#% type: string
-#% options: l,nn,ns
-#% answer: nn
-#% descriptions: l;Linear;nn;Sibson natural neighbor;ns;Non-Sibsonian natural neighbor
-#% description: Settings
-#%end
-
-import os
-import sys
-
-from grass.script.core import parser
-import grass.script as grass
-
-def main():
-    sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'nnbathy'))
-    from nnbathy import Nnbathy_raster
-    obj = Nnbathy_raster(options)
-    obj.compute()
-    obj.create_output()
-
-if __name__ == "__main__":
-    options, flags = parser()
-    main()



More information about the grass-commit mailing list