[GRASS-SVN] r54687 - in grass/trunk: include/defs lib/imagery
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 17 14:25:31 PST 2013
Author: martinl
Date: 2013-01-17 14:25:30 -0800 (Thu, 17 Jan 2013)
New Revision: 54687
Modified:
grass/trunk/include/defs/imagery.h
grass/trunk/lib/imagery/iclass.c
grass/trunk/lib/imagery/iclass_statistics.c
Log:
imagerylib: fix I_iclass_init_group() to read raster maps from subgroup (patch provided by Anna Kratochvilova)
Modified: grass/trunk/include/defs/imagery.h
===================================================================
--- grass/trunk/include/defs/imagery.h 2013-01-17 19:17:00 UTC (rev 54686)
+++ grass/trunk/include/defs/imagery.h 2013-01-17 22:25:30 UTC (rev 54687)
@@ -53,7 +53,7 @@
/* iclass.c */
struct Map_info;
int I_iclass_analysis(IClass_statistics *, struct Ref *, struct Map_info *, const char *, const char *, const char *);
-int I_iclass_init_group(const char *, struct Ref *);
+int I_iclass_init_group(const char *, const char *, struct Ref *);
void I_iclass_create_raster(IClass_statistics *, struct Ref *, const char *);
/* iclass_statistics.c */
Modified: grass/trunk/lib/imagery/iclass.c
===================================================================
--- grass/trunk/lib/imagery/iclass.c 2013-01-17 19:17:00 UTC (rev 54686)
+++ grass/trunk/lib/imagery/iclass.c 2013-01-17 22:25:30 UTC (rev 54687)
@@ -97,36 +97,39 @@
/*!
- \brief Read files for the specified group into the Ref structure.
+ \brief Read files for the specified group subgroup into the Ref structure.
\param group_name name of imagery group
+ \param subgroup_name name of imagery subgroup
\param[out] refer pointer to band files structure
\return 1 on success
\return 0 on failure
*/
-int I_iclass_init_group(const char *group_name, struct Ref *refer)
+int I_iclass_init_group(const char *group_name, const char *subgroup_name,
+ struct Ref *refer)
{
int n;
- G_debug(3, "init_group(): group = %s", group_name);
+ G_debug(3, "I_iclass_init_group(): group_name = %s, subgroup_name = %s",
+ group_name, subgroup_name);
I_init_group_ref(refer); /* called in I_get_group_ref */
- I_get_group_ref(group_name, refer);
+ I_get_subgroup_ref(group_name, subgroup_name, refer);
for (n = 0; n < refer->nfiles; n++) {
if (G_find_raster(refer->file[n].name, refer->file[n].mapset) == NULL) {
- G_warning(_("Raster map <%s@%s> in group "
- "<%s> do not exist"), refer->file[n].name,
- refer->file[n].mapset, group_name);
+ G_warning(_("Raster map <%s@%s> in subgroup "
+ "<%s> does not exist"), refer->file[n].name,
+ refer->file[n].mapset, subgroup_name);
I_free_group_ref(refer);
return 0;
}
}
if (refer->nfiles <= 1) {
- G_warning(_("Group <%s> does not have enough files (it has %d files)"),
- group_name, refer->nfiles);
+ G_warning(_("Subgroup <%s> does not have enough files (it has %d files)"),
+ subgroup_name, refer->nfiles);
I_free_group_ref(refer);
return 0;
}
Modified: grass/trunk/lib/imagery/iclass_statistics.c
===================================================================
--- grass/trunk/lib/imagery/iclass_statistics.c 2013-01-17 19:17:00 UTC (rev 54686)
+++ grass/trunk/lib/imagery/iclass_statistics.c 2013-01-17 22:25:30 UTC (rev 54687)
@@ -242,9 +242,11 @@
ncells++; /* count interior points */
for (b = 0; b < nbands; b++) {
value = band_buffer[b][x];
- G_debug(5, "make_statistics() read value: %d", value);
+ G_debug(5, "make_statistics() band: %d, read value: %d (max: %d)",
+ b, value, MAX_CATS);
if (value < 0 || value > MAX_CATS - 1) {
- G_warning(_("prepare_signature: data error."));
+ G_warning(_("Data error preparing signatures: value (%d) > num of cats (%d)"),
+ value, MAX_CATS);
return 0;
}
statistics->band_sum[b] += value; /* sum for means */
More information about the grass-commit
mailing list