[GRASS-SVN] r44041 - grass-addons/imagery/i.landsat.acca

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 25 17:58:52 EDT 2010


Author: martinl
Date: 2010-10-25 14:58:52 -0700 (Mon, 25 Oct 2010)
New Revision: 44041

Removed:
   grass-addons/imagery/i.landsat.acca/grass7.patch
Log:
patch for i.landsat.acca not needed, already included in G7


Deleted: grass-addons/imagery/i.landsat.acca/grass7.patch
===================================================================
--- grass-addons/imagery/i.landsat.acca/grass7.patch	2010-10-25 21:36:34 UTC (rev 44040)
+++ grass-addons/imagery/i.landsat.acca/grass7.patch	2010-10-25 21:58:52 UTC (rev 44041)
@@ -1,362 +0,0 @@
-Index: tools.c
-===================================================================
---- tools.c	(revision 43088)
-+++ tools.c	(working copy)
-@@ -4,6 +4,7 @@
- #include <math.h>
- #include <unistd.h>
- #include <grass/gis.h>
-+#include <grass/raster.h>
- #include <grass/glocale.h>
- 
- #include "local_proto.h"
-@@ -122,7 +123,7 @@
- int pval(void * rast, int i)
- {
-     void * ptr = (void *)((CELL *)rast + i);
--    if( G_is_c_null_value(ptr) )
-+    if( Rast_is_c_null_value(ptr) )
-         return 0;
-     else
-         return (int)((CELL *) rast)[i];
-@@ -138,26 +139,26 @@
- 
-     Gfile tmp;
- 
--    nrows = G_window_rows();
--    ncols = G_window_cols();
-+    nrows = Rast_window_rows();
-+    ncols = Rast_window_cols();
- 
-     if( nrows < 3 || ncols < 3 )
-         return;
- 
-     /* Open to read */
--    mapset = G_find_cell2(out->name, "");
-+    mapset = G_find_raster2(out->name, "");
-     if (mapset == NULL)
-         G_fatal_error("cell file [%s] not found", out->name);
--    arast = G_allocate_raster_buf(CELL_TYPE);
--    brast = G_allocate_raster_buf(CELL_TYPE);
--    crast = G_allocate_raster_buf(CELL_TYPE);
--    if ((out->fd = G_open_cell_old(out->name, mapset)) < 0)
-+    arast = Rast_allocate_buf(CELL_TYPE);
-+    brast = Rast_allocate_buf(CELL_TYPE);
-+    crast = Rast_allocate_buf(CELL_TYPE);
-+    if ((out->fd = Rast_open_old(out->name, mapset)) < 0)
-         G_fatal_error("Cannot open cell file [%s]", out->name);
- 
-     /* Open to write */
-     sprintf(tmp.name, "_%d.BBB", getpid()) ;
--    tmp.rast = G_allocate_raster_buf(CELL_TYPE);
--    if ((tmp.fd = G_open_raster_new(tmp.name, CELL_TYPE)) < 0)
-+    tmp.rast = Rast_allocate_buf(CELL_TYPE);
-+    if ((tmp.fd = Rast_open_new(tmp.name, CELL_TYPE)) < 0)
-         G_fatal_error(_("Could not open <%s>"), tmp.name);
- 
-     fprintf(stdout, "Filling cloud holes ... \n");
-@@ -172,17 +173,12 @@
-         /* Read row values */
-         if (row != 0)
-         {
--            if (G_get_c_raster_row(out->fd, arast, row - 1) < 0)
--                G_fatal_error(_("Could not read from <%s>"), out->name);
-+	    Rast_get_c_row(out->fd, arast, row - 1);
-         }
--        if (G_get_c_raster_row(out->fd, brast, row) < 0)
--        {
--            G_fatal_error(_("Could not read from <%s>"), out->name);
--        }
-+        Rast_get_c_row(out->fd, brast, row);
-         if (row != (nrows - 1))
-         {
--            if (G_get_c_raster_row(out->fd, crast, row + 1) < 0)
--                G_fatal_error(_("Could not read from <%s>"), out->name);
-+	    Rast_get_c_row(out->fd, crast, row + 1);
-         }
-         /* Analysis of all pixels */
-         for (col = 0; col < ncols; col++)
-@@ -322,22 +318,19 @@
-             }
-             else
-             {
--                G_set_c_null_value((CELL *) tmp.rast + col, 1);
-+                Rast_set_c_null_value((CELL *) tmp.rast + col, 1);
-             }
-         }
--        if (G_put_raster_row(tmp.fd, tmp.rast, CELL_TYPE) < 0)
--        {
--            G_fatal_error(_("Cannot write to <%s>"), tmp.name);
--        }
-+        Rast_put_row(tmp.fd, tmp.rast, CELL_TYPE);
-     }
- 
-     G_free(arast);
-     G_free(brast);
-     G_free(crast);
--    G_close_cell(out->fd);
-+    Rast_close(out->fd);
- 
-     G_free(tmp.rast);
--    G_close_cell(tmp.fd);
-+    Rast_close(tmp.fd);
- 
-     G_remove("cats", out->name);
-     G_remove("cell", out->name);
-Index: main.c
-===================================================================
---- main.c	(revision 43088)
-+++ main.c	(working copy)
-@@ -19,6 +19,7 @@
- #include <stdlib.h>
- #include <string.h>
- #include <grass/gis.h>
-+#include <grass/raster.h>
- #include <grass/glocale.h>
- 
- #include "local_proto.h"
-@@ -53,7 +54,7 @@
-     int raster_fd;
-     char *mapset;
- 
--    mapset = G_find_cell2(raster_name, "");
-+    mapset = G_find_raster2(raster_name, "");
-     if (mapset == NULL) {
-         G_message("cell file [%s] not found", raster_name);
-         return -1;
-@@ -62,19 +63,13 @@
-         G_message("[%s] is an illegal name", raster_name);
-         return -1;
-     }
--    if ((raster_fd = G_open_cell_old(raster_name, mapset)) < 0) {
-+    if ((raster_fd = Rast_open_old(raster_name, mapset)) < 0) {
-         G_message("Cannot open cell file [%s]", raster_name);
-         return -1;
-     }
--    if (G_get_cellhd(raster_name, mapset, &cellhd) < 0) {
--        G_message("Cannot read file header of [%s]", raster_name);
--        return -1;
--    }
--    if (G_set_window(&cellhd) < 0) {
--        G_message("Unable to set region");
--        return -1;
--    }
--    if ((map_type = G_raster_map_type(raster_name, mapset)) != DCELL_TYPE) {
-+    Rast_get_cellhd(raster_name, mapset, &cellhd);
-+    G_set_window(&cellhd);
-+    if ((map_type = Rast_map_type(raster_name, mapset)) != DCELL_TYPE) {
-         G_message("Map is not of DCELL_TYPE");
-         return -1;
-     }
-@@ -166,7 +161,7 @@
-         {
-             G_fatal_error(_("Error in filename [%s]!"), band[i].name);
-         }
--        band[i].rast = G_allocate_raster_buf(DCELL_TYPE);
-+        band[i].rast = Rast_allocate_buf(DCELL_TYPE);
-     }
- 
-     out_name = output->answer;
-@@ -192,16 +187,16 @@
-     for (i = BAND2; i <= BAND6; i++)
-     {
-         G_free(band[i].rast);
--        G_close_cell(band[i].fd);
-+        Rast_close(band[i].fd);
-     }
- 
- //      struct Categories cats;
- //      G_read_raster_cats(out.name, char *mapset, cats)
- //      G_write_raster_cats(out.name, &cats);
- 
--    G_short_history(out.name, "raster", &history);
--    G_command_history(&history);
--    G_write_history(out.name, &history);
-+    Rast_short_history(out.name, "raster", &history);
-+    Rast_command_history(&history);
-+    Rast_write_history(out.name, &history);
- 
-     exit(EXIT_SUCCESS);
- }
-Index: algorithm.c
-===================================================================
---- algorithm.c	(revision 43088)
-+++ algorithm.c	(working copy)
-@@ -4,6 +4,7 @@
- #include <math.h>
- #include <unistd.h>
- #include <grass/gis.h>
-+#include <grass/raster.h>
- #include <grass/glocale.h>
- 
- #include "local_proto.h"
-@@ -217,8 +218,8 @@
-     double pixel[5], nsdi, rat56, rat45;
- 
-     /* Creation of output file */
--    out->rast = G_allocate_raster_buf(CELL_TYPE);
--    if ((out->fd = G_open_raster_new(out->name, CELL_TYPE)) < 0)
-+    out->rast = Rast_allocate_buf(CELL_TYPE);
-+    if ((out->fd = Rast_open_new(out->name, CELL_TYPE)) < 0)
-         G_fatal_error(_("Could not open <%s>"), out->name);
- 
-     /* ----- ----- */
-@@ -229,8 +230,8 @@
-     stats[KMAX] = 0.;
-     stats[KMIN] = 10000.;
- 
--    nrows = G_window_rows();
--    ncols = G_window_cols();
-+    nrows = Rast_window_rows();
-+    ncols = Rast_window_cols();
- 
-     for (row = 0; row < nrows; row++)
-     {
-@@ -240,8 +241,7 @@
-         }
-         for (i = BAND2; i <= BAND6; i++)
-         {
--            if (G_get_d_raster_row(band[i].fd, band[i].rast, row) < 0)
--                G_fatal_error(_("Could not read row from <%s>"), band[i].name);
-+	    Rast_get_d_row(band[i].fd, band[i].rast, row);
-         }
-         for (col = 0; col < ncols; col++)
-         {
-@@ -249,7 +249,7 @@
-             /* Null when null pixel in any band */
-             for ( i = BAND2; i <= BAND6; i++ )
-             {
--                if (G_is_d_null_value((void *)((DCELL *) band[i].rast + col)))
-+                if (Rast_is_d_null_value((void *)((DCELL *) band[i].rast + col)))
-                 {
-                     code = NO_CLOUD;
-                     break;
-@@ -326,22 +326,19 @@
-             }
-             if (code == NO_CLOUD)
-             {
--                G_set_c_null_value((CELL *) out->rast + col, 1);
-+                Rast_set_c_null_value((CELL *) out->rast + col, 1);
-             }
-             else
-             {
-                 ((CELL *) out->rast)[col] = code;
-             }
-         }
--        if (G_put_raster_row(out->fd, out->rast, CELL_TYPE) < 0)
--        {
--            G_fatal_error(_("Cannot write row to <%s>"), out->name);
--        }
-+        Rast_put_row(out->fd, out->rast, CELL_TYPE);
-     }
-     /* ----- ----- */
- 
-     G_free(out->rast);
--    G_close_cell(out->fd);
-+    Rast_close(out->fd);
- 
-     return;
- }
-@@ -358,17 +355,17 @@
-     Gfile tmp;
- 
-     /* Open to read */
--    mapset = G_find_cell2(out->name, "");
-+    mapset = G_find_raster2(out->name, "");
-     if (mapset == NULL)
-         G_fatal_error("cell file [%s] not found", out->name);
--    out->rast = G_allocate_raster_buf(CELL_TYPE);
--    if ((out->fd = G_open_cell_old(out->name, mapset)) < 0)
-+    out->rast = Rast_allocate_buf(CELL_TYPE);
-+    if ((out->fd = Rast_open_old(out->name, mapset)) < 0)
-         G_fatal_error("Cannot open cell file [%s]", out->name);
- 
-     /* Open to write */
-     sprintf(tmp.name, "_%d.BBB", getpid()) ;
--    tmp.rast = G_allocate_raster_buf(CELL_TYPE);
--    if ((tmp.fd = G_open_raster_new(tmp.name, CELL_TYPE)) < 0)
-+    tmp.rast = Rast_allocate_buf(CELL_TYPE);
-+    if ((tmp.fd = Rast_open_new(tmp.name, CELL_TYPE)) < 0)
-         G_fatal_error(_("Could not open <%s>"), tmp.name);
- 
-     if (upper == 0.)
-@@ -376,8 +373,8 @@
-     else
-         fprintf(stdout, "Pass two processing ... \n");
- 
--    nrows = G_window_rows();
--    ncols = G_window_cols();
-+    nrows = Rast_window_rows();
-+    ncols = Rast_window_cols();
- 
-     for (row = 0; row < nrows; row++)
-     {
-@@ -385,16 +382,14 @@
-         {
-             G_percent(row, nrows, 2);
-         }
--        if (G_get_d_raster_row(band.fd, band.rast, row) < 0)
--            G_fatal_error(_("Could not read from <%s>"), band.name);
--        if (G_get_c_raster_row(out->fd, out->rast, row) < 0)
--            G_fatal_error(_("Could not read from <%s>"), out->name);
--
-+        Rast_get_d_row(band.fd, band.rast, row);
-+        Rast_get_c_row(out->fd, out->rast, row);
-+	
-         for (col = 0; col < ncols; col++)
-         {
--            if (G_is_c_null_value((void *)((CELL *) out->rast + col)))
-+            if (Rast_is_c_null_value((void *)((CELL *) out->rast + col)))
-             {
--                G_set_c_null_value((CELL *) tmp.rast + col, 1);
-+                Rast_set_c_null_value((CELL *) tmp.rast + col, 1);
-             }
-             else
-             {
-@@ -406,7 +401,7 @@
-                     temp = (double)((DCELL *) band.rast)[col];
-                     if (temp > upper)
-                     {
--                        G_set_c_null_value((CELL *) tmp.rast + col, 1);
-+                        Rast_set_c_null_value((CELL *) tmp.rast + col, 1);
-                     }
-                     else
-                     {
-@@ -427,19 +422,16 @@
-                     ((CELL *) tmp.rast)[col] = IS_SHADOW;
-             }
-         }
--        if (G_put_raster_row(tmp.fd, tmp.rast, CELL_TYPE) < 0)
--        {
--            G_fatal_error(_("Cannot write to <%s>"), tmp.name);
--        }
-+        Rast_put_row(tmp.fd, tmp.rast, CELL_TYPE);
-     }
- 
-     /* Finalización */
- 
-     G_free(tmp.rast);
--    G_close_cell(tmp.fd);
-+    Rast_close(tmp.fd);
- 
-     G_free(out->rast);
--    G_close_cell(out->fd);
-+    Rast_close(out->fd);
- 
-     G_remove("cats", out->name);
-     G_remove("cell", out->name);
-Index: Makefile
-===================================================================
---- Makefile	(revision 43088)
-+++ Makefile	(working copy)
-@@ -2,8 +2,8 @@
- 
- PGM = i.landsat.acca
- 
--LIBES = $(GISLIB)
--DEPENDENCIES = $(GISDEP)
-+LIBES = $(GISLIB) $(RASTERLIB)
-+DEPENDENCIES = $(GISDEP) $(RASTERDEP)
- 
- include $(MODULE_TOPDIR)/include/Make/Module.make
- 



More information about the grass-commit mailing list