quant_rw.c File Reference

#include <grass/gis.h>
#include <grass/glocale.h>
#include <string.h>

Include dependency graph for quant_rw.c:

Go to the source code of this file.

Functions

int G_truncate_fp_map (char *name, char *mapset)
int G_round_fp_map (char *name, char *mapset)
int G_quantize_fp_map (char *name, char *mapset, CELL min, CELL max)
 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].
int G_quantize_fp_map_range (char *name, char *mapset, DCELL d_min, DCELL d_max, CELL min, CELL max)
 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].
int G_write_quant (char *name, char *mapset, struct Quant *quant)
 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 being read using quant rules stored in q from G_mapset(). See G_read_quant() for detailes.
int G_read_quant (char *name, char *mapset, struct Quant *quant)
 reads quantization rules for "name" in "mapset" and stores them in the quantization structure "quant". If the map is in another mapset, first checks for quant2 table for this map in current mapset. Return codes: -2 if raster map is of type integer -1 if (! G__name_is_fully_qualified ()) 0 if quantization file does not exist, or the file is empty or has wrong format. 1 if non-empty quantization file exists.


Function Documentation

int G_quantize_fp_map ( char *  name,
char *  mapset,
CELL  min,
CELL  max 
)

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].

Parameters:
name 
cmin 
cmax 
Returns:
int

Definition at line 111 of file quant_rw.c.

References G_get_fp_range_min_max(), G_is_d_null_value(), G_quantize_fp_map_range(), G_read_fp_range(), and G_warning().

int G_quantize_fp_map_range ( char *  name,
char *  mapset,
DCELL  d_min,
DCELL  d_max,
CELL  min,
CELL  max 
)

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].

Parameters:
name 
dmin 
dmax 
cmin 
cmax 
Returns:
int

Definition at line 159 of file quant_rw.c.

References G_quant_add_rule(), G_quant_init(), G_warning(), and G_write_quant().

Referenced by G_quantize_fp_map().

int G_read_quant ( char *  name,
char *  mapset,
struct Quant *  quant 
)

reads quantization rules for "name" in "mapset" and stores them in the quantization structure "quant". If the map is in another mapset, first checks for quant2 table for this map in current mapset. Return codes: -2 if raster map is of type integer -1 if (! G__name_is_fully_qualified ()) 0 if quantization file does not exist, or the file is empty or has wrong format. 1 if non-empty quantization file exists.

Parameters:
name 
mapset 
q 
Returns:
int

Definition at line 248 of file quant_rw.c.

References G__quant_import(), and G_quant_init().

Referenced by G__open_cell_old(), and G_read_range().

int G_round_fp_map ( char *  name,
char *  mapset 
)

Definition at line 80 of file quant_rw.c.

References G_quant_init(), G_quant_round(), G_warning(), and G_write_quant().

int G_truncate_fp_map ( char *  name,
char *  mapset 
)

Definition at line 64 of file quant_rw.c.

References G_quant_init(), G_quant_truncate(), G_warning(), and G_write_quant().

int G_write_quant ( char *  name,
char *  mapset,
struct Quant *  quant 
)

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 being read using quant rules stored in q from G_mapset(). See G_read_quant() for detailes.

Parameters:
name 
mapset 
q 
Returns:
int

Definition at line 198 of file quant_rw.c.

References G__quant_export(), G_quant_get_limits(), G_raster_map_type(), and G_warning().

Referenced by G_quantize_fp_map_range(), G_round_fp_map(), and G_truncate_fp_map().


Generated on Sun Apr 6 17:32:24 2008 for GRASS by  doxygen 1.5.5