GRASS 8 Programmer's Manual
8.6.0dev(2026)-ddeab64dbf
Loading...
Searching...
No Matches
c_range.c
Go to the documentation of this file.
1
#include <
grass/gis.h
>
2
#include <
grass/raster.h
>
3
4
void
c_range
(
DCELL
*result,
DCELL
*values,
int
n,
const
void
*closure
UNUSED
)
5
{
6
DCELL
min
,
max
;
7
int
i;
8
9
Rast_set_d_null_value
(&
min
, 1);
10
Rast_set_d_null_value
(&
max
, 1);
11
12
for
(i = 0; i < n; i++) {
13
if
(
Rast_is_d_null_value
(&values[i]))
14
continue
;
15
16
if
(
Rast_is_d_null_value
(&
min
) ||
min
> values[i])
17
min
= values[i];
18
19
if
(
Rast_is_d_null_value
(&
max
) ||
max
< values[i])
20
max
= values[i];
21
}
22
23
if
(
Rast_is_d_null_value
(&
min
) ||
Rast_is_d_null_value
(&
max
))
24
Rast_set_d_null_value
(result, 1);
25
else
26
*result =
max
-
min
;
27
}
Rast_set_d_null_value
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
Definition
null_val.c:153
Rast_is_d_null_value
#define Rast_is_d_null_value(dcellVal)
Definition
defs/raster.h:417
c_range
stat_func c_range
min
#define min(x, y)
Definition
draw2.c:29
max
#define max(x, y)
Definition
draw2.c:30
gis.h
DCELL
double DCELL
Definition
gis.h:635
UNUSED
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition
gis.h:46
raster.h
lib
stats
c_range.c
Generated on Sun Apr 5 2026 06:59:59 for GRASS 8 Programmer's Manual by
1.9.8