GRASS 8 Programmer's Manual 8.5.0RC1(2026)-3334b87d9c
Loading...
Searching...
No Matches
c_max.c
Go to the documentation of this file.
1#include <grass/gis.h>
2#include <grass/raster.h>
3
4void c_max(DCELL *result, DCELL *values, int n, const void *closure G_UNUSED)
5{
6 DCELL max;
7 int i;
8
9 Rast_set_d_null_value(&max, 1);
10
11 for (i = 0; i < n; i++) {
12 if (Rast_is_d_null_value(&values[i]))
13 continue;
14
15 if (Rast_is_d_null_value(&max) || max < values[i])
16 max = values[i];
17 }
18
19 if (Rast_is_d_null_value(&max))
20 Rast_set_d_null_value(result, 1);
21 else
22 *result = max;
23}
24
25void w_max(DCELL *result, DCELL (*values)[2], int n,
26 const void *closure G_UNUSED)
27{
28 DCELL max;
29 int i;
30
31 Rast_set_d_null_value(&max, 1);
32
33 for (i = 0; i < n; i++) {
34 if (Rast_is_d_null_value(&values[i][0]))
35 continue;
36
37 if (Rast_is_d_null_value(&max) || max < values[i][0])
38 max = values[i][0];
39 }
40
41 if (Rast_is_d_null_value(&max))
42 Rast_set_d_null_value(result, 1);
43 else
44 *result = max;
45}
void c_max(DCELL *result, DCELL *values, int n, const void *closure)
Definition c_max.c:4
void w_max(DCELL *result, DCELL(*values)[2], int n, const void *closure)
Definition c_max.c:25
#define max(a, b)