[GRASS5] i.pca and masks

Glynn Clements glynn.clements at virgin.net
Thu Sep 19 23:10:54 EDT 2002


Gualter Barbas Baptista wrote:

> I did some PCA on images using different masks and only then I noticed
> that in the end I got the full image, without a mask. However in the man
> page it says:
> 
> The current geographic region definition and mask settings are respected
> when reading the input raster map layers
> 
> What does this mean? That it uses the mask only for making the pca
> calculations, but then shows up the whole image?
> If I would want to build up a image on the mask area (hard disk
> space...), would it be possible?

It's a bug in one of the core functions, G_get_map_row(), which is
used for reading maps. This function is supposed to automatically take
account of the mask, but it doesn't; in reality this function is
identical to G_get_map_row_nomask().

The net result is that any module which uses G_get_map_row() rather
than G_get_raster_row() etc will completely ignore the mask.

Note: this bug is present in the earliest CVS version, dating back to
1999/12/29. It isn't present in 4.3; between 4.3 and the earliest CVS
version, src/libes/gis/get_row.c was completely rewritten to handle
floating-point and null values.

If you built GRASS from source code, apply the attached patch and
recompile. Otherwise, wait for 5.0.1.

-- 
Glynn Clements <glynn.clements at virgin.net>

-------------- next part --------------
Index: src/libes/gis/get_row.c
===================================================================
RCS file: /grassrepository/grass/src/libes/gis/get_row.c,v
retrieving revision 1.11
diff -u -r1.11 get_row.c
--- src/libes/gis/get_row.c	13 May 2002 09:46:16 -0000	1.11
+++ src/libes/gis/get_row.c	20 Sep 2002 02:57:40 -0000
@@ -824,7 +824,7 @@
   stat = get_map_row_nomask (fd, (void *) cell, row, CELL_TYPE);
   if(stat >= 0)
   {
-      stat = embed_nulls_nomask(fd, (void *) cell, row, CELL_TYPE, 1);
+      stat = embed_nulls(fd, (void *) cell, row, CELL_TYPE, 1);
       if (FCB.reclass_flag) do_reclass_int(fd, cell, 1);
   }
   return stat;


More information about the grass-dev mailing list