GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-cb7cbab7e7
|
Raster Library - Quantization rules (read/write). More...
Go to the source code of this file.
Functions | |
void | Rast_truncate_fp_map (const char *name, const char *mapset) |
Writes the quant rules. More... | |
void | Rast_round_fp_map (const char *name, const char *mapset) |
Writes the quant rules. More... | |
void | Rast_quantize_fp_map (const char *name, const char *mapset, CELL min, CELL max) |
Write quant rules (f_quant) for floating-point raster map. More... | |
void | Rast_quantize_fp_map_range (const char *name, const char *mapset, DCELL d_min, DCELL d_max, CELL min, CELL max) |
Write quant rules (f_quant) for floating-point raster map. More... | |
void | Rast_write_quant (const char *name, const char *mapset, const struct Quant *quant) |
Writes the quant rule table for the raster map. More... | |
int | Rast_read_quant (const char *name, const char *mapset, struct Quant *quant) |
Reads quantization rules for name in mapset and stores them in the quantization structure. If the map is in another mapset, first checks for quant2 table for this map in current mapset. More... | |
Raster Library - Quantization rules (read/write).
(C) 1999-2009 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file quant_rw.c.
Write quant rules (f_quant) for floating-point raster map.
Writes the f_quant
file for the raster map name with one rule. The rule is generated using the floating-point range in f_range
producing the integer range [cmin,cmax].
Make a rule for map <name> that maps floating range (d_min, d_max) into integer range (min, max) This function is useful when the quant rule doesn't depend of the range of produced float data, for example the slope map would want to have a quant rule: 0.0, 90.0 -> 0 , 90 no matter what the min and max slope of this map is.
name | map name |
mapset | mapset name |
cmin | minimum value |
cmax | maximum value |
Definition at line 81 of file quant_rw.c.
References _, G_fatal_error(), G_fully_qualified_name(), max, min, name, Rast_get_fp_range_min_max(), Rast_is_d_null_value, Rast_quantize_fp_map_range(), and Rast_read_fp_range().
void Rast_quantize_fp_map_range | ( | const char * | name, |
const char * | mapset, | ||
DCELL | d_min, | ||
DCELL | d_max, | ||
CELL | min, | ||
CELL | max | ||
) |
Write quant rules (f_quant) for floating-point raster map.
Writes the f_quant
file for the raster map name with one rule. The rule is generated using the floating-point range [dmin,dmax] and the integer range [min,max]. This routine differs from the one above in that the application controls the floating-point range. For example, r.slope.aspect will use this routine to quantize the slope map from [0.0, 90.0] to [0, 90] even if the range of slopes is not 0-90. The aspect map would be quantized from [0.0, 360.0] to [0, 360].
Make a rule for map <name> that maps floating range (d_min, d_max) into integer range (min, max) This function is useful when the quant rule doesn't depend of the range of produced float data, for example the slope map would want to have a quant rule: 0.0, 90.0 -> 0 , 90 no matter what the min and max slope of this map is.
name | map name |
mapset | mapset name |
d_min | minimum fp value |
d_max | maximum fp value |
min | minimum value |
max | maximum value |
Definition at line 124 of file quant_rw.c.
References max, min, name, Rast_quant_add_rule(), Rast_quant_init(), and Rast_write_quant().
Referenced by Rast_quantize_fp_map().
int Rast_read_quant | ( | const char * | name, |
const char * | mapset, | ||
struct Quant * | quant | ||
) |
Reads quantization rules for name in mapset and stores them in the quantization structure. If the map is in another mapset, first checks for quant2 table for this map in current mapset.
name | |
mapset | |
q |
Definition at line 187 of file quant_rw.c.
References name, Rast__quant_import(), and Rast_quant_init().
Referenced by Rast_read_range().
void Rast_round_fp_map | ( | const char * | name, |
const char * | mapset | ||
) |
Writes the quant rules.
Writes the quant rules which indicate that all floating numbers should be rounded instead of applying any quant rules from floats to integers.
name | map name |
mapset | mapset name |
Definition at line 51 of file quant_rw.c.
References name, Rast_quant_init(), Rast_quant_round(), and Rast_write_quant().
void Rast_truncate_fp_map | ( | const char * | name, |
const char * | mapset | ||
) |
Writes the quant rules.
Writes the quant rules which indicate that all floating numbers should be truncated instead of applying any quant rules from floats to integers.
name | map name |
mapset | mapset name |
Definition at line 31 of file quant_rw.c.
References name, Rast_quant_init(), Rast_quant_truncate(), and Rast_write_quant().
void Rast_write_quant | ( | const char * | name, |
const char * | mapset, | ||
const struct Quant * | quant | ||
) |
Writes the quant rule table for the raster map.
Writes the f_quant
file for the raster map name from q. if mapset==G_mapset() i.e. the map is in current mapset, then the original quant file in cell_misc/map/f_quant is written. Otherwise q is written into quant2/mapset/name (much like colr2 element). This results in map@mapset being read using quant rules stored in q from G_mapset(). See Rast_read_quant() for detailes.
name | map name |
mapset | mapset name |
quant | pointer to Quant structure which hold quant rules info |
Definition at line 150 of file quant_rw.c.
References _, CELL_TYPE, G_fatal_error(), G_warning(), name, Rast__quant_export(), Rast_map_type(), and Rast_quant_get_limits().
Referenced by Rast_quantize_fp_map_range(), Rast_round_fp_map(), and Rast_truncate_fp_map().