GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
c_count.c
Go to the documentation of this file.
1 #include <grass/gis.h>
2 #include <grass/raster.h>
3 
4 void c_count(DCELL * result, DCELL * values, int n, const void *closure)
5 {
6  int count;
7  int i;
8 
9  count = 0;
10 
11  for (i = 0; i < n; i++)
12  if (!Rast_is_d_null_value(&values[i]))
13  count++;
14 
15  *result = count;
16 }
17 
18 void w_count(DCELL * result, DCELL(*values)[2], int n, const void *closure)
19 {
20  DCELL count;
21  int i;
22 
23  count = 0.0;
24 
25  for (i = 0; i < n; i++)
26  if (!Rast_is_d_null_value(&values[i][0]))
27  count += values[i][1];
28 
29  *result = count;
30 }
#define Rast_is_d_null_value(dcellVal)
Definition: defs/raster.h:414
double DCELL
Definition: gis.h:614
int count
void w_count(DCELL *result, DCELL(*values)[2], int n, const void *closure)
Definition: c_count.c:18
void c_count(DCELL *result, DCELL *values, int n, const void *closure)
Definition: c_count.c:4