GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73574
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
double DCELL
Definition: gis.h:581
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
int Rast_is_d_null_value(const DCELL *dcellVal)
To check if a DCELL raster value is set to NULL.
Definition: null_val.c:261