GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-8cbe8fef7c
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 UNUSED)
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,
19  const void *closure UNUSED)
20 {
21  DCELL count;
22  int i;
23 
24  count = 0.0;
25 
26  for (i = 0; i < n; i++)
27  if (!Rast_is_d_null_value(&values[i][0]))
28  count += values[i][1];
29 
30  *result = count;
31 }
void c_count(DCELL *result, DCELL *values, int n, const void *closure UNUSED)
Definition: c_count.c:4
void w_count(DCELL *result, DCELL(*values)[2], int n, const void *closure UNUSED)
Definition: c_count.c:18
#define Rast_is_d_null_value(dcellVal)
Definition: defs/raster.h:405
double DCELL
Definition: gis.h:626
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition: gis.h:47
int count