GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
raster.h
Go to the documentation of this file.
1
#ifndef GRASS_RASTER_H
2
#define GRASS_RASTER_H
3
4
#include <
grass/gis.h
>
5
6
/*** defines ***/
7
#define RECLASS_TABLE 1
8
#define RECLASS_RULES 2
9
#define RECLASS_SCALE 3
10
11
#define CELL_TYPE 0
12
#define FCELL_TYPE 1
13
#define DCELL_TYPE 2
14
15
/*! \brief Interpolation methods
16
17
For G_get_raster_sample(), INTERP_TYPE
18
*/
19
#define INTERP_UNKNOWN 0
20
#define INTERP_NEAREST 1
/* nearest neighbor interpolation */
21
#define INTERP_BILINEAR 2
/* bilinear interpolation */
22
#define INTERP_BICUBIC 3
/* bicubic interpolation */
23
24
/*** typedefs ***/
25
typedef
int
RASTER_MAP_TYPE
;
26
27
/* for G_get_raster_sample() */
28
typedef
int
INTERP_TYPE
;
29
30
/*** structures ***/
31
struct
Reclass
32
{
33
char
*
name
;
/* name of raster map being reclassed */
34
char
*
mapset
;
/* mapset in which "name" is found */
35
int
type
;
/* type of reclass */
36
int
num
;
/* size of reclass table */
37
CELL
min
;
/* table min */
38
CELL
max
;
/* table max */
39
CELL
*
table
;
/* reclass table */
40
};
41
42
struct
FPReclass_table
43
{
44
DCELL
dLow
;
/* domain low */
45
DCELL
dHigh
;
/* domain high */
46
DCELL
rLow
;
/* range low */
47
DCELL
rHigh
;
/* range high */
48
};
49
50
/* reclass structure from double to double used by r.recode to reclass */
51
/* between types: int to double, float to int,... */
52
struct
FPReclass
53
{
54
int
defaultDRuleSet
;
/* 1 if default domain rule set */
55
int
defaultRRuleSet
;
/* 1 if default range rule set */
56
int
infiniteLeftSet
;
/* 1 if negative infinite interval rule exists */
57
int
infiniteRightSet
;
/* 1 if positive infinite interval rule exists */
58
int
rRangeSet
;
/* 1 if range range (i.e. interval) is set */
59
int
maxNofRules
;
60
int
nofRules
;
61
DCELL
defaultDMin
;
/* default domain minimum value */
62
DCELL
defaultDMax
;
/* default domain maximum value */
63
DCELL
defaultRMin
;
/* default range minimum value */
64
DCELL
defaultRMax
;
/* default range maximum value */
65
DCELL
infiniteDLeft
;
/* neg infinite rule */
66
DCELL
infiniteDRight
;
/* neg infinite rule */
67
DCELL
infiniteRLeft
;
/* pos infinite rule */
68
DCELL
infiniteRRight
;
/* pos infinite rule */
69
DCELL
dMin
;
/* minimum domain values in rules */
70
DCELL
dMax
;
/* maximum domain values in rules */
71
DCELL
rMin
;
/* minimum range values in rules */
72
DCELL
rMax
;
/* maximum range values in rules */
73
struct
FPReclass_table
*
table
;
74
};
75
76
struct
Quant_table
77
{
78
DCELL
dLow
;
79
DCELL
dHigh
;
80
CELL
cLow
;
81
CELL
cHigh
;
82
};
83
84
struct
Quant
85
{
86
int
truncate_only
;
87
int
round_only
;
88
int
defaultDRuleSet
;
89
int
defaultCRuleSet
;
90
int
infiniteLeftSet
;
91
int
infiniteRightSet
;
92
int
cRangeSet
;
93
int
maxNofRules
;
94
int
nofRules
;
95
DCELL
defaultDMin
;
96
DCELL
defaultDMax
;
97
CELL
defaultCMin
;
98
CELL
defaultCMax
;
99
DCELL
infiniteDLeft
;
100
DCELL
infiniteDRight
;
101
CELL
infiniteCLeft
;
102
CELL
infiniteCRight
;
103
DCELL
dMin
;
104
DCELL
dMax
;
105
CELL
cMin
;
106
CELL
cMax
;
107
struct
Quant_table
*
table
;
108
109
struct
110
{
111
DCELL
*
vals
;
112
113
/* pointers to quant rules corresponding to the intervals btwn vals */
114
struct
Quant_table
**
rules
;
115
int
nalloc
;
116
int
active
;
117
DCELL
inf_dmin
;
118
DCELL
inf_dmax
;
119
CELL
inf_min
;
120
CELL
inf_max
;
121
/* all values smaller than inf_dmin become inf_min */
122
/* all values larger than inf_dmax become inf_max */
123
/* inf_min and/or inf_max can be NULL if there are no inf rules */
124
} fp_lookup;
125
};
126
127
struct
Categories
128
{
129
CELL
ncats
;
/* total number of categories */
130
CELL
num
;
/* the highest cell values. Only exists
131
for backwards compatibility = (CELL)
132
max_fp_values in quant rules */
133
char
*
title
;
/* name of data layer */
134
char
*
fmt
;
/* printf-like format to generate labels */
135
float
m1
;
/* Multiplication coefficient 1 */
136
float
a1
;
/* Addition coefficient 1 */
137
float
m2
;
/* Multiplication coefficient 2 */
138
float
a2
;
/* Addition coefficient 2 */
139
struct
Quant
q;
/* rules mapping cell values to index in
140
list of labels */
141
char
**
labels
;
/* array of labels of size num */
142
int
*
marks
;
/* was the value with this label was used? */
143
int
nalloc
;
144
int
last_marked_rule
;
145
/* NOTE: to get a rule corresponfing to cats.labels[i], use */
146
/* G_get_ith_c/f/d_raster_cat (pcats, i, val1, val2) */
147
/* it calls */
148
/* G_quant_get_ith_rule(&cats->q, i, val1, val2, &index, &index); */
149
/* and idex ==i, because rule is added at the same time as a */
150
/* label, and quant rules are never reordered. Olga apr,95 */
151
};
152
153
/*! \brief Raster history info (metadata)
154
155
See History structure for implementation issues.
156
*/
157
enum
History_field
158
{
159
/*! \brief Raster name */
160
HIST_MAPID
,
161
/*! \brief Raster title */
162
HIST_TITLE
,
163
/*! \brief Raster mapset */
164
HIST_MAPSET
,
165
/*! \brief User who creater raster map */
166
HIST_CREATOR
,
167
/*! \brief Map type ("raster", "reclass", "GDAL-link", or "virtual") */
168
HIST_MAPTYPE
,
169
/*! \brief Description of original data source (two lines) */
170
HIST_DATSRC_1
,
171
HIST_DATSRC_2
,
172
/*! \brief One-line data description */
173
HIST_KEYWRD
,
174
175
/*! \brief Number of fields to be defined in History structure */
176
HIST_NUM_FIELDS
177
};
178
179
/*! \brief Raster history info (metadata) */
180
struct
History
181
{
182
/*! \brief Array of fields (see \ref History_field for details) */
183
char
*fields[
HIST_NUM_FIELDS
];
184
/*! \brief Number of lines in lines array */
185
int
nlines
;
186
/*! \brief Lines array */
187
char
**
lines
;
188
};
189
190
struct
Cell_stats
191
{
192
struct
Cell_stats_node
193
{
194
int
idx
;
195
long
*
count
;
196
int
left
;
197
int
right
;
198
} *node;
/* tree of values */
199
200
int
tlen
;
/* allocated tree size */
201
int
N
;
/* number of actual nodes in tree */
202
int
curp
;
203
long
null_data_count
;
204
int
curoffset
;
205
};
206
207
struct
Histogram
208
{
209
int
num
;
210
211
struct
Histogram_list
212
{
213
CELL
cat
;
214
long
count
;
215
} *
list
;
216
};
217
218
struct
R_stats
219
{
220
DCELL
sum
;
221
DCELL
sumsq
;
222
grass_int64
count
;
223
};
224
225
struct
Range
226
{
227
CELL
min
;
228
CELL
max
;
229
int
first_time
;
/* whether or not range was updated */
230
struct
R_stats
rstats;
231
};
232
233
struct
FPRange
234
{
235
DCELL
min
;
236
DCELL
max
;
237
int
first_time
;
/* whether or not range was updated */
238
struct
R_stats
rstats;
239
};
240
241
struct
FP_stats
{
242
int
geometric
;
243
int
geom_abs
;
244
int
flip
;
245
int
count
;
246
DCELL
min
,
max
;
247
unsigned
long
*
stats
;
248
unsigned
long
total
;
249
};
250
251
struct
GDAL_link
;
252
struct
R_vrt
;
253
254
/*** prototypes ***/
255
#include <
grass/defs/raster.h
>
256
257
#endif
/* GRASS_RASTER_H */
FP_stats::count
int count
Definition:
raster.h:245
FPReclass_table::rHigh
DCELL rHigh
Definition:
raster.h:47
FPRange::min
DCELL min
Definition:
raster.h:235
FPReclass::maxNofRules
int maxNofRules
Definition:
raster.h:59
Categories::m2
float m2
Definition:
raster.h:137
Reclass::name
char * name
Definition:
raster.h:33
FPReclass::defaultDMax
DCELL defaultDMax
Definition:
raster.h:62
Categories::a1
float a1
Definition:
raster.h:136
HIST_CREATOR
User who creater raster map.
Definition:
raster.h:166
Quant::inf_dmax
DCELL inf_dmax
Definition:
raster.h:118
HIST_MAPTYPE
Map type ("raster", "reclass", "GDAL-link", or "virtual")
Definition:
raster.h:168
FPReclass::defaultDRuleSet
int defaultDRuleSet
Definition:
raster.h:54
R_stats::count
grass_int64 count
Definition:
raster.h:222
Reclass::min
CELL min
Definition:
raster.h:37
FPReclass::infiniteRightSet
int infiniteRightSet
Definition:
raster.h:57
Cell_stats::null_data_count
long null_data_count
Definition:
raster.h:203
Cell_stats::Cell_stats_node::right
int right
Definition:
raster.h:197
FPReclass::defaultRRuleSet
int defaultRRuleSet
Definition:
raster.h:55
Quant::defaultCMax
CELL defaultCMax
Definition:
raster.h:98
DCELL
double DCELL
Definition:
gis.h:614
Range::first_time
int first_time
Definition:
raster.h:229
Range::max
CELL max
Definition:
raster.h:228
FPReclass::rRangeSet
int rRangeSet
Definition:
raster.h:58
Reclass::max
CELL max
Definition:
raster.h:38
FPReclass_table
Definition:
raster.h:42
Cell_stats::Cell_stats_node::idx
int idx
Definition:
raster.h:194
FPReclass::infiniteDRight
DCELL infiniteDRight
Definition:
raster.h:66
Cell_stats::N
int N
Definition:
raster.h:201
FPReclass::rMin
DCELL rMin
Definition:
raster.h:71
Cell_stats::curp
int curp
Definition:
raster.h:202
Quant::inf_max
CELL inf_max
Definition:
raster.h:120
FP_stats::geometric
int geometric
Definition:
raster.h:242
Categories::marks
int * marks
Definition:
raster.h:142
Quant_table::dHigh
DCELL dHigh
Definition:
raster.h:79
FPReclass::defaultRMin
DCELL defaultRMin
Definition:
raster.h:63
GDAL_link
Definition:
R.h:19
Quant::maxNofRules
int maxNofRules
Definition:
raster.h:93
HIST_MAPID
Raster name.
Definition:
raster.h:160
HIST_DATSRC_2
Definition:
raster.h:171
Quant::infiniteRightSet
int infiniteRightSet
Definition:
raster.h:91
Cell_stats::Cell_stats_node::count
long * count
Definition:
raster.h:195
Quant::truncate_only
int truncate_only
Definition:
raster.h:86
gis.h
Quant::infiniteLeftSet
int infiniteLeftSet
Definition:
raster.h:90
Quant::inf_dmin
DCELL inf_dmin
Definition:
raster.h:117
Cell_stats
Definition:
raster.h:190
Quant::cMin
CELL cMin
Definition:
raster.h:105
FPRange::first_time
int first_time
Definition:
raster.h:237
Reclass
Definition:
raster.h:31
FP_stats::geom_abs
int geom_abs
Definition:
raster.h:243
HIST_KEYWRD
One-line data description.
Definition:
raster.h:173
Range::min
CELL min
Definition:
raster.h:227
Quant::active
int active
Definition:
raster.h:116
FPRange::max
DCELL max
Definition:
raster.h:236
Quant_table::cLow
CELL cLow
Definition:
raster.h:80
Quant::cRangeSet
int cRangeSet
Definition:
raster.h:92
grass_int64
int64_t grass_int64
Definition:
gis.h:620
FPReclass::infiniteDLeft
DCELL infiniteDLeft
Definition:
raster.h:65
Quant::table
struct Quant_table * table
Definition:
raster.h:107
Quant
Definition:
raster.h:84
Quant_table::dLow
DCELL dLow
Definition:
raster.h:78
Categories::num
CELL num
Definition:
raster.h:130
Cell_stats::Cell_stats_node
Definition:
raster.h:192
FPRange
Definition:
raster.h:233
FPReclass
Definition:
raster.h:52
list
struct list * list
Definition:
read_list.c:24
Quant::dMax
DCELL dMax
Definition:
raster.h:104
Quant::vals
DCELL * vals
Definition:
raster.h:111
Quant::cMax
CELL cMax
Definition:
raster.h:106
Categories::title
char * title
Definition:
raster.h:133
Quant::infiniteDLeft
DCELL infiniteDLeft
Definition:
raster.h:99
Quant_table
Definition:
raster.h:76
Quant::rules
struct Quant_table ** rules
Definition:
raster.h:114
Categories::fmt
char * fmt
Definition:
raster.h:134
FP_stats::flip
int flip
Definition:
raster.h:244
History
Raster history info (metadata)
Definition:
raster.h:180
HIST_DATSRC_1
Description of original data source (two lines)
Definition:
raster.h:170
raster.h
FPReclass_table::dLow
DCELL dLow
Definition:
raster.h:44
FPReclass::nofRules
int nofRules
Definition:
raster.h:60
Quant::nalloc
int nalloc
Definition:
raster.h:115
Quant::defaultDMin
DCELL defaultDMin
Definition:
raster.h:95
FPReclass::infiniteRRight
DCELL infiniteRRight
Definition:
raster.h:68
HIST_MAPSET
Raster mapset.
Definition:
raster.h:164
FPReclass::dMin
DCELL dMin
Definition:
raster.h:69
FPReclass::defaultRMax
DCELL defaultRMax
Definition:
raster.h:64
Quant::defaultCMin
CELL defaultCMin
Definition:
raster.h:97
FP_stats
Definition:
raster.h:241
FP_stats::stats
unsigned long * stats
Definition:
raster.h:247
FP_stats::total
unsigned long total
Definition:
raster.h:248
FPReclass_table::rLow
DCELL rLow
Definition:
raster.h:46
Range
Definition:
raster.h:225
Quant::inf_min
CELL inf_min
Definition:
raster.h:119
Quant::infiniteDRight
DCELL infiniteDRight
Definition:
raster.h:100
Categories::ncats
CELL ncats
Definition:
raster.h:129
FPReclass::dMax
DCELL dMax
Definition:
raster.h:70
R_vrt
Definition:
R.h:47
Categories::m1
float m1
Definition:
raster.h:135
INTERP_TYPE
int INTERP_TYPE
Definition:
raster.h:28
History_field
History_field
Raster history info (metadata)
Definition:
raster.h:157
Categories::labels
char ** labels
Definition:
raster.h:141
Categories::last_marked_rule
int last_marked_rule
Definition:
raster.h:144
Quant::defaultDMax
DCELL defaultDMax
Definition:
raster.h:96
R_stats
Definition:
raster.h:218
CELL
int CELL
Definition:
gis.h:613
Quant::round_only
int round_only
Definition:
raster.h:87
FPReclass::infiniteRLeft
DCELL infiniteRLeft
Definition:
raster.h:67
RASTER_MAP_TYPE
int RASTER_MAP_TYPE
Definition:
raster.h:25
Reclass::num
int num
Definition:
raster.h:36
FP_stats::min
DCELL min
Definition:
raster.h:246
R_stats::sumsq
DCELL sumsq
Definition:
raster.h:221
FPReclass::table
struct FPReclass_table * table
Definition:
raster.h:73
History::nlines
int nlines
Number of lines in lines array.
Definition:
raster.h:185
History::lines
char ** lines
Lines array.
Definition:
raster.h:187
Cell_stats::curoffset
int curoffset
Definition:
raster.h:204
FPReclass::defaultDMin
DCELL defaultDMin
Definition:
raster.h:61
FPReclass::rMax
DCELL rMax
Definition:
raster.h:72
Cell_stats::tlen
int tlen
Definition:
raster.h:200
Histogram::num
int num
Definition:
raster.h:209
Quant::defaultCRuleSet
int defaultCRuleSet
Definition:
raster.h:89
FPReclass_table::dHigh
DCELL dHigh
Definition:
raster.h:45
Histogram
Definition:
raster.h:207
Quant::defaultDRuleSet
int defaultDRuleSet
Definition:
raster.h:88
Reclass::mapset
char * mapset
Definition:
raster.h:34
HIST_NUM_FIELDS
Number of fields to be defined in History structure.
Definition:
raster.h:176
Quant_table::cHigh
CELL cHigh
Definition:
raster.h:81
HIST_TITLE
Raster title.
Definition:
raster.h:162
Quant::nofRules
int nofRules
Definition:
raster.h:94
Categories::nalloc
int nalloc
Definition:
raster.h:143
Quant::infiniteCLeft
CELL infiniteCLeft
Definition:
raster.h:101
Cell_stats::Cell_stats_node::left
int left
Definition:
raster.h:196
Reclass::type
int type
Definition:
raster.h:35
Histogram::Histogram_list::count
long count
Definition:
raster.h:214
R_stats::sum
DCELL sum
Definition:
raster.h:220
Quant::dMin
DCELL dMin
Definition:
raster.h:103
Quant::infiniteCRight
CELL infiniteCRight
Definition:
raster.h:102
Histogram::Histogram_list
Definition:
raster.h:211
Histogram::Histogram_list::cat
CELL cat
Definition:
raster.h:213
Categories
Definition:
raster.h:127
FPReclass::infiniteLeftSet
int infiniteLeftSet
Definition:
raster.h:56
Reclass::table
CELL * table
Definition:
raster.h:39
Categories::a2
float a2
Definition:
raster.h:138
include
grass
raster.h
Generated on Tue Feb 14 2023 05:56:01 for GRASS GIS 8 Programmer's Manual by
1.8.13