Browse Source

r.surf.idw moved to addons

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@63511 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 years ago
parent
commit
7c5956d398

+ 0 - 1
raster/Makefile

@@ -106,7 +106,6 @@ SUBDIRS = \
 	r.surf.fractal \
 	r.surf.gauss \
 	r.surf.idw \
-	r.surf.idw2 \
 	r.surf.random \
 	r.terraflow \
 	r.texture \

+ 1 - 1
raster/r.surf.idw/main.c

@@ -105,7 +105,7 @@ int main(int argc, char **argv)
     G_add_keyword(_("interpolation"));
     G_add_keyword(_("IDW"));
     module->description =
-	_("Surface interpolation utility for raster map.");
+	_("Provides surface interpolation from raster point data by Inverse Distance Squared Weighting.");
 
     parm.input = G_define_standard_option(G_OPT_R_INPUT);
 

+ 17 - 16
raster/r.surf.idw/r.surf.idw.html

@@ -1,7 +1,7 @@
 <h2>DESCRIPTION</h2>
 
 <em>r.surf.idw</em> fills a grid cell (raster) matrix with
-interpolated values generated from a set of input layer
+interpolated values generated from input raster
 data points. It uses a numerical approximation technique
 based on distance squared weighting of the values of
 nearest data points. The number of nearest data points used
@@ -21,12 +21,11 @@ outputs the difference (see <a href="#minuse.html">NOTES</a> below).
 <p>The <b>npoints</b> parameter defines the number of nearest data points used
 to determine the interpolated value of an output raster cell.
 
-<A NAME="notes.html"></a>
 <h2>NOTES</h2>
 
 <em>r.surf.idw</em> is a surface generation utility which
 uses inverse distance squared weighting (as described in
-<b>Applied Geostatistics</b> by E. H. Isaaks and R. M.
+<i>Applied Geostatistics</i> by E. H. Isaaks and R. M.
 Srivastava, Oxford University Press, 1989) to assign
 interpolated values. The implementation includes a
 customized data structure somewhat akin to a sparse matrix
@@ -36,7 +35,7 @@ distances are calculated from point to point along a
 geodesic.
 
 <p>
-Unlike <em><a href="r.surf.idw2.html">r.surf.idw2</a></em>, which processes
+Unlike <em><a href="http://grass.osgeo.org/grass70/manuals/addons/r.surf.idw2.html">r.surf.idw2</a></em> (addons), which processes
 all input data points in each interpolation cycle, <em>r.surf.idw</em>
 attempts to minimize the number of input data for which distances must be
 calculated. Execution speed is therefore a function of the search effort,
@@ -44,10 +43,10 @@ and does not increase appreciably with the number of input data points.
 
 <p>
 <em>r.surf.idw</em> will generally outperform 
-<em><a href="r.surf.idw2.html">r.surf.idw2</a></em> except when the input data
+<em>r.surf.idw2</em> except when the input data
 layer contains few non-zero data, i.e. when the cost of the search exceeds
 the cost of the additional distance calculations performed by 
-<em><a href="r.surf.idw2.html">r.surf.idw2</a></em>. The relative performance
+<em>r.surf.idw2</em>. The relative performance
 of these utilities will depend on the comparative speed of boolean, integer
 and floating point operations on a particular platform.
 
@@ -67,8 +66,9 @@ irregularly spaced input data.  However, the output result
 for the former may include unacceptable nonconformities in
 the surface pattern.
 
+<a name="minuse.html"></a>
 <p>
-The <A NAME="minuse.html"><b>-e</b></a> flag option provides a standard
+The <b>-e</b> flag option provides a standard
 surface-generation error analysis facility. It produces an output raster map
 of the difference of interpolated values minus input values for those cells
 whose input data are non-zero. For each interpolation cycle, the known value
@@ -81,14 +81,14 @@ considered for surface generation.
 
 <h2>SEE ALSO</h2>
 
-<em><a href="r.surf.contour.html">r.surf.contour</a></em>,
-<em><a href="r.surf.idw2.html">r.surf.idw2</a></em>,
-<em><a href="r.surf.gauss.html">r.surf.gauss</a></em>,
-<em><a href="r.surf.fractal.html">r.surf.fractal</a></em>,
-<em><a href="r.surf.random.html">r.surf.random</a></em>,
-<em><a href="v.surf.idw.html">v.surf.idw</a></em>,
-<em><a href="v.surf.rst.html">v.surf.rst</a></em>
-
+<em>
+  <a href="r.surf.contour.html">r.surf.contour</a>,
+  <a href="r.surf.gauss.html">r.surf.gauss</a>,
+  <a href="r.surf.fractal.html">r.surf.fractal</a>,
+  <a href="r.surf.random.html">r.surf.random</a>,
+  <a href="v.surf.idw.html">v.surf.idw</a>,
+  <a href="v.surf.rst.html">v.surf.rst</a>
+</em>
 
 <h2>AUTHOR</h2>
 
@@ -98,4 +98,5 @@ U.S. EPA Environmental Research Laboratory <br>
 200 S.W. 35th Street, JSB <br>
 Corvallis, OR 97333 
 
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>

+ 0 - 10
raster/r.surf.idw2/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = r.surf.idw2
-
-LIBES = $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(RASTERDEP) $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 5
raster/r.surf.idw2/local_proto.h

@@ -1,5 +0,0 @@
-/* main.c */
-int newpoint(double, double, double);
-
-/* read_cell.c */
-int read_cell(char *);

+ 0 - 210
raster/r.surf.idw2/main.c

@@ -1,210 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       r.surf.idw2
- * AUTHOR(S):    Michael Shapiro, CERL (original contributor)
- *               Roberto Flor <flor itc.it>, Markus Neteler <neteler itc.it>,
- *               Glynn Clements <glynn gclements.plus.com>, Jachym Cepicky <jachym les-ejk.cz>,
- *               Jan-Oliver Wagner <jan intevation.de>, Radim Blazek <radim.blazek gmail.com>
- * PURPOSE:      
- * COPYRIGHT:    (C) 1999-2006 by the GRASS Development Team
- *
- *               This program is free software under the GNU General Public
- *               License (>=v2). Read the file COPYING that comes with GRASS
- *               for details.
- *
- *****************************************************************************/
-#include <stdlib.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include "local_proto.h"
-#include <grass/glocale.h>
-
-int search_points = 12;
-
-int npoints = 0;
-int npoints_alloc = 0;
-int nsearch;
-
-struct Point
-{
-    double north, east;
-    double z;
-    double dist;
-};
-struct Point *points = NULL;
-struct Point *list;
-
-
-int main(int argc, char *argv[])
-{
-    int fd, maskfd;
-    CELL *cell, *mask;
-    struct Cell_head window;
-    int row, col;
-    double north, east;
-    double dx, dy;
-    double maxdist, dist;
-    double sum1, sum2;
-    int i, n, max;
-    struct GModule *module;
-    struct History history;
-    struct
-    {
-	struct Option *input, *npoints, *output;
-    } parm;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    G_add_keyword(_("raster"));
-    G_add_keyword(_("surface"));
-    G_add_keyword(_("interpolation"));
-    G_add_keyword(_("IDW"));
-    module->description = _("Surface generation program.");
-
-    parm.input = G_define_standard_option(G_OPT_R_INPUT);
-
-    parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
-
-    parm.npoints = G_define_option();
-    parm.npoints->key = "npoints";
-    parm.npoints->key_desc = "count";
-    parm.npoints->type = TYPE_INTEGER;
-    parm.npoints->required = NO;
-    parm.npoints->description = _("Number of interpolation points");
-    parm.npoints->answer = "12";
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    /* Make sure that the current projection is not lat/long */
-    if ((G_projection() == PROJECTION_LL))
-	G_fatal_error(_("Lat/long databases not supported by r.surf.idw2. Use r.surf.idw instead!"));
-
-    if (sscanf(parm.npoints->answer, "%d", &search_points) != 1 ||
-	search_points < 1)
-	G_fatal_error(_("%s=%s - illegal number of interpolation points"),
-		      parm.npoints->key, parm.npoints->answer);
-
-    list = (struct Point *)G_calloc(search_points, sizeof(struct Point));
-
-    /* read the elevation points from the input raster map */
-    read_cell(parm.input->answer);
-
-    if (npoints == 0)
-	G_fatal_error(_("%s: no data points found"), G_program_name());
-    nsearch = npoints < search_points ? npoints : search_points;
-
-    /* get the window, allocate buffers, etc. */
-    G_get_set_window(&window);
-
-    cell = Rast_allocate_c_buf();
-
-    if ((maskfd = Rast_maskfd()) >= 0)
-	mask = Rast_allocate_c_buf();
-    else
-	mask = NULL;
-
-    fd = Rast_open_c_new(parm.output->answer);
-
-    G_message(_n("Interpolating raster map <%s>... %d row... ",
-        "Interpolating raster map <%s>... %d rows... ", window.rows),
-	      parm.output->answer, window.rows);
-
-    north = window.north - window.ns_res / 2.0;
-    for (row = 0; row < window.rows; row++) {
-	G_percent(row, window.rows, 2);
-
-	if (mask)
-	    Rast_get_c_row(maskfd, mask, row);
-
-	north += window.ns_res;
-	east = window.west - window.ew_res / 2.0;
-	for (col = 0; col < window.cols; col++) {
-	    east += window.ew_res;
-	    /* don't interpolate outside of the mask */
-	    if (mask && mask[col] == 0) {
-		cell[col] = 0;
-		continue;
-	    }
-	    /* fill list with first nsearch points */
-	    for (i = 0; i < nsearch; i++) {
-		dy = points[i].north - north;
-		dx = points[i].east - east;
-		list[i].dist = dy * dy + dx * dx;
-		list[i].z = points[i].z;
-	    }
-	    /* find the maximum distance */
-	    maxdist = list[max = 0].dist;
-	    for (n = 1; n < nsearch; n++) {
-		if (maxdist < list[n].dist)
-		    maxdist = list[max = n].dist;
-	    }
-	    /* go thru rest of the points now */
-	    for (; i < npoints; i++) {
-		dy = points[i].north - north;
-		dx = points[i].east - east;
-		dist = dy * dy + dx * dx;
-
-		if (dist < maxdist) {
-		    /* replace the largest dist */
-		    list[max].z = points[i].z;
-		    list[max].dist = dist;
-		    maxdist = list[max = 0].dist;
-		    for (n = 1; n < nsearch; n++) {
-			if (maxdist < list[n].dist)
-			    maxdist = list[max = n].dist;
-		    }
-		}
-	    }
-
-	    /* interpolate */
-	    sum1 = 0.0;
-	    sum2 = 0.0;
-	    for (n = 0; n < nsearch; n++) {
-		if ((dist = list[n].dist)) {
-		    sum1 += list[n].z / dist;
-		    sum2 += 1.0 / dist;
-		}
-		else {
-		    sum1 = list[n].z;
-		    sum2 = 1.0;
-		    break;
-		}
-	    }
-	    cell[col] = (CELL) (sum1 / sum2 + 0.5);
-	}
-
-	Rast_put_row(fd, cell, CELL_TYPE);
-    }
-
-    G_free(points);
-    G_free(cell);
-    Rast_close(fd);
-
-    /* writing history file */
-    Rast_short_history(parm.output->answer, "raster", &history);
-    Rast_command_history(&history);
-    Rast_write_history(parm.output->answer, &history);
-    G_done_msg(" ");
-
-    exit(EXIT_SUCCESS);
-}
-
-int newpoint(double z, double east, double north)
-{
-    if (npoints_alloc <= npoints) {
-	npoints_alloc += 1024;
-	points = (struct Point *)G_realloc(points,
-					   npoints_alloc *
-					   sizeof(struct Point));
-    }
-    points[npoints].north = north;
-    points[npoints].east = east;
-    points[npoints].z = z;
-    npoints++;
-
-    return 0;
-}

+ 0 - 65
raster/r.surf.idw2/r.surf.idw2.html

@@ -1,65 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.surf.idw2</em> fills a raster matrix with
-interpolated values generated from a set of irregularly
-spaced data points using numerical approximation (weighted
-averaging) techniques.  The interpolated value of a cell is
-determined by values of nearby data points and the distance
-of the cell from those input points.  In comparison with
-other methods, numerical approximation allows
-representation of more complex surfaces (particularly those
-with anomalous features), restricts the spatial influence
-of any errors, and generates the interpolated surface from
-the data points.  It is the most appropriate method to
-apply to most spatial data.
-
-
-The <b>npoints</b> parameter defines the number of points to use for
-interpolation.  The default is to use the 12 nearest points when
-interpolating the value for a particular cell.
-
-<h2>NOTES</h2>
-
-The amount of memory used by this program is related to the
-number of non-zero data values in the input map layer.  If
-the input raster map layer is very dense (i.e., contains
-many non-zero data points), the program may not be able to
-get all the memory it needs from the system.  The time
-required to execute increases with the number of input data
-points.
-
-<p>
-If the user has a mask set, then interpolation is only done
-for those cells that fall within the mask.  However, all
-non-zero data points in the input layer are used even if
-they fall outside the mask.
-
-<p>
-This program does not work with latitude/longitude data
-bases.  Another surface generation program, named
-<em><a href="r.surf.idw.html">r.surf.idw</a></em>, 
-should be used with latitude/longitude data bases.
-
-
-<p>
-The user should refer to the manual entries for <br>
-<em><a href="r.surf.idw.html">r.surf.idw</a></em><br>
-<em><a href="r.surf.contour.html">r.surf.contour</a></em><br>
-<em><a href="v.surf.rst.html">v.surf.rst</a></em> <br>to
-compare this surface generation program with others available in GRASS.
-
-<h2>SEE ALSO</h2>
-
-<em><a href="r.surf.contour.html">r.surf.contour</a></em>,
-<em><a href="r.surf.idw.html">r.surf.idw</a></em>,
-<em><a href="r.surf.gauss.html">r.surf.gauss</a></em>,
-<em><a href="r.surf.fractal.html">r.surf.fractal</a></em>,
-<em><a href="r.surf.random.html">r.surf.random</a></em>,
-<em><a href="r.surf.idw2.html">r.surf.idw2</a></em>,
-<em><a href="v.surf.rst.html">v.surf.rst</a></em>
-
-<h2>AUTHOR</h2>
-
-Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
-
-<p><i>Last changed: $Date$</i>

+ 0 - 48
raster/r.surf.idw2/read_cell.c

@@ -1,48 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/glocale.h>
-#include "local_proto.h"
-
-int read_cell(char *name)
-{
-    int fd;
-    CELL *cell;
-    struct Cell_head window, cellhd;
-    int row, col;
-    double z, north;
-
-    G_get_window(&window);
-
-    /* Set window to align with input raster map */
-    Rast_get_cellhd(name, "", &cellhd);
-    Rast_align_window(&window, &cellhd);
-    Rast_set_window(&window);
-
-    cell = Rast_allocate_c_buf();
-
-    fd = Rast_open_old(name, "");
-
-    G_message(_("Reading raster map <%s>..."), name);
-
-    north = window.north - window.ns_res / 2.0;
-    for (row = 0; row < window.rows; row++) {
-	G_percent(row, window.rows, 1);
-	north += window.ns_res;
-	Rast_get_c_row_nomask(fd, cell, row);
-	for (col = 0; col < window.cols; col++)
-	    if ((z = cell[col]))
-		newpoint(z, window.west + (col + .5) * window.ew_res, north);
-    }
-    G_percent(row, window.rows, 1);
-
-    Rast_close(fd);
-    G_free(cell);
-
-    /* reset the window */
-    G_get_window(&window);
-    Rast_set_window(&window);
-
-    return 0;
-}