[GRASS-SVN] r62584 - in grass/branches/releasebranch_7_0/raster/r.li: r.li.cwed r.li.edgedensity r.li.patchdensity r.li.shape
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 3 11:57:58 PST 2014
Author: mmetz
Date: 2014-11-03 11:57:58 -0800 (Mon, 03 Nov 2014)
New Revision: 62584
Modified:
grass/branches/releasebranch_7_0/raster/r.li/r.li.cwed/cwed.c
grass/branches/releasebranch_7_0/raster/r.li/r.li.edgedensity/edgedensity.c
grass/branches/releasebranch_7_0/raster/r.li/r.li.patchdensity/main.c
grass/branches/releasebranch_7_0/raster/r.li/r.li.shape/main.c
Log:
r.li: fix total area: sample area without NULL cells
Modified: grass/branches/releasebranch_7_0/raster/r.li/r.li.cwed/cwed.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.li/r.li.cwed/cwed.c 2014-11-03 19:57:42 UTC (rev 62583)
+++ grass/branches/releasebranch_7_0/raster/r.li/r.li.cwed/cwed.c 2014-11-03 19:57:58 UTC (rev 62584)
@@ -365,12 +365,11 @@
if (masked && mask_corr[i] == 0) {
Rast_set_c_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
if (!(Rast_is_null_value(&corrCell, CELL_TYPE))) {
+ /* total sample area */
+ area += 1;
+
supCell = buf_sup[i + ad->x];
if (masked && (mask_sup[i] == 0)) {
Rast_set_c_null_value(&supCell, 1);
@@ -512,12 +511,11 @@
if (masked && mask_corr[i] == 0) {
Rast_set_d_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
if (!(Rast_is_null_value(&corrCell, DCELL_TYPE))) {
+ /* total sample area */
+ area += 1;
+
supCell = buf_sup[i + ad->x];
if (masked && (mask_sup[i] == 0)) {
Rast_set_d_null_value(&supCell, 1);
@@ -660,12 +658,11 @@
if (masked && mask_corr[i] == 0) {
Rast_set_f_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
if (!(Rast_is_null_value(&corrCell, FCELL_TYPE))) {
+ /* total sample area */
+ area += 1;
+
supCell = buf_sup[i + ad->x];
if (masked && (mask_sup[i] == 0)) {
Rast_set_f_null_value(&supCell, 1);
Modified: grass/branches/releasebranch_7_0/raster/r.li/r.li.edgedensity/edgedensity.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.li/r.li.edgedensity/edgedensity.c 2014-11-03 19:57:42 UTC (rev 62583)
+++ grass/branches/releasebranch_7_0/raster/r.li/r.li.edgedensity/edgedensity.c 2014-11-03 19:57:58 UTC (rev 62584)
@@ -200,7 +200,7 @@
if (masked && mask_buf[j] == 0) {
Rast_set_c_null_value(&corrCell, 1);
}
- else {
+ if (!Rast_is_c_null_value(&corrCell)) {
/* total sample area */
area++;
}
@@ -378,7 +378,7 @@
if (masked && mask_buf[j] == 0) {
Rast_set_d_null_value(&corrCell, 1);
}
- else {
+ if (!Rast_is_d_null_value(&corrCell)) {
/* total sample area */
area++;
}
@@ -556,7 +556,7 @@
if (masked && mask_buf[j] == 0) {
Rast_set_f_null_value(&corrCell, 1);
}
- else {
+ if (!Rast_is_f_null_value(&corrCell)) {
/* total sample area */
area++;
}
Modified: grass/branches/releasebranch_7_0/raster/r.li/r.li.patchdensity/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.li/r.li.patchdensity/main.c 2014-11-03 19:57:42 UTC (rev 62583)
+++ grass/branches/releasebranch_7_0/raster/r.li/r.li.patchdensity/main.c 2014-11-03 19:57:58 UTC (rev 62584)
@@ -207,10 +207,6 @@
if (masked && (mask_buf[j] == 0)) {
Rast_set_c_null_value(&corrCell, 1);
}
- else {
- /* total landscape area */
- area++;
- }
if (Rast_is_c_null_value(&corrCell)) {
connected = 0;
@@ -218,6 +214,8 @@
continue;
}
+ area++;
+
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
Rast_set_c_null_value(&supCell, 1);
@@ -432,10 +430,6 @@
if (masked && (mask_buf[j] == 0)) {
Rast_set_d_null_value(&corrCell, 1);
}
- else {
- /* total landscape area */
- area++;
- }
if (Rast_is_d_null_value(&corrCell)) {
connected = 0;
@@ -443,6 +437,8 @@
continue;
}
+ area++;
+
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
Rast_set_d_null_value(&supCell, 1);
@@ -657,10 +653,6 @@
if (masked && (mask_buf[j] == 0)) {
Rast_set_f_null_value(&corrCell, 1);
}
- else {
- /* total landscape area */
- area++;
- }
if (Rast_is_f_null_value(&corrCell)) {
connected = 0;
@@ -668,6 +660,8 @@
continue;
}
+ area++;
+
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
Rast_set_f_null_value(&supCell, 1);
Modified: grass/branches/releasebranch_7_0/raster/r.li/r.li.shape/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.li/r.li.shape/main.c 2014-11-03 19:57:42 UTC (rev 62583)
+++ grass/branches/releasebranch_7_0/raster/r.li/r.li.shape/main.c 2014-11-03 19:57:58 UTC (rev 62584)
@@ -112,7 +112,7 @@
{
CELL *buf, *buf_sup, *buf_null;
CELL corrCell, precCell, supCell;
- long npatch, area;
+ long npatch;
long pid, old_pid, new_pid, *pid_corr, *pid_sup, *ltmp;
struct pst *pst;
long nalloc, incr;
@@ -158,7 +158,6 @@
/* calculate number of patches */
npatch = 0;
- area = 0;
pid = 0;
/* patch size and type */
@@ -204,10 +203,6 @@
if (masked && (mask_buf[j] == 0)) {
Rast_set_c_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
@@ -351,7 +346,7 @@
{
DCELL *buf, *buf_sup, *buf_null;
DCELL corrCell, precCell, supCell;
- long npatch, area;
+ long npatch;
long pid, old_pid, new_pid, *pid_corr, *pid_sup, *ltmp;
struct pst *pst;
long nalloc, incr;
@@ -397,7 +392,6 @@
/* calculate number of patches */
npatch = 0;
- area = 0;
pid = 0;
/* patch size and type */
@@ -443,10 +437,6 @@
if (masked && (mask_buf[j] == 0)) {
Rast_set_d_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
@@ -590,7 +580,7 @@
{
FCELL *buf, *buf_sup, *buf_null;
FCELL corrCell, precCell, supCell;
- long npatch, area;
+ long npatch;
long pid, old_pid, new_pid, *pid_corr, *pid_sup, *ltmp;
struct pst *pst;
long nalloc, incr;
@@ -636,7 +626,6 @@
/* calculate number of patches */
npatch = 0;
- area = 0;
pid = 0;
/* patch size and type */
@@ -682,10 +671,6 @@
if (masked && (mask_buf[j] == 0)) {
Rast_set_f_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
More information about the grass-commit
mailing list