Browse Source

r.bitpattern moved to Addons in https://trac.osgeo.org/grass/changeset/62568

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@62571 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 10 years ago
parent
commit
af18de79d0
4 changed files with 0 additions and 201 deletions
  1. 0 1
      raster/Makefile
  2. 0 10
      raster/r.bitpattern/Makefile
  3. 0 138
      raster/r.bitpattern/main.c
  4. 0 52
      raster/r.bitpattern/r.bitpattern.html

+ 0 - 1
raster/Makefile

@@ -2,7 +2,6 @@ MODULE_TOPDIR = ..
 
 SUBDIRS = \
 	r.basins.fill \
-	r.bitpattern \
 	r.buffer \
 	r.carve \
 	r.category \

+ 0 - 10
raster/r.bitpattern/Makefile

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

+ 0 - 138
raster/r.bitpattern/main.c

@@ -1,138 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:      r.bitpattern
- * AUTHOR(S):   Radim Blazek
- * PURPOSE:     bit pattern comparison
- *		Functionality:
- *		1. define position: set bit(s) to 1 you want to match
- *		   then convert this position pattern to integer, set pattern=
- *		   parameter with that integer value
- *		2. define pattern *value* which should be in that position:
- *		   first bit pattern of value, convert to integer, set
- *		   patval= parameter
- *
- *		128 64 32 16 8 4 2 1
- *		Example:
- *		1. define position 
- *			xx xx 1x xx
- *			binary: 1000 -> integer: 8 -> pattern=8
- *		2. define value 
- *                      Ex.: we want to check for 0 in that position
- *			xx xx 0x xx
- *			binary: 0000 -> integer: 0 -> patval=0
- *                 if value can be arbitray (0/1), then assume 0 value
- *
- * COPYRIGHT:    (C) 2002-2014 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/glocale.h>
-
-extern CELL f_c(CELL);
-
-int main(int argc, char *argv[])
-{
-    struct Cell_head cellhd;
-    char *name, *result;
-    void *inrast;
-    unsigned char *outrast;
-    int nrows, ncols;
-    int row, col;
-    int infd, outfd;
-    RASTER_MAP_TYPE data_type;
-    int pat, patv;
-    struct GModule *module;
-    struct Option *input, *output, *pattern, *patval;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    G_add_keyword(_("raster"));
-    G_add_keyword(_("algebra"));
-    module->description = _("Compares bit patterns with a raster map.");
-
-    /* Define the different options */
-
-    input = G_define_standard_option(G_OPT_R_INPUT);
-
-    output = G_define_standard_option(G_OPT_R_OUTPUT);
-
-    pattern = G_define_option();
-    pattern->key = "pattern";
-    pattern->type = TYPE_INTEGER;
-    pattern->required = YES;
-    pattern->description = _("Bit pattern position(s)");
-
-    patval = G_define_option();
-    patval->key = "patval";
-    patval->type = TYPE_INTEGER;
-    patval->required = YES;
-    patval->description = _("Bit pattern value");
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    name = input->answer;
-    result = output->answer;
-    pat = atoi(pattern->answer);
-    patv = atoi(patval->answer);
-
-    infd = Rast_open_old(name, "");
-
-    /* determine the inputmap type (CELL/FCELL/DCELL) */
-    data_type = Rast_get_map_type(infd);
-
-    Rast_get_cellhd(name, "", &cellhd);
-
-    /* Allocate input buffer */
-    inrast = Rast_allocate_buf(data_type);
-
-    /* Allocate output buffer, use input map data_type */
-    nrows = Rast_window_rows();
-    ncols = Rast_window_cols();
-    outrast = Rast_allocate_buf(data_type);
-
-    outfd = Rast_open_new(result, data_type);
-
-    for (row = 0; row < nrows; row++) {
-	CELL c;
-
-        G_percent(row, nrows, 2);
-
-	/* read input map */
-	Rast_get_row(infd, inrast, row, data_type);
-
-	/*process the data */
-	for (col = 0; col < ncols; col++) {
-
-	    c = ((CELL *) inrast)[col];
-	    /*((CELL *) outrast)[col] = c; */
-	    if ((c & pat) == patv)
-		((CELL *) outrast)[col] = 1;
-	    else
-		((CELL *) outrast)[col] = 0;
-
-	}
-
-	Rast_put_row(outfd, outrast, data_type);
-    }
-    G_percent(1, 1, 1);
-    
-    G_free(inrast);
-    G_free(outrast);
-    Rast_close(infd);
-    Rast_close(outfd);
-
-    exit(EXIT_SUCCESS);
-}

+ 0 - 52
raster/r.bitpattern/r.bitpattern.html

@@ -1,52 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.bitpattern</em> performs bit pattern comparisons.
-The module can be used to pixelwise verify a satellite image
-for low quality pixels if a Quality Control Bit Index map is
-provided (e.g. as for MODIS sensor maps).
-
-The functionality is two-fold:
-
-<ol>
-<li>define position: set bit(s) to 1 which shall match,
-   then convert this position pattern to integer, set pattern=
-   parameter with that integer value
-<li>define pattern *value* which should be in that position:
-   first bit pattern of value, convert to integer, set
-   patval= parameter
-</ol>
-
-If several bitpatterns have to be tested, the resulting maps
-can be used to exclude low quality pixel in the input satellite
-image using <em>r.mapcalc</em> (OR and NOT operators).
-
-<h2>EXAMPLE</h2>
-
-<ol>
-<li>define position:
-<pre>
-	xx xx 1x xx
-	binary: 1000 -> integer: 8 -> pattern=8
-</pre>
-
-<li>define value:
-<pre>
-        Ex.: we want to check for 0 in that position
-	xx xx 0x xx
-	binary: 0000 -> integer: 0 -> patval=0
-        if value can be arbitray (0/1), then assume 0 value
-</pre>
-</ol>
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="i.modis.qc.html">i.modis.qc</a>,
-<a href="r.mapcalc.html">r.mapcalc</a>
-</em>
-
-<h2>AUTHORS</h2>
-
-Radim Blazek, Markus Neteler
-
-<p><i>Last changed: $Date$</i>