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