GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71793
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
c_stddev.c
Go to the documentation of this file.
1 #include <math.h>
2 
3 #include <grass/gis.h>
4 #include <grass/raster.h>
5 #include <grass/stats.h>
6 
7 void c_stddev(DCELL * result, DCELL * values, int n, const void *closure)
8 {
9  DCELL var;
10 
11  c_var(&var, values, n, closure);
12 
13  if (Rast_is_d_null_value(&var))
14  Rast_set_d_null_value(result, 1);
15  else
16  *result = sqrt(var);
17 }
18 
19 void w_stddev(DCELL * result, DCELL(*values)[2], int n, const void *closure)
20 {
21  DCELL var;
22 
23  w_var(&var, values, n, closure);
24 
25  if (Rast_is_d_null_value(&var))
26  Rast_set_d_null_value(result, 1);
27  else
28  *result = sqrt(var);
29 }
void w_var(DCELL *result, DCELL(*values)[2], int n, const void *closure)
Definition: c_var.c:43
void c_var(DCELL *result, DCELL *values, int n, const void *closure)
Definition: c_var.c:4
double DCELL
Definition: gis.h:581
void w_stddev(DCELL *result, DCELL(*values)[2], int n, const void *closure)
Definition: c_stddev.c:19
void c_stddev(DCELL *result, DCELL *values, int n, const void *closure)
Definition: c_stddev.c:7
void Rast_set_d_null_value(DCELL *dcellVals, int numVals)
To set a number of DCELL raster values to NULL.
Definition: null_val.c:155
float var(IClass_statistics *statistics, int band1, int band2)
Helper function for computing variance.
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