GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
#include <grass/gis.h>
Go to the source code of this file.
Macros | |
#define | Rast_is_c_null_value(cellVal) (*(const CELL *)(cellVal) == (CELL) 0x80000000) |
#define | Rast_is_f_null_value(fcellVal) (*(const FCELL *)(fcellVal) != *(const FCELL *)(fcellVal)) |
#define | Rast_is_d_null_value(dcellVal) (*(const DCELL *)(dcellVal) != *(const DCELL *)(dcellVal)) |
Typedefs | |
typedef int | read_rule_fn(void *, DCELL, DCELL, DCELL *, int *, int *, int *, int *, int *, int *) |
Functions | |
void | Rast_align_window (struct Cell_head *, const struct Cell_head *) |
Align two regions. More... | |
size_t | Rast_cell_size (RASTER_MAP_TYPE) |
Returns size of a raster cell in bytes. More... | |
void * | Rast_allocate_buf (RASTER_MAP_TYPE) |
Allocate memory for a raster map of given type. More... | |
CELL * | Rast_allocate_c_buf (void) |
Allocate memory for a CELL type raster map. More... | |
FCELL * | Rast_allocate_f_buf (void) |
Allocates memory for a raster map of type FCELL. More... | |
DCELL * | Rast_allocate_d_buf (void) |
Allocates memory for a raster map of type DCELL. More... | |
char * | Rast_allocate_null_buf (void) |
Allocates memory for a null buffer. More... | |
unsigned char * | Rast__allocate_null_bits (int) |
Allocates memory for null bits. More... | |
int | Rast__null_bitstream_size (int) |
Determines null bitstream size. More... | |
void * | Rast_allocate_input_buf (RASTER_MAP_TYPE) |
CELL * | Rast_allocate_c_input_buf (void) |
FCELL * | Rast_allocate_f_input_buf (void) |
DCELL * | Rast_allocate_d_input_buf (void) |
char * | Rast_allocate_null_input_buf (void) |
void * | Rast_allocate_output_buf (RASTER_MAP_TYPE) |
CELL * | Rast_allocate_c_output_buf (void) |
FCELL * | Rast_allocate_f_output_buf (void) |
DCELL * | Rast_allocate_d_output_buf (void) |
char * | Rast_allocate_null_output_buf (void) |
int | Rast__check_for_auto_masking (void) |
Checks for auto masking. More... | |
void | Rast_suppress_masking (void) |
Suppresses masking. More... | |
void | Rast_unsuppress_masking (void) |
Unsuppresses masking. More... | |
int | Rast_has_band_reference (const char *, const char *) |
Check if band reference for raster map exists. More... | |
int | Rast_read_band_reference (const char *, const char *, char **, char **) |
Read raster map band reference identifier. More... | |
int | Rast_write_band_reference (const char *, const char *, const char *) |
Write raster map band reference identifier. More... | |
int | Rast_remove_band_reference (const char *) |
Remove band reference from raster map. More... | |
int | Rast_read_cats (const char *, const char *, struct Categories *) |
Read raster category file. More... | |
int | Rast_read_vector_cats (const char *, const char *, struct Categories *) |
Read vector category file. More... | |
CELL | Rast_get_max_c_cat (const char *, const char *) |
Get the max category number. More... | |
char * | Rast_get_cats_title (const struct Categories *) |
Get title from category structure struct. More... | |
char * | Rast_get_c_cat (CELL *, struct Categories *) |
Get a raster category label (CELL) More... | |
char * | Rast_get_f_cat (FCELL *, struct Categories *) |
Get a raster category label (FCELL) More... | |
char * | Rast_get_d_cat (DCELL *, struct Categories *) |
Get a raster category label (DCELL) More... | |
char * | Rast_get_cat (void *, struct Categories *, RASTER_MAP_TYPE) |
Get a raster category label. More... | |
void | Rast_unmark_cats (struct Categories *) |
Sets marks for all categories to 0. More... | |
void | Rast_mark_c_cats (const CELL *, int, struct Categories *) |
Looks up the category label for each raster value (CELL). More... | |
void | Rast_mark_f_cats (const FCELL *, int, struct Categories *) |
Looks up the category label for each raster value (FCELL). More... | |
void | Rast_mark_d_cats (const DCELL *, int, struct Categories *) |
Looks up the category label for each raster value (DCELL). More... | |
int | Rast_mark_cats (const void *, int, struct Categories *, RASTER_MAP_TYPE) |
Looks up the category label for each raster value (DCELL). More... | |
void | Rast_rewind_cats (struct Categories *) |
Rewind raster categories. More... | |
char * | Rast_get_next_marked_d_cat (struct Categories *, DCELL *, DCELL *, long *) |
Get next marked raster categories (DCELL) More... | |
char * | Rast_get_next_marked_c_cat (struct Categories *, CELL *, CELL *, long *) |
Get next marked raster categories (CELL) More... | |
char * | Rast_get_next_marked_f_cat (struct Categories *, FCELL *, FCELL *, long *) |
Get next marked raster categories (FCELL) More... | |
char * | Rast_get_next_marked_cat (struct Categories *, void *, void *, long *, RASTER_MAP_TYPE) |
Get next marked raster categories. More... | |
int | Rast_set_c_cat (const CELL *, const CELL *, const char *, struct Categories *) |
Set a raster category label (CELL) More... | |
int | Rast_set_f_cat (const FCELL *, const FCELL *, const char *, struct Categories *) |
Set a raster category label (FCELL) More... | |
int | Rast_set_d_cat (const DCELL *, const DCELL *, const char *, struct Categories *) |
Set a raster category label (DCELL) More... | |
int | Rast_set_cat (const void *, const void *, const char *, struct Categories *, RASTER_MAP_TYPE) |
Set a raster category label. More... | |
void | Rast_write_cats (const char *, struct Categories *) |
Write raster category file. More... | |
void | Rast_write_vector_cats (const char *, struct Categories *) |
Write vector category file. More... | |
char * | Rast_get_ith_d_cat (const struct Categories *, int, DCELL *, DCELL *) |
Get category description (DCELL) More... | |
char * | Rast_get_ith_f_cat (const struct Categories *, int, void *, void *) |
Get category description (FCELL) More... | |
char * | Rast_get_ith_c_cat (const struct Categories *, int, void *, void *) |
Get category description (CELL) More... | |
char * | Rast_get_ith_cat (const struct Categories *, int, void *, void *, RASTER_MAP_TYPE) |
Get category description. More... | |
void | Rast_init_cats (const char *, struct Categories *) |
Initialize category structure. More... | |
void | Rast_set_cats_title (const char *, struct Categories *) |
Set title in category structure. More... | |
void | Rast_set_cats_fmt (const char *, double, double, double, double, struct Categories *) |
Set category fmt (?) More... | |
void | Rast_free_cats (struct Categories *) |
Free category structure memory. More... | |
void | Rast_copy_cats (struct Categories *, const struct Categories *) |
Copy raster categories. More... | |
int | Rast_number_of_cats (struct Categories *) |
Get number of raster categories. More... | |
int | Rast_sort_cats (struct Categories *) |
Sort categories. More... | |
void | Rast_init_cell_stats (struct Cell_stats *) |
Initialize cell stats. More... | |
int | Rast_update_cell_stats (const CELL *, int, struct Cell_stats *) |
Add data to cell stats. More... | |
int | Rast_find_cell_stat (CELL, long *, const struct Cell_stats *) |
Random query of cell stats. More... | |
int | Rast_rewind_cell_stats (struct Cell_stats *) |
Reset/rewind cell stats. More... | |
int | Rast_next_cell_stat (CELL *, long *, struct Cell_stats *) |
Retrieve sorted cell stats. More... | |
void | Rast_get_stats_for_null_value (long *, const struct Cell_stats *) |
Get number of null values. More... | |
void | Rast_free_cell_stats (struct Cell_stats *) |
Free cell stats structure. More... | |
char * | Rast_get_cell_title (const char *, const char *) |
get raster map title More... | |
int | Rast_cell_stats_histo_eq (struct Cell_stats *, CELL, CELL, CELL, CELL, int, void(*)(CELL, CELL, CELL)) |
void | Rast_close (int) |
Close a raster map. More... | |
void | Rast_unopen (int) |
Unopen a raster map. More... | |
void | Rast__unopen_all (void) |
Unopen all raster maps. More... | |
void | Rast__close_null (int) |
void | Rast_make_ryg_colors (struct Colors *, CELL, CELL) |
Create RYG color table (integer) More... | |
void | Rast_make_ryg_fp_colors (struct Colors *, DCELL, DCELL) |
Create RYG color table (floating-point) More... | |
void | Rast_make_aspect_colors (struct Colors *, CELL, CELL) |
Make aspect colors (integer) More... | |
void | Rast_make_aspect_fp_colors (struct Colors *, DCELL, DCELL) |
Make aspect colors (floating-point) More... | |
void | Rast_make_byr_colors (struct Colors *, CELL, CELL) |
Create BYR color table (integer) More... | |
void | Rast_make_byr_fp_colors (struct Colors *, DCELL, DCELL) |
Create BYR color table (floating-point) More... | |
void | Rast_make_bgyr_colors (struct Colors *, CELL, CELL) |
Create BGYR color table (integer) More... | |
void | Rast_make_bgyr_fp_colors (struct Colors *, DCELL, DCELL) |
Create BGYR color table (floating-point) More... | |
void | Rast_make_byg_colors (struct Colors *, CELL, CELL) |
Create BYG color table (integer) More... | |
void | Rast_make_byg_fp_colors (struct Colors *, DCELL, DCELL) |
Create BYG color table (floating-point) More... | |
void | Rast_make_grey_scale_colors (struct Colors *, CELL, CELL) |
Make linear grey scale (integer) More... | |
void | Rast_make_grey_scale_fp_colors (struct Colors *, DCELL, DCELL) |
Make linear grey scale (floating-point) More... | |
void | Rast_make_gyr_colors (struct Colors *, CELL, CELL) |
Create GYR color table (integer) More... | |
void | Rast_make_gyr_fp_colors (struct Colors *, DCELL, DCELL) |
Create GYR color table (floating-point) More... | |
void | Rast_make_rainbow_colors (struct Colors *, CELL, CELL) |
Make rainbow colors (integer) More... | |
void | Rast_make_rainbow_fp_colors (struct Colors *, DCELL, DCELL) |
Make rainbow colors (floating-point) More... | |
void | Rast_make_ramp_colors (struct Colors *, CELL, CELL) |
Make color ramp (integer) More... | |
void | Rast_make_ramp_fp_colors (struct Colors *, DCELL, DCELL) |
Make color ramp (floating-point) More... | |
void | Rast_make_wave_colors (struct Colors *, CELL, CELL) |
Make color wave (integer) More... | |
void | Rast_make_wave_fp_colors (struct Colors *, DCELL, DCELL) |
Make color wave (floating-point) More... | |
void | Rast_free_colors (struct Colors *) |
Free color structure memory. More... | |
void | Rast__color_free_rules (struct _Color_Info_ *) |
Free color rules structure. More... | |
void | Rast__color_free_lookup (struct _Color_Info_ *) |
Free color rules structure. More... | |
void | Rast__color_free_fp_lookup (struct _Color_Info_ *) |
Free color rules structure. More... | |
void | Rast__color_reset (struct Colors *) |
Reset colors structure. More... | |
int | Rast_get_color (const void *, int *, int *, int *, struct Colors *, RASTER_MAP_TYPE) |
Gets color from raster map. More... | |
int | Rast_get_c_color (const CELL *, int *, int *, int *, struct Colors *) |
Gets color from raster map (CELL) More... | |
int | Rast_get_f_color (const FCELL *, int *, int *, int *, struct Colors *) |
Gets color from raster map (FCELL) More... | |
int | Rast_get_d_color (const DCELL *, int *, int *, int *, struct Colors *) |
Gets color from raster map (DCELL) More... | |
void | Rast_get_null_value_color (int *, int *, int *, const struct Colors *) |
Gets color for null value. More... | |
void | Rast_get_default_color (int *, int *, int *, const struct Colors *) |
Gets default color. More... | |
void | Rast_make_histogram_eq_colors (struct Colors *, struct Cell_stats *) |
Make histogram-stretched grey colors. More... | |
void | Rast_make_histogram_log_colors (struct Colors *, struct Cell_stats *, int, int) |
Generates histogram with normalized log transformed grey scale. More... | |
void | Rast_init_colors (struct Colors *) |
Initialize color structure. More... | |
int | Rast__insert_color_into_lookup (CELL, int, int, int, struct _Color_Info_ *) |
void | Rast_invert_colors (struct Colors *) |
void | Rast_lookup_c_colors (const CELL *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *) |
Lookup an array of colors. More... | |
void | Rast_lookup_colors (const void *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *, RASTER_MAP_TYPE) |
Lookup an array of colors. More... | |
void | Rast_lookup_f_colors (const FCELL *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *) |
Lookup an array of colors (FCELL) More... | |
void | Rast_lookup_d_colors (const DCELL *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *) |
Lookup an array of colors (DCELL) More... | |
void | Rast__lookup_colors (const void *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *, int, int, RASTER_MAP_TYPE) |
Lookup an array of colors. More... | |
void | Rast__interpolate_color_rule (DCELL, unsigned char *, unsigned char *, unsigned char *, const struct _Color_Rule_ *) |
Interpolate color rules. More... | |
void | Rast__organize_colors (struct Colors *) |
void | Rast_print_colors (struct Colors *, DCELL, DCELL, FILE *, int) |
Print color table. More... | |
void | Rast_make_random_colors (struct Colors *, CELL, CELL) |
make random colors More... | |
void | Rast_set_c_color_range (CELL, CELL, struct Colors *) |
Set color range (CELL version) More... | |
void | Rast_set_d_color_range (DCELL, DCELL, struct Colors *) |
Set color range (DCELL version) More... | |
void | Rast_get_c_color_range (CELL *, CELL *, const struct Colors *) |
Get color range values (CELL) More... | |
void | Rast_get_d_color_range (DCELL *, DCELL *, const struct Colors *) |
Get color range values (DCELL) More... | |
int | Rast_read_colors (const char *, const char *, struct Colors *) |
Read color table of raster map. More... | |
int | Rast__read_colors (const char *, const char *, const char *, struct Colors *) |
void | Rast_mark_colors_as_fp (struct Colors *) |
Mark colors as floating-point. More... | |
int | Rast_remove_colors (const char *, const char *) |
Remove color table of raster map. More... | |
void | Rast_add_d_color_rule (const DCELL *, int, int, int, const DCELL *, int, int, int, struct Colors *) |
Adds the floating-point color rule (DCELL version) More... | |
void | Rast_add_f_color_rule (const FCELL *, int, int, int, const FCELL *, int, int, int, struct Colors *) |
Adds the floating-point color rule (FCELL version) More... | |
void | Rast_add_c_color_rule (const CELL *, int, int, int, const CELL *, int, int, int, struct Colors *) |
Adds the integer color rule (CELL version) More... | |
void | Rast_add_color_rule (const void *, int, int, int, const void *, int, int, int, struct Colors *, RASTER_MAP_TYPE) |
Adds the color rule. More... | |
int | Rast_add_modular_d_color_rule (const DCELL *, int, int, int, const DCELL *, int, int, int, struct Colors *) |
Add modular floating-point color rule (DCELL version) More... | |
int | Rast_add_modular_f_color_rule (const FCELL *, int, int, int, const FCELL *, int, int, int, struct Colors *) |
Add modular floating-point color rule (FCELL version) More... | |
int | Rast_add_modular_c_color_rule (const CELL *, int, int, int, const CELL *, int, int, int, struct Colors *) |
Add modular integer color rule (CELL version) More... | |
int | Rast_add_modular_color_rule (const void *, int, int, int, const void *, int, int, int, struct Colors *, RASTER_MAP_TYPE) |
Add modular color rule. More... | |
int | Rast_colors_count (const struct Colors *) |
Get both modular and fixed rules count. More... | |
int | Rast_get_fp_color_rule (DCELL *, unsigned char *, unsigned char *, unsigned char *, DCELL *, unsigned char *, unsigned char *, unsigned char *, const struct Colors *, int) |
Get color rule from both modular and fixed rules. More... | |
int | Rast_parse_color_rule (DCELL, DCELL, const char *, DCELL *, int *, int *, int *, int *, int *, int *) |
Read color rule. More... | |
const char * | Rast_parse_color_rule_error (int) |
Parse color rule. More... | |
int | Rast_read_color_rule (void *, DCELL, DCELL, DCELL *, int *, int *, int *, int *, int *, int *) |
Read color rule. More... | |
int | Rast_read_color_rules (struct Colors *, DCELL, DCELL, read_rule_fn *, void *) |
Read color rules from file. More... | |
int | Rast_load_colors (struct Colors *, const char *, CELL, CELL) |
Load color rules from file. More... | |
int | Rast_load_fp_colors (struct Colors *, const char *, DCELL, DCELL) |
Load color floating-point rules from file. More... | |
void | Rast_make_colors (struct Colors *, const char *, CELL, CELL) |
Load color rules from predefined color table. More... | |
void | Rast_make_fp_colors (struct Colors *, const char *, DCELL, DCELL) |
Load color rules from predefined floating-point color table. More... | |
void | Rast_set_c_color (CELL, int, int, int, struct Colors *) |
Set a category color (CELL) More... | |
void | Rast_set_d_color (DCELL, int, int, int, struct Colors *) |
Set a category color (DCELL) More... | |
void | Rast_set_null_value_color (int, int, int, struct Colors *) |
Set color for NULL-value. More... | |
void | Rast_set_default_color (int, int, int, struct Colors *) |
Set default color value. More... | |
void | Rast_shift_c_colors (CELL, struct Colors *) |
void | Rast_shift_d_colors (DCELL, struct Colors *) |
void | Rast_write_colors (const char *, const char *, struct Colors *) |
Write map layer color table. More... | |
void | Rast__write_colors (FILE *, struct Colors *) |
Write map layer color table. More... | |
void | Rast_histogram_eq_colors (struct Colors *, struct Colors *, struct Cell_stats *) |
Make histogram-stretched version of existing color table. More... | |
void | Rast_histogram_eq_fp_colors (struct Colors *, struct Colors *, struct FP_stats *) |
Make histogram-stretched version of existing color table (FP version) More... | |
void | Rast_log_colors (struct Colors *, struct Colors *, int) |
Make logarithmically-scaled version of an existing color table. More... | |
void | Rast_abs_log_colors (struct Colors *, struct Colors *, int) |
Make logarithmically-scaled version of an existing color table, allowing for signed values. More... | |
int | Rast__check_format (int) |
int | Rast__read_row_ptrs (int) |
int | Rast__read_null_row_ptrs (int, int) |
int | Rast__write_row_ptrs (int) |
int | Rast__write_null_row_ptrs (int, int) |
void | Rast_fpreclass_clear (struct FPReclass *) |
void | Rast_fpreclass_reset (struct FPReclass *) |
void | Rast_fpreclass_init (struct FPReclass *) |
void | Rast_fpreclass_set_domain (struct FPReclass *, DCELL, DCELL) |
void | Rast_fpreclass_set_range (struct FPReclass *, DCELL, DCELL) |
int | Rast_fpreclass_get_limits (const struct FPReclass *, DCELL *, DCELL *, DCELL *, DCELL *) |
int | Rast_fpreclass_nof_rules (const struct FPReclass *) |
void | Rast_fpreclass_get_ith_rule (const struct FPReclass *, int, DCELL *, DCELL *, DCELL *, DCELL *) |
void | Rast_fpreclass_set_neg_infinite_rule (struct FPReclass *, DCELL, DCELL) |
int | Rast_fpreclass_get_neg_infinite_rule (const struct FPReclass *, DCELL *, DCELL *) |
void | Rast_fpreclass_set_pos_infinite_rule (struct FPReclass *, DCELL, DCELL) |
int | Rast_fpreclass_get_pos_infinite_rule (const struct FPReclass *, DCELL *, DCELL *) |
void | Rast_fpreclass_add_rule (struct FPReclass *, DCELL, DCELL, DCELL, DCELL) |
void | Rast_fpreclass_reverse_rule_order (struct FPReclass *) |
DCELL | Rast_fpreclass_get_cell_value (const struct FPReclass *, DCELL) |
void | Rast_fpreclass_perform_di (const struct FPReclass *, const DCELL *, CELL *, int) |
void | Rast_fpreclass_perform_df (const struct FPReclass *, const DCELL *, FCELL *, int) |
void | Rast_fpreclass_perform_dd (const struct FPReclass *, const DCELL *, DCELL *, int) |
void | Rast_fpreclass_perform_fi (const struct FPReclass *, const FCELL *, CELL *, int) |
void | Rast_fpreclass_perform_ff (const struct FPReclass *, const FCELL *, FCELL *, int) |
void | Rast_fpreclass_perform_fd (const struct FPReclass *, const FCELL *, DCELL *, int) |
void | Rast_fpreclass_perform_ii (const struct FPReclass *, const CELL *, CELL *, int) |
void | Rast_fpreclass_perform_if (const struct FPReclass *, const CELL *, FCELL *, int) |
void | Rast_fpreclass_perform_id (const struct FPReclass *, const CELL *, DCELL *, int) |
void | Rast_init_gdal (void) |
Initialization. More... | |
struct GDAL_link * | Rast_get_gdal_link (const char *, const char *) |
Get GDAL link settings for given raster map. More... | |
struct GDAL_link * | Rast_create_gdal_link (const char *, RASTER_MAP_TYPE) |
Create GDAL settings for given raster map. More... | |
void | Rast_close_gdal_link (struct GDAL_link *) |
Close existing GDAL link. More... | |
int | Rast_close_gdal_write_link (struct GDAL_link *) |
Close existing GDAL link and write out data. More... | |
void | Rast_get_cellhd (const char *, const char *, struct Cell_head *) |
Read the raster header. More... | |
void | Rast_get_row_nomask (int, void *, int, RASTER_MAP_TYPE) |
Read raster row without masking. More... | |
void | Rast_get_c_row_nomask (int, CELL *, int) |
Read raster row without masking (CELL type) More... | |
void | Rast_get_f_row_nomask (int, FCELL *, int) |
Read raster row without masking (FCELL type) More... | |
void | Rast_get_d_row_nomask (int, DCELL *, int) |
Read raster row without masking (DCELL type) More... | |
void | Rast_get_row (int, void *, int, RASTER_MAP_TYPE) |
Get raster row. More... | |
void | Rast_get_c_row (int, CELL *, int) |
Get raster row (CELL type) More... | |
void | Rast_get_f_row (int, FCELL *, int) |
Get raster row (FCELL type) More... | |
void | Rast_get_d_row (int, DCELL *, int) |
Get raster row (DCELL type) More... | |
void | Rast_get_null_value_row (int, char *, int) |
Read or simulate null value row. More... | |
int | Rast__read_null_bits (int, int, unsigned char *) |
void | Rast_get_row_colors (int, int, struct Colors *, unsigned char *, unsigned char *, unsigned char *, unsigned char *) |
Reads a row of raster data and converts it to RGB. More... | |
void | Rast_histogram_eq (const struct Histogram *, unsigned char **, CELL *, CELL *) |
void | Rast_init_histogram (struct Histogram *) |
initializes the histogram structure More... | |
int | Rast_read_histogram (const char *, const char *, struct Histogram *) |
read the histogram information More... | |
void | Rast_write_histogram (const char *, const struct Histogram *) |
Writes the histogram information. More... | |
void | Rast_write_histogram_cs (const char *, struct Cell_stats *) |
Writes the histogram based on cell statistics to file. More... | |
void | Rast_make_histogram_cs (struct Cell_stats *, struct Histogram *) |
Creates histogram based on cell statistics. More... | |
int | Rast_get_histogram_num (const struct Histogram *) |
Sorts the histogram in ascending order by counts then category. More... | |
CELL | Rast_get_histogram_cat (int, const struct Histogram *) |
Returns cat for the nth element in the histogram. More... | |
long | Rast_get_histogram_count (int, const struct Histogram *) |
Returns count for the nth element in the histogram. More... | |
void | Rast_free_histogram (struct Histogram *) |
Frees memory allocated for the histogram. More... | |
int | Rast_sort_histogram (struct Histogram *) |
Sorts the histogram. More... | |
int | Rast_sort_histogram_by_count (struct Histogram *) |
Sorts the histogram by counts. More... | |
void | Rast_remove_histogram (const char *) |
Removes the histogram. More... | |
int | Rast_add_histogram (CELL, long, struct Histogram *) |
adds count to the histogram value for cat More... | |
int | Rast_set_histogram (CELL, long, struct Histogram *) |
sets the histogram value for cat to count More... | |
void | Rast_extend_histogram (CELL, long, struct Histogram *) |
Extends histogram struct to accommodate a new value. More... | |
void | Rast_zero_histogram (struct Histogram *) |
Zero out histogram struct. More... | |
int | Rast__read_history (struct History *, FILE *) |
int | Rast_read_history (const char *, const char *, struct History *) |
Read raster history file. More... | |
void | Rast__write_history (struct History *, FILE *) |
void | Rast_write_history (const char *, struct History *) |
Write raster history file. More... | |
void | Rast_short_history (const char *, const char *, struct History *) |
Initialize history structure. More... | |
int | Rast_command_history (struct History *) |
Save command line to raster history structure. More... | |
void | Rast_append_history (struct History *, const char *) |
Append a string to a History structure. More... | |
void | Rast_append_format_history (struct History *, const char *,...) __attribute__((format(printf |
void const char * | Rast_get_history (struct History *, int) |
Set the string of a specific history field. More... | |
void | Rast_set_history (struct History *, int, const char *) |
Set the string of a specific history field. More... | |
void | Rast_format_history (struct History *, int, const char *,...) __attribute__((format(printf |
void void | Rast_clear_history (struct History *) |
void | Rast_free_history (struct History *) |
int | Rast_history_length (struct History *) |
const char * | Rast_history_line (struct History *, int) |
void | Rast_init (void) |
Initialize GRASS GIS engine. More... | |
void | Rast__check_init (void) |
Checks to see if GIS engine is initialized. More... | |
void | Rast_init_all (void) |
void | Rast__init (void) |
void | Rast__error_handler (void *) |
DCELL | Rast_interp_linear (double, DCELL, DCELL) |
DCELL | Rast_interp_bilinear (double, double, DCELL, DCELL, DCELL, DCELL) |
DCELL | Rast_interp_cubic (double, DCELL, DCELL, DCELL, DCELL) |
DCELL | Rast_interp_bicubic (double, double, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL) |
DCELL | Rast_interp_lanczos (double, double, DCELL *) |
DCELL | Rast_interp_cubic_bspline (double, DCELL, DCELL, DCELL, DCELL) |
DCELL | Rast_interp_bicubic_bspline (double, double, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL, DCELL) |
int | Rast_option_to_interp_type (const struct Option *) |
Get interpolation method from the option. More... | |
char * | Rast_mask_info (void) |
int | Rast__mask_info (char *, char *) |
int | Rast_maskfd (void) |
Test for MASK. More... | |
void | Rast__set_null_value (void *, int, int, RASTER_MAP_TYPE) |
To set one or more raster values to null. More... | |
void | Rast_set_null_value (void *, int, RASTER_MAP_TYPE) |
To set one or more raster values to null. More... | |
void | Rast_set_c_null_value (CELL *, int) |
To set a number of CELL raster values to NULL. More... | |
void | Rast_set_f_null_value (FCELL *, int) |
To set a number of FCELL raster values to NULL. More... | |
void | Rast_set_d_null_value (DCELL *, int) |
To set a number of DCELL raster values to NULL. More... | |
int | Rast_is_null_value (const void *, RASTER_MAP_TYPE) |
To check if a raster value is set to NULL. More... | |
void | Rast_insert_null_values (void *, char *, int, RASTER_MAP_TYPE) |
To check if a CELL raster value is set to NULL. More... | |
void | Rast_insert_c_null_values (CELL *, char *, int) |
To insert null values into an integer raster map (CELL) More... | |
void | Rast_insert_f_null_values (FCELL *, char *, int) |
To insert null values into an floating-point raster map (FCELL) More... | |
void | Rast_insert_d_null_values (DCELL *, char *, int) |
To insert null values into an floating-point raster map (FCELL) More... | |
int | Rast__check_null_bit (const unsigned char *, int, int) |
Check NULL. More... | |
void | Rast__convert_01_flags (const char *, unsigned char *, int) |
? More... | |
void | Rast__convert_flags_01 (char *, const unsigned char *, int) |
? More... | |
void | Rast__init_null_bits (unsigned char *, int) |
? More... | |
int | Rast_open_old (const char *, const char *) |
Open an existing integer raster map (cell) More... | |
int | Rast__open_old (const char *, const char *) |
Lower level function, open cell files, supercell files, and the MASK file. More... | |
int | Rast_open_c_new (const char *) |
Opens a new cell file in a database (compressed) More... | |
int | Rast_open_c_new_uncompressed (const char *) |
Opens a new cell file in a database (uncompressed) More... | |
void | Rast_want_histogram (int) |
Save histogram for newly create raster map (cell) More... | |
void | Rast_set_cell_format (int) |
Sets the format for subsequent opens on new integer cell files (uncompressed and random only). More... | |
int | Rast_get_cell_format (CELL) |
Get cell value format. More... | |
int | Rast_open_fp_new (const char *) |
Opens new fcell file in a database. More... | |
int | Rast_open_fp_new_uncompressed (const char *) |
Opens new fcell file in a database (uncompressed) More... | |
void | Rast_set_fp_type (RASTER_MAP_TYPE) |
Set raster map floating-point data format. More... | |
int | Rast_map_is_fp (const char *, const char *) |
Check if raster map is floating-point. More... | |
RASTER_MAP_TYPE | Rast_map_type (const char *, const char *) |
Determine raster data type. More... | |
RASTER_MAP_TYPE | Rast__check_fp_type (const char *, const char *) |
Determines whether the floating points cell file has double or float type. More... | |
RASTER_MAP_TYPE | Rast_get_map_type (int) |
Determine raster type from descriptor. More... | |
int | Rast_open_new (const char *, RASTER_MAP_TYPE) |
Opens a new raster map. More... | |
int | Rast_open_new_uncompressed (const char *, RASTER_MAP_TYPE) |
Opens a new raster map (uncompressed) More... | |
void | Rast_set_quant_rules (int, struct Quant *) |
Sets quant translation rules for raster map opened for reading. More... | |
int | Rast__open_null_write (const char *) |
void | Rast_put_cellhd (const char *, struct Cell_head *) |
Writes the raster file header. More... | |
void | Rast_put_row (int, const void *, RASTER_MAP_TYPE) |
Writes the next row for cell/fcell/dcell file. More... | |
void | Rast_put_c_row (int, const CELL *) |
Writes the next row for cell file (CELL version) More... | |
void | Rast_put_f_row (int, const FCELL *) |
Writes the next row for fcell file (FCELL version) More... | |
void | Rast_put_d_row (int, const DCELL *) |
Writes the next row for dcell file (DCELL version) More... | |
void | Rast__write_null_bits (int, const unsigned char *) |
Write null data. More... | |
int | Rast_put_cell_title (const char *, const char *) |
void | Rast_quant_clear (struct Quant *) |
Resets the number of defined rules and number of infinite rules to 0. More... | |
void | Rast_quant_free (struct Quant *) |
Resets and frees allocated memory. More... | |
int | Rast__quant_organize_fp_lookup (struct Quant *) |
Organized fp_lookup table. More... | |
void | Rast_quant_init (struct Quant *) |
Initialize the structure. More... | |
int | Rast_quant_is_truncate (const struct Quant *) |
Returns whether or not quant rules are set to truncate map. More... | |
int | Rast_quant_is_round (const struct Quant *) |
Returns whether or not quant rules are set to round map. More... | |
void | Rast_quant_truncate (struct Quant *) |
Sets the quant rules to perform simple truncation on floats. More... | |
void | Rast_quant_round (struct Quant *) |
Sets the quant rules to perform simple rounding on floats. More... | |
int | Rast_quant_get_limits (const struct Quant *, DCELL *, DCELL *, CELL *, CELL *) |
Returns the minimum and maximum cell and dcell values of all the ranges defined. More... | |
int | Rast_quant_nof_rules (const struct Quant *) |
Returns the number of quantization rules defined. More... | |
void | Rast_quant_get_ith_rule (const struct Quant *, int, DCELL *, DCELL *, CELL *, CELL *) |
Returns the i'th quantization rule. More... | |
void | Rast_quant_set_neg_infinite_rule (struct Quant *, DCELL, CELL) |
Defines a rule for values "dLeft" and smaller. More... | |
int | Rast_quant_get_neg_infinite_rule (const struct Quant *, DCELL *, CELL *) |
Returns in "dLeft" and "c" the rule values. More... | |
void | Rast_quant_set_pos_infinite_rule (struct Quant *, DCELL, CELL) |
Defines a rule for values "dRight" and larger. More... | |
int | Rast_quant_get_pos_infinite_rule (const struct Quant *, DCELL *, CELL *) |
Returns in "dRight" and "c" the rule values. More... | |
void | Rast_quant_add_rule (struct Quant *, DCELL, DCELL, CELL, CELL) |
Adds a new rule to the set of quantization rules. More... | |
void | Rast_quant_reverse_rule_order (struct Quant *) |
Rreverses the order in which the qunatization rules are stored. More... | |
CELL | Rast_quant_get_cell_value (struct Quant *, DCELL) |
Returns a CELL category for the floating-point value based on the quantization rules in q. The first rule found that applies is used. The rules are searched in the reverse order they are added to q. If no rule is found, the value is first tested against the negative infinite rule, and finally against the positive infinite rule. If none of these rules apply, the NULL-value is returned. More... | |
void | Rast_quant_perform_d (struct Quant *, const DCELL *, CELL *, int) |
Returns in "cell" the quantized CELL values. More... | |
void | Rast_quant_perform_f (struct Quant *, const FCELL *, CELL *, int) |
Same as Rast_quant_perform_d(), except the type. More... | |
struct Quant_table * | Rast__quant_get_rule_for_d_raster_val (const struct Quant *, DCELL) |
Returns quant rule which will be applied. More... | |
int | Rast__quant_import (const char *, const char *, struct Quant *) |
Reads quantization rules (internal use only) More... | |
int | Rast__quant_export (const char *, const char *, const struct Quant *) |
Writes the quantization rules (internal use only) More... | |
void | Rast_truncate_fp_map (const char *, const char *) |
Writes the quant rules. More... | |
void | Rast_round_fp_map (const char *, const char *) |
Writes the quant rules. More... | |
void | Rast_quantize_fp_map (const char *, const char *, CELL, CELL) |
Write quant rules (f_quant) for floating-point raster map. More... | |
void | Rast_quantize_fp_map_range (const char *, const char *, DCELL, DCELL, CELL, CELL) |
Write quant rules (f_quant) for floating-point raster map. More... | |
void | Rast_write_quant (const char *, const char *, const struct Quant *) |
Writes the quant rule table for the raster map. More... | |
int | Rast_read_quant (const char *, const char *, struct 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... | |
void | Rast__remove_fp_range (const char *) |
Remove floating-point range. More... | |
void | Rast_construct_default_range (struct Range *) |
Construct default range. More... | |
int | Rast_read_fp_range (const char *, const char *, struct FPRange *) |
Read floating-point range. More... | |
int | Rast_read_range (const char *, const char *, struct Range *) |
Read raster range (CELL) More... | |
void | Rast_write_range (const char *, const struct Range *) |
Write raster range file. More... | |
void | Rast_write_fp_range (const char *, const struct FPRange *) |
Write raster range file (floating-point) More... | |
void | Rast_update_range (CELL, struct Range *) |
Update range structure (CELL) More... | |
void | Rast_update_fp_range (DCELL, struct FPRange *) |
Update range structure (floating-point) More... | |
void | Rast_row_update_range (const CELL *, int, struct Range *) |
Update range structure based on raster row (CELL) More... | |
void | Rast__row_update_range (const CELL *, int, struct Range *, int) |
Update range structure based on raster row. More... | |
void | Rast_row_update_fp_range (const void *, int, struct FPRange *, RASTER_MAP_TYPE) |
Update range structure based on raster row (floating-point) More... | |
void | Rast_init_range (struct Range *) |
Initialize range structure. More... | |
void | Rast_get_range_min_max (const struct Range *, CELL *, CELL *) |
Get range min and max. More... | |
void | Rast_init_fp_range (struct FPRange *) |
Initialize fp range. More... | |
void | Rast_get_fp_range_min_max (const struct FPRange *, DCELL *, DCELL *) |
Get minimum and maximum value from fp range. More... | |
int | Rast_read_rstats (const char *, const char *, struct R_stats *) |
Read raster stats. More... | |
void | Rast_write_rstats (const char *, const struct R_stats *) |
Write raster stats file. More... | |
int | Rast_raster_cmp (const void *, const void *, RASTER_MAP_TYPE) |
Compares raster values. More... | |
void | Rast_raster_cpy (void *, const void *, int, RASTER_MAP_TYPE) |
Copies raster values. More... | |
void | Rast_set_c_value (void *, CELL, RASTER_MAP_TYPE) |
Places a CELL raster value. More... | |
void | Rast_set_f_value (void *, FCELL, RASTER_MAP_TYPE) |
Places a FCELL raster value. More... | |
void | Rast_set_d_value (void *, DCELL, RASTER_MAP_TYPE) |
Places a DCELL raster value. More... | |
CELL | Rast_get_c_value (const void *, RASTER_MAP_TYPE) |
Retrieves the value of give type from pointer p. More... | |
FCELL | Rast_get_f_value (const void *, RASTER_MAP_TYPE) |
Retrieves the value of given raster type from pointer p (FCELL) More... | |
DCELL | Rast_get_d_value (const void *, RASTER_MAP_TYPE) |
Retrieves the value of given type from pointer p (DCELL) More... | |
char * | Rast_read_units (const char *, const char *) |
Get a raster map's units metadata string. More... | |
char * | Rast_read_vdatum (const char *, const char *) |
Get a raster map's vertical datum metadata string. More... | |
void | Rast_write_units (const char *, const char *) |
Write a string to a raster map's units metadata file. More... | |
void | Rast_write_vdatum (const char *, const char *) |
Write a string into a raster's vertical datum metadata file. More... | |
int | Rast_map_to_img_str (char *, int, unsigned char *) |
int | Rast_is_reclass (const char *, const char *, char *, char *) |
Check if raster map is reclassified. More... | |
int | Rast_is_reclassed_to (const char *, const char *, int *, char ***) |
Get child reclass maps list. More... | |
int | Rast_get_reclass (const char *, const char *, struct Reclass *) |
Get reclass. More... | |
void | Rast_free_reclass (struct Reclass *) |
Free Reclass structure. More... | |
int | Rast_put_reclass (const char *, const struct Reclass *) |
Put reclass. More... | |
DCELL | Rast_get_sample_nearest (int, const struct Cell_head *, struct Categories *, double, double, int) |
Extract a cell value from raster map (neighbor interpolation) More... | |
DCELL | Rast_get_sample_bilinear (int, const struct Cell_head *, struct Categories *, double, double, int) |
Extract a cell value from raster map (bilinear interpolation). More... | |
DCELL | Rast_get_sample_cubic (int, const struct Cell_head *, struct Categories *, double, double, int) |
Extract a cell value from raster map (cubic interpolation). More... | |
DCELL | Rast_get_sample (int, const struct Cell_head *, struct Categories *, double, double, int, INTERP_TYPE) |
Extract a cell value from raster map. More... | |
void | Rast__init_window (void) |
void | Rast_set_window (struct Cell_head *) |
Establishes 'window' as the current working window. More... | |
void | Rast_unset_window (void) |
Unset current window. More... | |
void | Rast_set_output_window (struct Cell_head *) |
Establishes 'window' as the current working window for output. More... | |
void | Rast_set_input_window (struct Cell_head *) |
Establishes 'window' as the current working window for input. More... | |
struct R_vrt * | Rast_get_vrt (const char *, const char *) |
void | Rast_close_vrt (struct R_vrt *) |
int | Rast_get_vrt_row (int, void *, int, RASTER_MAP_TYPE) |
void | Rast_get_window (struct Cell_head *) |
Read the current window. More... | |
void | Rast_get_input_window (struct Cell_head *) |
Read the current input window. More... | |
void | Rast_get_output_window (struct Cell_head *) |
Read the current output window. More... | |
int | Rast_window_rows (void) |
Number of rows in active window. More... | |
int | Rast_window_cols (void) |
Number of columns in active window. More... | |
int | Rast_input_window_rows (void) |
Number of rows in active input window. More... | |
int | Rast_input_window_cols (void) |
Number of columns in active input window. More... | |
int | Rast_output_window_rows (void) |
Number of rows in active output window. More... | |
int | Rast_output_window_cols (void) |
Number of columns in active output window. More... | |
double | Rast_northing_to_row (double, const struct Cell_head *) |
Northing to row. More... | |
double | Rast_easting_to_col (double, const struct Cell_head *) |
Easting to column. More... | |
double | Rast_row_to_northing (double, const struct Cell_head *) |
Row to northing. More... | |
double | Rast_col_to_easting (double, const struct Cell_head *) |
Column to easting. More... | |
void | Rast__create_window_mapping (int) |
Create window mapping. More... | |
int | Rast_row_repeat_nomask (int, int) |
Loops rows until mismatch?. More... | |
void | Rast_zero_buf (void *, RASTER_MAP_TYPE) |
Zero a raster buffer. More... | |
void | Rast_zero_input_buf (void *, RASTER_MAP_TYPE) |
void | Rast_zero_output_buf (void *, RASTER_MAP_TYPE) |
Definition at line 416 of file defs/raster.h.
Referenced by IL_create_bitmask(), N_copy_array_2d(), Rast__row_update_range(), Rast_fpreclass_perform_id(), Rast_fpreclass_perform_if(), Rast_fpreclass_perform_ii(), Rast_get_max_c_cat(), Rast_get_range_min_max(), Rast_is_null_value(), and Rast_update_range().
Definition at line 420 of file defs/raster.h.
Referenced by c_ave(), c_count(), c_intr(), c_kurt(), c_max(), c_maxx(), c_min(), c_minx(), c_range(), c_skew(), c_stddev(), c_sum(), c_var(), I_cluster_point(), N_copy_array_2d(), Rast_fpreclass_perform_dd(), Rast_fpreclass_perform_df(), Rast_fpreclass_perform_di(), Rast_get_fp_range_min_max(), Rast_is_null_value(), Rast_quant_perform_d(), Rast_quantize_fp_map(), Rast_set_d_cat(), Rast_update_fp_range(), sort_cell(), sort_cell_w(), w_ave(), w_count(), w_kurt(), w_max(), w_min(), w_skew(), w_stddev(), w_sum(), and w_var().
Definition at line 418 of file defs/raster.h.
Referenced by N_copy_array_2d(), Rast_fpreclass_perform_fd(), Rast_fpreclass_perform_ff(), Rast_fpreclass_perform_fi(), Rast_is_null_value(), Rast_quant_perform_f(), and Rast_set_f_value().
Definition at line 238 of file defs/raster.h.
unsigned char* Rast__allocate_null_bits | ( | int | cols | ) |
Allocates memory for null bits.
Allocates an array of unsigned char based on cols.
cols | number of columns in region |
Definition at line 135 of file alloc_cell.c.
References G_calloc, and Rast__null_bitstream_size().
int Rast__check_for_auto_masking | ( | void | ) |
Checks for auto masking.
On first call, opens the mask file if declared and available and allocates buffer for reading mask rows. On second call, returns 0 or 1.
Definition at line 37 of file auto_mask.c.
References _, R__::auto_mask, G_find_raster(), G_mapset(), G_projection(), G_warning(), G_zone(), R__::mask_fd, Cell_head::proj, Rast__init(), Rast__open_old(), Rast_get_cellhd(), Rast_unopen(), and Cell_head::zone.
Referenced by Rast_init_all(), Rast_maskfd(), Rast_open_old(), and Rast_unsuppress_masking().
int Rast__check_format | ( | int | fd | ) |
Small example to illustrate the raster format:
A file may contain the following 3x3 floating point matrix:
10.000 20.000 30.000 20.000 40.000 50.000 30.000 50.000 60.000
The header is a single byte, equal to sizeof(off_t) (typically 4 on a 32-bit platform, 8 on a 64-bit platform). Then, NROWS+1 offsets are written as off_t's (i.e. 4 or 8 bytes, depending upon platform) in big-endian (Motorola) byte order.
Thus, above example is actually interpreted as:
4 sizeof(off_t) 0 0 0 17 offset of row 0 0 0 0 36 offset of row 1 0 0 0 55 offset of row 2 0 0 0 74 offset of end of data
See Rast__write_row_ptrs() below for the code which writes this data. However, note that the row offsets are initially zero; they get overwritten later (if you are writing compressed data, you don't know how much space it will require until you've compressed it).
As for the format of the actual row data, see put_fp_data() in src/libes/gis/put_row.c and RFC 1014 (the XDR specification): http://www.faqs.org/rfcs/rfc1014.html
Definition at line 63 of file raster/format.c.
References fileinfo::cellhd, Cell_head::compressed, fileinfo::data_fd, R__::fileinfo, G_calloc, Rast__read_row_ptrs(), fileinfo::row_ptr, and Cell_head::rows.
RASTER_MAP_TYPE Rast__check_fp_type | ( | const char * | name, |
const char * | mapset | ||
) |
Determines whether the floating points cell file has double or float type.
name | map name |
mapset | mapset where map name lives |
Definition at line 933 of file raster/open.c.
References _, DCELL_TYPE, FCELL_TYPE, FORMAT_FILE, G_fatal_error(), G_file_name_misc(), G_find_key_value(), G_find_raster2(), G_free_key_value(), G_fully_qualified_name(), G_read_key_value_file(), G_warning(), GPATH_MAX, and NULL.
Referenced by Rast_map_type().
void Rast__check_init | ( | void | ) |
int Rast__check_null_bit | ( | const unsigned char * | flags, |
int | bit_num, | ||
int | n | ||
) |
Check NULL.
Note: Only for internal use.
flags | null bitmap |
bit_num | index of bit to check |
n | size of null bitmap (in bits) |
Definition at line 338 of file null_val.c.
References G_fatal_error().
Referenced by G__set_flags_from_01_random().
void Rast__close_null | ( | int | ) |
Definition at line 530 of file raster/close.c.
References fileinfo::cellhd, R__::fileinfo, G__make_mapset_element_misc(), G_file_name_misc(), G_free(), G_mapset(), GPATH_MAX, fileinfo::name, fileinfo::null_fd, NULL_FILE, fileinfo::null_row_ptr, Rast__write_null_row_ptrs(), and Cell_head::rows.
void Rast__color_free_fp_lookup | ( | struct _Color_Info_ * | cp | ) |
Free color rules structure.
Note: Only for internal use.
cp | pointer to _Color_Info structure |
Definition at line 79 of file color_free.c.
References _Color_Info_::active, _Color_Info_::fp_lookup, G_free(), _Color_Info_::nalloc, _Color_Info_::rules, and _Color_Info_::vals.
void Rast__color_free_lookup | ( | struct _Color_Info_ * | cp | ) |
Free color rules structure.
Note: Only for internal use.
cp | pointer to _Color_Info structure |
Definition at line 61 of file color_free.c.
References _Color_Info_::active, _Color_Info_::blu, G_free(), _Color_Info_::grn, _Color_Info_::lookup, _Color_Info_::red, and _Color_Info_::set.
void Rast__color_free_rules | ( | struct _Color_Info_ * | cp | ) |
Free color rules structure.
Note: Only for internal use.
cp | pointer to _Color_Info structure |
Definition at line 43 of file color_free.c.
void Rast__color_reset | ( | struct Colors * | colors | ) |
Reset colors structure.
Note: Only for internal use.
This routine should NOT init the colors.
colors | pointer to Colors structure |
Definition at line 98 of file color_free.c.
void Rast__convert_01_flags | ( | const char * | zero_ones, |
unsigned char * | flags, | ||
int | n | ||
) |
?
Note: Only for internal use.
zero_ones | |
flags | |
n |
Definition at line 423 of file null_val.c.
References count, and Rast__null_bitstream_size().
Referenced by G__set_flags_from_01_random().
void Rast__convert_flags_01 | ( | char * | zero_ones, |
const unsigned char * | flags, | ||
int | n | ||
) |
?
Note: Only for internal use.
zero_ones | |
flags | |
n |
Definition at line 461 of file null_val.c.
References count, and Rast__null_bitstream_size().
void Rast__create_window_mapping | ( | int | fd | ) |
Create window mapping.
Creates mapping from cell header into window. The boundaries and resolution of the two spaces do not have to be the same or aligned in any way.
fd | file descriptor |
Definition at line 33 of file raster/window_map.c.
References alloc_index, fileinfo::C1, fileinfo::C2, fileinfo::cellhd, fileinfo::col_map, Cell_head::cols, Cell_head::east, Cell_head::ew_res, R__::fileinfo, G_debug(), G_free(), Cell_head::north, Cell_head::ns_res, fileinfo::open_mode, OPEN_OLD, Cell_head::proj, PROJECTION_LL, R__::rd_window, Cell_head::west, and x.
void Rast__error_handler | ( | void * | ) |
Definition at line 73 of file raster/init.c.
References _, R__::auto_mask, R__::compress_nulls, R__::compression_type, DCELL_TYPE, FCELL_TYPE, R__::fileinfo, R__::fileinfo_count, R__::fp_type, G_add_error_handler(), G_check_compressor(), G_compressor_name(), G_compressor_number(), G_debug(), G_default_compressor(), G_warning(), getenv(), init(), R__::mask_fd, R__::nbytes, NULL, Rast__init_window(), Rast__unopen_all(), and R__::want_histogram.
void Rast__init | ( | void | ) |
Definition at line 65 of file raster/init.c.
References G_is_initialized().
Referenced by Rast__check_for_auto_masking(), Rast__open_null_write(), Rast__open_old(), Rast_init(), Rast_init_all(), Rast_set_fp_type(), Rast_suppress_masking(), and Rast_unsuppress_masking().
void Rast__init_null_bits | ( | unsigned char * | flags, |
int | cols | ||
) |
?
Note: Only for internal use.
flags | |
cols |
Definition at line 495 of file null_val.c.
References Rast__null_bitstream_size().
void Rast__init_window | ( | void | ) |
Definition at line 24 of file raster/set_window.c.
References G__init_window(), G_initialize_done(), G_is_initialized(), R__::rd_window, R__::split_window, G__::window, R__::window_set, and R__::wr_window.
Referenced by Rast__error_handler(), Rast_create_gdal_link(), Rast_input_window_cols(), Rast_input_window_rows(), Rast_output_window_cols(), Rast_output_window_rows(), Rast_window_cols(), and Rast_window_rows().
int Rast__insert_color_into_lookup | ( | CELL | , |
int | , | ||
int | , | ||
int | , | ||
struct _Color_Info_ * | |||
) |
Definition at line 14 of file color_insrt.c.
void Rast__interpolate_color_rule | ( | DCELL | val, |
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
const struct _Color_Rule_ * | rule | ||
) |
Interpolate color rules.
val | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
rule | pointer to _Color_Rule which holds color rules info |
Definition at line 417 of file color_look.c.
References _Color_Value_::blu, _Color_Value_::grn, _Color_Rule_::high, _Color_Value_::red, and _Color_Value_::value.
void Rast__lookup_colors | ( | const void * | raster, |
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
unsigned char * | set, | ||
int | n, | ||
struct Colors * | colors, | ||
int | mod, | ||
int | rules_only, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Lookup an array of colors.
raster | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
set | array which indicates if color is set or not | |
n | number of values | |
colors | pointer to Colors structure which holds color info | |
mod | ||
rules_only | ||
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 195 of file color_look.c.
int Rast__mask_info | ( | char * | , |
char * | |||
) |
Definition at line 56 of file mask_info.c.
References G_find_raster(), G_mapset(), GMAPSET_MAX, GNAME_MAX, and Rast_is_reclass().
Referenced by Rast_mask_info().
int Rast__null_bitstream_size | ( | int | cols | ) |
Determines null bitstream size.
cols | number of columns |
Definition at line 148 of file alloc_cell.c.
References _, and G_fatal_error().
Referenced by G__set_flags_from_01_random(), Rast__allocate_null_bits(), Rast__convert_01_flags(), Rast__convert_flags_01(), Rast__init_null_bits(), and Rast__write_null_bits().
int Rast__open_null_write | ( | const char * | ) |
Definition at line 752 of file raster/open.c.
References _, G_fatal_error(), G_find_raster2(), G_mapset(), G_store(), G_unqualified_name(), GMAPSET_MAX, GNAME_MAX, fileinfo::mapset, and Rast__init().
int Rast__open_old | ( | const char * | name, |
const char * | mapset | ||
) |
Lower level function, open cell files, supercell files, and the MASK file.
Actions:
Diagnostics: Errors other than actual open failure will cause a diagnostic to be delivered through G_warning() open failure messages are left to the calling routine since the masking logic will want to issue a different warning.
Note: This routine does NOT open the MASK layer. If it did we would get infinite recursion. This routine is called to open the mask by Rast__check_for_auto_masking() which is called by Rast_open_old().
name | map name |
mapset | mapset of cell file to be opened |
Definition at line 152 of file raster/open.c.
References _, CELL_TYPE, Cell_head::compressed, DCELL_TYPE, FCELL_TYPE, Cell_head::format, G_check_compressor(), G_compressor_name(), G_fatal_error(), G_find_raster2(), G_fully_qualified_name(), G_open_old(), G_projection_name(), G_unqualified_name(), GMAPSET_MAX, GNAME_MAX, Reclass::mapset, name, Reclass::name, Cell_head::proj, Rast__init(), Rast_get_cellhd(), Rast_get_gdal_link(), Rast_get_reclass(), Rast_get_vrt(), Rast_map_type(), R__::rd_window, XDR_DOUBLE_NBYTES, XDR_FLOAT_NBYTES, and Cell_head::zone.
Referenced by Rast__check_for_auto_masking(), Rast_get_vrt_row(), and Rast_open_old().
void Rast__organize_colors | ( | struct Colors * | ) |
Definition at line 12 of file color_org.c.
int Rast__quant_export | ( | const char * | name, |
const char * | mapset, | ||
const struct Quant * | quant | ||
) |
Writes the quantization rules (internal use only)
Writes the quantization rules stored in quant for name . If the mapset is the same as the current mapset, the quant file is created in 'cell_misc/name' directory, otherwise it is created in 'quant2/mapset' directory, much like writing colors for map in another mapset. The rules are written in decreasing order of priority (i.e. rules added earlier are written later).
Note: if no rules are defined an empty file is created.
name | map name |
mapset | mapset name |
quant | pointer to Quant structure |
Definition at line 268 of file quant_io.c.
References G__make_mapset_element_misc(), G_fopen_new(), G_fopen_new_misc(), G_make_mapset_element(), G_mapset(), G_name_is_fully_qualified(), G_remove(), G_remove_misc(), GMAPSET_MAX, GNAME_MAX, and QUANT_FILE_NAME.
Referenced by Rast_write_quant().
struct Quant_table* Rast__quant_get_rule_for_d_raster_val | ( | const struct Quant * | q, |
DCELL | val | ||
) |
Returns quant rule which will be applied.
Returns quant rule which will be applied when looking up the integer quant value for val (used when organizing fp_lookup).
q | pointer to Quant structure which holds quant rules info |
val | fp cell value |
Definition at line 780 of file quant.c.
References Quant_table::dHigh, Quant_table::dLow, Quant::nofRules, NULL, and Quant::table.
int Rast__quant_import | ( | const char * | name, |
const char * | mapset, | ||
struct Quant * | quant | ||
) |
Reads quantization rules (internal use only)
Reads quantization rules for raster map 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.
Note: in the case of negative return value, the result of using the quantization structure is not defined. in case of return value 0, calls to Rast_quant_perform_d() and Rast_quant_perform_f() return NO_DATA (see description of Rast_quant_perform_d() for more details). in case of return values 2 and 3, the explicit rule for quant is set: floating range is mapped to integer range.
Note: use Rast_quant_init() to allocate and initialize the quantization staructure quant before the first usage of G_quant_import().
Note: this function uses Rast_quant_free () to clear all previously stored rules in quant.
name | map name | |
mapset | mapset name | |
[out] | quant | pointer to Quant structure |
Definition at line 94 of file quant_io.c.
References _, CELL_TYPE, G_fopen_old(), G_fully_qualified_name(), G_mapset(), G_name_is_fully_qualified(), G_warning(), GMAPSET_MAX, GNAME_MAX, Rast_map_type(), and Rast_quant_free().
Referenced by Rast_read_quant().
int Rast__quant_organize_fp_lookup | ( | struct Quant * | q | ) |
Organized fp_lookup table.
Organizes fp_lookup table for faster (logarithmic) lookup time G_quant_organize_fp_lookup() creates a list of min and max for each quant rule, sorts this list, and stores the pointer to quant rule that should be used inbetween any 2 numbers in this list. Also it stores extreme points for 2 infinite rules, if exist. After the call to G_quant_organize_fp_lookup() instead of linearly searching through list of rules to find a rule to apply, quant lookup will perform a binary search to find an interval containing floating point value, and then use the rule associated with this interval. when the value doesn't fall within any interval, check for the infinite rules.
q | pointer to Quant structure which holds quant rules info |
int Rast__read_colors | ( | const char * | , |
const char * | , | ||
const char * | , | ||
struct Colors * | |||
) |
Definition at line 116 of file raster/color_read.c.
int Rast__read_history | ( | struct History * | , |
FILE * | |||
) |
Definition at line 59 of file history.c.
References History::fields, G_ascii_check(), G_getl(), G_store(), HIST_NUM_FIELDS, History::nlines, and Rast_append_history().
Referenced by Rast3d_read_history(), and Rast_read_history().
int Rast__read_null_bits | ( | int | , |
int | , | ||
unsigned char * | |||
) |
Definition at line 865 of file raster/get_row.c.
References fileinfo::cellhd, Cell_head::cols, R__::fileinfo, and fileinfo::null_fd.
int Rast__read_null_row_ptrs | ( | int | , |
int | |||
) |
Definition at line 170 of file raster/format.c.
References fileinfo::cellhd, R__::fileinfo, and Cell_head::rows.
int Rast__read_row_ptrs | ( | int | ) |
Definition at line 155 of file raster/format.c.
References fileinfo::cellhd, Cell_head::compressed, R__::fileinfo, and Cell_head::rows.
Referenced by Rast__check_format().
void Rast__remove_fp_range | ( | const char * | name | ) |
Remove floating-point range.
Note: For internal use only.
name | map name |
Definition at line 33 of file range.c.
References G_remove_misc().
Update range structure based on raster row.
Note: for internal use only.
cell | raster values |
n | number of values |
range | pointer to Range structure which holds range info |
ignore_zeros | ignore zeros |
Definition at line 587 of file range.c.
References R_stats::count, Range::first_time, Range::max, min, Range::min, Rast_is_c_null_value, Range::rstats, R_stats::sum, and R_stats::sumsq.
Referenced by Rast_row_update_range().
void Rast__set_null_value | ( | void * | rast, |
int | numVals, | ||
int | null_is_zero, | ||
RASTER_MAP_TYPE | data_type | ||
) |
To set one or more raster values to null.
It also sets null to zero if null_is_zero is TRUE.
rast | pointer to values to set to null |
numVals | number of values to set to null |
null_is_zero | flag to indicate if NULL = 0 |
data_type | type of raster - CELL, FCELL, DCELL |
Definition at line 80 of file null_val.c.
References G_zero(), Rast_cell_size(), and Rast_set_null_value().
void Rast__unopen_all | ( | void | ) |
Unopen all raster maps.
Unopen all raster maps opened for write. Memory allocated for raster processing is freed, and the temporary file created when the raster map was opened is removed (see Creating and Opening New Raster Files). This routine is useful when errors are detected and it is desired to remove temporary files.
Definition at line 156 of file raster/close.c.
References R__::fileinfo, R__::fileinfo_count, fileinfo::open_mode, OPEN_NEW_COMPRESSED, and OPEN_NEW_UNCOMPRESSED.
Referenced by Rast__error_handler().
void Rast__write_colors | ( | FILE * | fd, |
struct Colors * | colors | ||
) |
Write map layer color table.
fd | file descriptor |
colors | pointer to Colors structure which holds color info |
Definition at line 109 of file raster/color_write.c.
Referenced by Rast3d_write_colors().
void Rast__write_history | ( | struct History * | , |
FILE * | |||
) |
Definition at line 128 of file history.c.
References History::fields, HIST_NUM_FIELDS, History::lines, and History::nlines.
Referenced by Rast3d_write_history(), and Rast_write_history().
void Rast__write_null_bits | ( | int | fd, |
const unsigned char * | flags | ||
) |
Write null data.
flags | ? |
row | row number |
col | col number |
fd | file descriptor of cell data file |
Definition at line 543 of file raster/put_row.c.
References fileinfo::cellhd, Cell_head::cols, R__::fileinfo, fileinfo::null_cur_row, fileinfo::null_row_ptr, and Rast__null_bitstream_size().
int Rast__write_null_row_ptrs | ( | int | , |
int | |||
) |
Definition at line 222 of file raster/format.c.
References fileinfo::cellhd, R__::fileinfo, and Cell_head::rows.
Referenced by Rast__close_null().
int Rast__write_row_ptrs | ( | int | ) |
Definition at line 214 of file raster/format.c.
References fileinfo::cellhd, R__::fileinfo, and Cell_head::rows.
Make logarithmically-scaled version of an existing color table, allowing for signed values.
[out] | dst | struct to hold new colors |
src | struct containing original colors | |
samples | number of samples |
Definition at line 243 of file color_xform.c.
void Rast_add_c_color_rule | ( | const CELL * | cat1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const CELL * | cat2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Adds the integer color rule (CELL version)
See Rast_add_color_rule() for details.
cat1 | cell value | |
r1,g1,b1 | color value | |
cat2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 75 of file color_rule.c.
void Rast_add_color_rule | ( | const void * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const void * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Adds the color rule.
Adds the floating-point rule that the range [v1,v2] gets a linear ramp of colors from [r1,g1,b1] to [r2,g2,b2]. If either v1 or v2 is the NULL-value, this call is converted ino Rast_set_null_value_color (r1, g1, b1, colors)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
data_type | raster data type (CELL, FCELL, DCELL) |
Definition at line 104 of file color_rule.c.
void Rast_add_d_color_rule | ( | const DCELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const DCELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Adds the floating-point color rule (DCELL version)
See Rast_add_color_rule() for details.
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 35 of file color_rule.c.
void Rast_add_f_color_rule | ( | const FCELL * | cat1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const FCELL * | cat2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Adds the floating-point color rule (FCELL version)
See Rast_add_color_rule() for details.
cat1 | cell value | |
r1,g1,b1 | color value | |
cat2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 55 of file color_rule.c.
adds count to the histogram value for cat
adds count to the histogram value for cat
cat | category |
count | |
histogram | struct for histogram |
Definition at line 360 of file histogram.c.
References Histogram::Histogram_list::cat, count, Histogram::Histogram_list::count, Histogram::list, Histogram::num, and Rast_extend_histogram().
Referenced by Rast_make_histogram_cs().
int Rast_add_modular_c_color_rule | ( | const CELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const CELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular integer color rule (CELL version)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 184 of file color_rule.c.
int Rast_add_modular_color_rule | ( | const void * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const void * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Add modular color rule.
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
data_type | raster data type |
Definition at line 218 of file color_rule.c.
int Rast_add_modular_d_color_rule | ( | const DCELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const DCELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular floating-point color rule (DCELL version)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 124 of file color_rule.c.
int Rast_add_modular_f_color_rule | ( | const FCELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const FCELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular floating-point color rule (FCELL version)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 154 of file color_rule.c.
Align two regions.
Modifies the input window to align to ref region. The resolutions in window are set to match those in ref and the window edges (north, south, east, west) are modified to align with the grid of the ref region.
The window may be enlarged if necessary to achieve the alignment. The north is rounded northward, the south southward, the east eastward and the west westward. Lon-lon constraints are taken into consideration to make sure that the north doesn't go above 90 degrees (for lat/lon) or that the east does "wrap" past the west, etc.
Definition at line 41 of file align_window.c.
void* Rast_allocate_buf | ( | RASTER_MAP_TYPE | data_type | ) |
Allocate memory for a raster map of given type.
Allocate an array of CELL, FCELL, or DCELL (depending on data_type) based on the number of columns in the current region.
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 55 of file alloc_cell.c.
References G_calloc, Rast_cell_size(), and Rast_window_cols().
CELL* Rast_allocate_c_buf | ( | void | ) |
Allocate memory for a CELL type raster map.
Allocate an array of CELL based on the number of columns in the current region.
This routine allocates a buffer of type CELL just large enough to hold one row of raster data based on the number of columns in the active region.
If larger buffers are required, the routine G_malloc() can be used. The routine is generally used with each open cell file.
Prints error message and calls exit() on error.
Definition at line 82 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by IL_create_bitmask(), open_band_files(), and Rast_map_to_img_str().
CELL* Rast_allocate_c_input_buf | ( | void | ) |
Definition at line 162 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
CELL* Rast_allocate_c_output_buf | ( | void | ) |
Definition at line 188 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
DCELL* Rast_allocate_d_buf | ( | void | ) |
Allocates memory for a raster map of type DCELL.
Allocate an array of DCELL based on the number of columns in the current region.
Definition at line 108 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by Rast_map_to_img_str().
DCELL* Rast_allocate_d_input_buf | ( | void | ) |
Definition at line 172 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
DCELL* Rast_allocate_d_output_buf | ( | void | ) |
Definition at line 198 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
FCELL* Rast_allocate_f_buf | ( | void | ) |
Allocates memory for a raster map of type FCELL.
Allocate an array of FCELL based on the number of columns in the current region.
Definition at line 95 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by Rast_map_to_img_str().
FCELL* Rast_allocate_f_input_buf | ( | void | ) |
Definition at line 167 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
FCELL* Rast_allocate_f_output_buf | ( | void | ) |
Definition at line 193 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
void* Rast_allocate_input_buf | ( | RASTER_MAP_TYPE | ) |
Definition at line 157 of file alloc_cell.c.
References G_calloc, Rast_cell_size(), and Rast_input_window_cols().
Referenced by Rast_get_vrt_row().
char* Rast_allocate_null_buf | ( | void | ) |
Allocates memory for a null buffer.
Allocate an array of char based on the number of columns in the current region.
Definition at line 121 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
char* Rast_allocate_null_input_buf | ( | void | ) |
Definition at line 177 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
char* Rast_allocate_null_output_buf | ( | void | ) |
Definition at line 203 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
void* Rast_allocate_output_buf | ( | RASTER_MAP_TYPE | ) |
Definition at line 183 of file alloc_cell.c.
References G_calloc, Rast_cell_size(), and Rast_output_window_cols().
void Rast_append_format_history | ( | struct History * | , |
const char * | , | ||
... | |||
) |
void Rast_append_history | ( | struct History * | hist, |
const char * | str | ||
) |
Append a string to a History structure.
hist | pointer to History structure which holds history info |
str | string to append |
Definition at line 29 of file history.c.
References G_realloc, G_store(), History::lines, and History::nlines.
Referenced by Rast__read_history(), and Rast_command_history().
size_t Rast_cell_size | ( | RASTER_MAP_TYPE | data_type | ) |
Returns size of a raster cell in bytes.
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 39 of file alloc_cell.c.
Referenced by f_median(), f_nmedian(), Rast__set_null_value(), Rast_allocate_buf(), Rast_allocate_input_buf(), Rast_allocate_output_buf(), Rast_get_vrt_row(), Rast_raster_cpy(), Rast_row_update_fp_range(), Rast_zero_buf(), Rast_zero_input_buf(), and Rast_zero_output_buf().
int Rast_cell_stats_histo_eq | ( | struct Cell_stats * | , |
CELL | , | ||
CELL | , | ||
CELL | , | ||
CELL | , | ||
int | , | ||
void(*)(CELL, CELL, CELL) | |||
) |
Definition at line 4 of file cellstats_eq.c.
void void Rast_clear_history | ( | struct History * | ) |
Definition at line 303 of file history.c.
References G_free(), History::lines, History::nlines, and NULL.
Referenced by Rast_free_history().
void Rast_close | ( | int | fd | ) |
Close a raster map.
The raster map opened on file descriptor fd is closed. Memory allocated for raster processing is freed. If open for writing, skeletal support files for the new raster map are created as well.
Note: If a module wants to explicitly write support files (e.g., a specific color table) for a raster map it creates, it must do so after the raster map is closed. Otherwise the close will overwrite the support files. See Raster Map Layer Support Routines for routines which write raster support files.
If the map is a new floating point, move the .tmp
file into the fcell
element, create an empty file in the cell
directory; write the floating-point range file; write a default quantization file quantization file is set here to round fp numbers (this is a default for now). create an empty category file, with max cat = max value (for backwards compatibility). Move the .tmp
NULL-value bitmap file to the cell_misc
directory.
fd | file descriptor |
Definition at line 99 of file raster/close.c.
References _, R__::fileinfo, R__::fileinfo_count, G_fatal_error(), fileinfo::open_mode, and OPEN_OLD.
Referenced by close_band_files(), IL_create_bitmask(), Rast_map_to_img_str(), and Rast_suppress_masking().
void Rast_close_gdal_link | ( | struct GDAL_link * | gdal | ) |
Close existing GDAL link.
gdal | pointer to GDAL_link to be closed |
Definition at line 581 of file gdal.c.
References GDAL_link::data, GDAL_link::filename, and G_free().
int Rast_close_gdal_write_link | ( | struct GDAL_link * | gdal | ) |
Close existing GDAL link and write out data.
gdal | pointer to GDAL_link to be closed |
Definition at line 598 of file gdal.c.
References _, GDAL_link::data, dst, FALSE, GDAL_link::filename, G_free(), G_strcasecmp(), G_warning(), NULL, and Rast_gdal_raster_IO().
void Rast_close_vrt | ( | struct R_vrt * | ) |
Definition at line 150 of file vrt.c.
References tileinfo::clist, G_free(), G_free_ilist(), tileinfo::mapset, tileinfo::name, R_vrt::tilecount, R_vrt::tileinfo, and R_vrt::tlist.
double Rast_col_to_easting | ( | double | col, |
const struct Cell_head * | window | ||
) |
Column to easting.
Converts a col relative to a window to an easting.
Note: col is a double:
col | column number | |
[in] | window | pointer to Cell_head |
Definition at line 264 of file raster/window.c.
int Rast_colors_count | ( | const struct Colors * | colors | ) |
Get both modular and fixed rules count.
colors | pointer to color table structure |
Definition at line 24 of file color_rule_get.c.
int Rast_command_history | ( | struct History * | hist | ) |
Save command line to raster history structure.
This routine takes an existing (run Rast_short_history first() history structure and adds the command line to the end of the comments array, as cleaned & expanded by the parser.
Note: use Rast_write_history() to write the structure.
Sample Usage:
hist | pointer to History structure which holds history info |
Definition at line 272 of file history.c.
References G_free(), G_recreate_command(), History::nlines, and Rast_append_history().
void Rast_construct_default_range | ( | struct Range * | range | ) |
Construct default range.
Sets the integer range to [1,255]
[out] | r | pointer to Range structure which holds range info |
Definition at line 45 of file range.c.
References DEFAULT_CELL_MAX, DEFAULT_CELL_MIN, and Rast_update_range().
void Rast_copy_cats | ( | struct Categories * | pcats_to, |
const struct Categories * | pcats_from | ||
) |
Copy raster categories.
Allocates NEW space for quant rules and labels n pcats_to and copies all info from pcats_from cats to pcats_to cats.
pcats_to | pointer to destination Categories structure |
pcats_from | pointer to source Categories structure |
Definition at line 1248 of file raster/cats.c.
References Categories::ncats, Rast_get_ith_d_cat(), Rast_init_cats(), Rast_set_d_cat(), and Categories::title.
Referenced by Rast_sort_cats().
struct GDAL_link* Rast_create_gdal_link | ( | const char * | name, |
RASTER_MAP_TYPE | map_type | ||
) |
Create GDAL settings for given raster map.
name | map name |
map_type | map type (CELL, FCELL, DCELL) |
Definition at line 422 of file gdal.c.
References driver, G_is_initialized(), GPATH_MAX, Rast__init_window(), and Rast_init_gdal().
double Rast_easting_to_col | ( | double | east, |
const struct Cell_head * | window | ||
) |
Easting to column.
Converts east relative to a window to a column.
Note: The result is a double. Casting it to an int will give the column number.
east | east coordinate |
window | pointer to Cell_head |
Definition at line 221 of file raster/window.c.
Extends histogram struct to accommodate a new value.
cat | category |
count | |
histogram | struct for histogram |
Definition at line 410 of file histogram.c.
References Histogram::Histogram_list::cat, count, Histogram::Histogram_list::count, G_realloc, LIST, Histogram::list, and Histogram::num.
Referenced by Rast_add_histogram(), Rast_read_histogram(), and Rast_set_histogram().
int Rast_find_cell_stat | ( | CELL | cat, |
long * | count, | ||
const struct Cell_stats * | s | ||
) |
Random query of cell stats.
This routine allows a random query of the Cell_stats structure. The count
associated with the raster value cat
is set. The routine returns 1 if cat
was found in the structure, 0 otherwise.
Allow finding the count for the NULL-value.
cat | raster value | |
[out] | count | count |
s | pointer to Cell_stats structure which holds cell stats info |
Definition at line 190 of file cell_stats.c.
void Rast_format_history | ( | struct History * | , |
int | , | ||
const char * | , | ||
... | |||
) |
Definition at line 466 of file fpreclass.c.
void Rast_fpreclass_clear | ( | struct FPReclass * | ) |
Definition at line 266 of file fpreclass.c.
References FPReclass::defaultDRuleSet, FPReclass::defaultRRuleSet, FPReclass::infiniteLeftSet, FPReclass::infiniteRightSet, and FPReclass::nofRules.
Referenced by Rast_fpreclass_reset().
Definition at line 562 of file fpreclass.c.
Referenced by Rast_fpreclass_perform_dd(), Rast_fpreclass_perform_df(), Rast_fpreclass_perform_di(), Rast_fpreclass_perform_fd(), Rast_fpreclass_perform_ff(), Rast_fpreclass_perform_fi(), Rast_fpreclass_perform_id(), Rast_fpreclass_perform_if(), and Rast_fpreclass_perform_ii().
void Rast_fpreclass_get_ith_rule | ( | const struct FPReclass * | , |
int | , | ||
DCELL * | , | ||
DCELL * | , | ||
DCELL * | , | ||
DCELL * | |||
) |
Definition at line 383 of file fpreclass.c.
References FPReclass_table::dHigh, FPReclass_table::dLow, FPReclass_table::rHigh, FPReclass_table::rLow, and FPReclass::table.
Definition at line 343 of file fpreclass.c.
References DEFAULT_MAX, DEFAULT_MIN, FPReclass::defaultDMax, FPReclass::defaultDMin, FPReclass::defaultRMax, FPReclass::defaultRMin, FPReclass::defaultRRuleSet, FPReclass::dMax, FPReclass::dMin, NO_DEFAULT_RULE, NO_EXPLICIT_RULE, FPReclass::rMax, and FPReclass::rMin.
Definition at line 427 of file fpreclass.c.
Definition at line 452 of file fpreclass.c.
void Rast_fpreclass_init | ( | struct FPReclass * | ) |
Definition at line 288 of file fpreclass.c.
References FPReclass::maxNofRules, and Rast_fpreclass_reset().
int Rast_fpreclass_nof_rules | ( | const struct FPReclass * | ) |
Definition at line 376 of file fpreclass.c.
References FPReclass::nofRules.
Definition at line 620 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_d_null_value, and Rast_set_d_null_value().
Definition at line 606 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_d_null_value, and Rast_set_f_null_value().
Definition at line 592 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_d_null_value, and Rast_set_c_null_value().
Definition at line 662 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_f_null_value, and Rast_set_d_null_value().
Definition at line 648 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_f_null_value, and Rast_set_f_null_value().
Definition at line 634 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_f_null_value, and Rast_set_c_null_value().
Definition at line 704 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_c_null_value, and Rast_set_d_null_value().
Definition at line 690 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_c_null_value, and Rast_set_f_null_value().
Definition at line 676 of file fpreclass.c.
References Rast_fpreclass_get_cell_value(), Rast_is_c_null_value, and Rast_set_c_null_value().
void Rast_fpreclass_reset | ( | struct FPReclass * | ) |
Definition at line 276 of file fpreclass.c.
References G_free(), FPReclass::maxNofRules, Rast_fpreclass_clear(), and FPReclass::table.
Referenced by Rast_fpreclass_init().
void Rast_fpreclass_reverse_rule_order | ( | struct FPReclass * | ) |
Definition at line 497 of file fpreclass.c.
References FPReclass_table::dHigh, FPReclass_table::dLow, FPReclass::nofRules, FPReclass_table::rHigh, FPReclass_table::rLow, and FPReclass::table.
Definition at line 296 of file fpreclass.c.
References FPReclass::defaultDMax, FPReclass::defaultDMin, and FPReclass::defaultDRuleSet.
Definition at line 416 of file fpreclass.c.
Definition at line 441 of file fpreclass.c.
Definition at line 305 of file fpreclass.c.
References FPReclass::defaultRMax, FPReclass::defaultRMin, and FPReclass::defaultRRuleSet.
void Rast_free_cats | ( | struct Categories * | pcats | ) |
Free category structure memory.
Frees memory allocated by Rast_read_cats(), Rast_init_cats() and Rast_set_c_cat().
pcats | pointer to Categories structure |
Definition at line 1213 of file raster/cats.c.
References Categories::fmt, G_free(), Categories::labels, Categories::marks, Categories::nalloc, Categories::ncats, NULL, Categories::q, Rast_quant_free(), and Categories::title.
void Rast_free_cell_stats | ( | struct Cell_stats * | s | ) |
Free cell stats structure.
The memory associated with structure s is freed. This routine may be called any time after calling Rast_init_cell_stats().
s | pointer to Cell_stats structure |
Definition at line 385 of file cell_stats.c.
References Cell_stats::Cell_stats_node::count, G_free(), complex::i, Cell_stats::N, and Cell_stats::node.
void Rast_free_colors | ( | struct Colors * | colors | ) |
Free color structure memory.
The dynamically allocated memory associated with the colors structure is freed.
Note: This routine may be used after Rast_read_colors() as well as after Rast_init_colors().
colors | pointer to Colors structure |
Definition at line 30 of file color_free.c.
Referenced by Gvl_unload_colors_data(), and Rast_map_to_img_str().
void Rast_free_histogram | ( | struct Histogram * | histogram | ) |
Frees memory allocated for the histogram.
frees the memory allocated for the histogram
histogram | struct for histogram |
Definition at line 211 of file histogram.c.
References G_free(), Histogram::list, NULL, and Histogram::num.
void Rast_free_history | ( | struct History * | ) |
Definition at line 317 of file history.c.
References History::fields, G_free(), HIST_NUM_FIELDS, NULL, and Rast_clear_history().
void Rast_free_reclass | ( | struct Reclass * | reclass | ) |
Free Reclass structure.
reclass | pointer to Reclass structure |
Definition at line 183 of file reclass.c.
References G_free(), Reclass::mapset, Reclass::name, NULL, Reclass::num, RECLASS_TABLE, Reclass::table, and Reclass::type.
char* Rast_get_c_cat | ( | CELL * | rast, |
struct Categories * | pcats | ||
) |
Get a raster category label (CELL)
This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.
Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.
rast | cell value |
pcats | pointer to Categories structure |
Definition at line 323 of file raster/cats.c.
References CELL_TYPE, and Rast_get_cat().
Gets color from raster map (CELL)
Looks up the rgb colors for rast in the color table colors.
rast | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 68 of file color_get.c.
Get color range values (CELL)
Returns min and max category in the range or huge numbers if the color table is defined on floating cell values and not on categories.
[out] | min,max | minimum and maximum value |
colors | pointer to Colors structure which holds color info |
Definition at line 64 of file color_range.c.
void Rast_get_c_row | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Get raster row (CELL type)
Reads a row of raster data and leaves the NULL values intact. (As opposed to the deprecated function Rast_get_c_row() which converts NULL values to zero.)
NOTE. When the raster map is old and null file doesn't exist, it is assumed that all 0-cells are no-data. When map is floating point, uses quant rules set explicitly by Rast_set_quant_rules() or stored in map's quant file to convert floats to integers.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 783 of file raster/get_row.c.
References CELL_TYPE, and Rast_get_row().
Referenced by IL_create_bitmask().
void Rast_get_c_row_nomask | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (CELL type)
Same as Rast_get_c_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 682 of file raster/get_row.c.
References CELL_TYPE, and Rast_get_row_nomask().
Referenced by read_band_row().
CELL Rast_get_c_value | ( | const void * | rast, |
RASTER_MAP_TYPE | data_type | ||
) |
Retrieves the value of give type from pointer p.
Retrieves the value of type data_type from pointer p, converts it to CELL type and returns the result. If null value is stored in p, returns CELL null value.
Used for retrieving CELL values from raster cells of any type.
Note: when data_type != CELL_TYPE, no quantization is used, only type conversion.
rast | pointer to raster cell value |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 202 of file raster/raster.c.
char* Rast_get_cat | ( | void * | rast, |
struct Categories * | pcats, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Get a raster category label.
This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.
Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.
rast | cell value |
pcats | pointer to Categories structure |
data_type | map type (CELL, FCELL, DCELL) |
Definition at line 396 of file raster/cats.c.
References l.
Referenced by Rast_get_c_cat(), Rast_get_d_cat(), and Rast_get_f_cat().
char* Rast_get_cats_title | ( | const struct Categories * | pcats | ) |
Get title from category structure struct.
Map layers store a one-line title in the category structure as well. This routine returns a pointer to the title contained in the cats structure. A legal pointer is always returned. If the map layer does not have a title, then a pointer to the empty string "" is returned.
pcats | pointer to Categories structure |
Definition at line 299 of file raster/cats.c.
References Categories::title.
int Rast_get_cell_format | ( | CELL | v | ) |
Get cell value format.
v | cell |
Definition at line 472 of file raster/open.c.
char* Rast_get_cell_title | ( | const char * | name, |
const char * | mapset | ||
) |
get raster map title
If only the map layer title is needed, it is not necessary to read the entire category file into memory. This routine gets the title for raster map name in mapset directly from the category file, and returns a pointer to the title. A legal pointer is always returned. If the map layer does not have a title, then a pointer to the empty string "" is returned.
name | |
mapset |
Definition at line 27 of file cell_title.c.
References G_fopen_old(), G_getl(), G_store(), and G_strip().
void Rast_get_cellhd | ( | const char * | name, |
const char * | mapset, | ||
struct Cell_head * | cellhd | ||
) |
Read the raster header.
The raster header for the raster map name in the specified mapset is read into the cellhd structure. If there is an error reading the raster header file, G_fatal_error() is called.
Cell header files may contain either grid cell header information or reclass information. If it is a reclass file, it will specify the map and mapset names of the actual grid cell file being reclassed. Rast_get_cellhd(), upon reading reclass information will go read the cell header information for the referenced file. Only one reference is allowed.
name | name of map | |
mapset | mapset that map belongs to | |
[out] | cellhd | structure to hold cell header info |
Definition at line 41 of file get_cellhd.c.
References _, G__read_Cell_head(), G_fatal_error(), G_find_raster(), G_fopen_old(), GMAPSET_MAX, GNAME_MAX, and Rast_is_reclass().
Referenced by Rast__check_for_auto_masking(), Rast__open_old(), and Rast_get_vrt().
int Rast_get_color | ( | const void * | rast, |
int * | red, | ||
int * | grn, | ||
int * | blu, | ||
struct Colors * | colors, | ||
RASTER_MAP_TYPE | map_type | ||
) |
Gets color from raster map.
Looks up the rgb colors for rast in the color table colors.
The red, green, and blue intensities for the color associated with category n are extracted from the colors structure. The intensities will be in the range 0 -
rast | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
colors | pointer to Colors structure which holds color info | |
map_type | map type (CELL, FCELL, DCELL) |
Definition at line 38 of file color_get.c.
char* Rast_get_d_cat | ( | DCELL * | rast, |
struct Categories * | pcats | ||
) |
Get a raster category label (DCELL)
This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.
Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.
rast | cell value |
pcats | pointer to Categories structure |
Definition at line 371 of file raster/cats.c.
References DCELL_TYPE, and Rast_get_cat().
int Rast_get_d_color | ( | const DCELL * | rast, |
int * | red, | ||
int * | grn, | ||
int * | blu, | ||
struct Colors * | colors | ||
) |
Gets color from raster map (DCELL)
Looks up the rgb colors for rast in the color table colors.
rast | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 110 of file color_get.c.
Get color range values (DCELL)
Returns min and max category in the range or huge numbers if the color table is defined on floating cell values and not on categories.
[out] | min,max | minimum and maximum value |
colors | pointer to Colors structure which holds color info |
Definition at line 87 of file color_range.c.
void Rast_get_d_row | ( | int | fd, |
DCELL * | buf, | ||
int | row | ||
) |
Get raster row (DCELL type)
Same as Rast_get_f_row() except that the array dcell is double
.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 820 of file raster/get_row.c.
References DCELL_TYPE, and Rast_get_row().
void Rast_get_d_row_nomask | ( | int | fd, |
DCELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (DCELL type)
Same as Rast_get_d_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 714 of file raster/get_row.c.
References DCELL_TYPE, and Rast_get_row_nomask().
DCELL Rast_get_d_value | ( | const void * | rast, |
RASTER_MAP_TYPE | data_type | ||
) |
Retrieves the value of given type from pointer p (DCELL)
Retrieves the value of type data_type from pointer p, converts it to DCELL type and returns the result. If null value is stored in p, returns DCELL null value.
Used for retrieving DCELL values from raster cells of any type.
rast | pointer to raster cell value |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 271 of file raster/raster.c.
Referenced by Rast_set_cat().
void Rast_get_default_color | ( | int * | red, |
int * | grn, | ||
int * | blu, | ||
const struct Colors * | colors | ||
) |
Gets default color.
Puts the red, green, and blue components of the "default"
color into red, grn, and blu.
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 155 of file color_get.c.
char* Rast_get_f_cat | ( | FCELL * | rast, |
struct Categories * | pcats | ||
) |
Get a raster category label (FCELL)
This routine looks up category rast in the pcats structure and returns a pointer to a string which is the label for the category. A legal pointer is always returned. If the category does not exist in pcats, then a pointer to the empty string "" is returned.
Warning: The pointer that is returned points to a hidden static buffer. Successive calls to Rast_get_c_cat() overwrite this buffer.
rast | cell value |
pcats | pointer to Categories structure |
Definition at line 347 of file raster/cats.c.
References FCELL_TYPE, and Rast_get_cat().
int Rast_get_f_color | ( | const FCELL * | rast, |
int * | red, | ||
int * | grn, | ||
int * | blu, | ||
struct Colors * | colors | ||
) |
Gets color from raster map (FCELL)
Looks up the rgb colors for rast in the color table colors.
rast | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 89 of file color_get.c.
Referenced by Gvl_get_color_for_value().
void Rast_get_f_row | ( | int | fd, |
FCELL * | buf, | ||
int | row | ||
) |
Get raster row (FCELL type)
Read a row from the raster map open on fd into the float
array fcell performing type conversions as necessary based on the actual storage type of the map. Masking, resampling into the current region. NULL-values are always embedded in fcell
(never converted to a value).
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 803 of file raster/get_row.c.
References FCELL_TYPE, and Rast_get_row().
void Rast_get_f_row_nomask | ( | int | fd, |
FCELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (FCELL type)
Same as Rast_get_f_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 698 of file raster/get_row.c.
References FCELL_TYPE, and Rast_get_row_nomask().
FCELL Rast_get_f_value | ( | const void * | rast, |
RASTER_MAP_TYPE | data_type | ||
) |
Retrieves the value of given raster type from pointer p (FCELL)
Retrieves the value of type data_type from pointer p, converts it to FCELL type and returns the result. If null value is stored in p, returns FCELL null value.
Used for retrieving FCELL values from raster cells of any type.
rast | pointer to raster cell value |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 236 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, Rast_is_null_value(), and Rast_set_f_null_value().
int Rast_get_fp_color_rule | ( | DCELL * | val1, |
unsigned char * | r1, | ||
unsigned char * | g1, | ||
unsigned char * | b1, | ||
DCELL * | val2, | ||
unsigned char * | r2, | ||
unsigned char * | g2, | ||
unsigned char * | b2, | ||
const struct Colors * | colors, | ||
int | rule | ||
) |
Get color rule from both modular and fixed rules.
Rules are returned in the order as stored in the table (i.e. unexpected, high values first)
val1 | color value | |
[out] | r1,g1,b1 | color value |
val2 | color value | |
[out] | r2,g2,b2 | color value |
colors | pointer to color table structure | |
rule | rule index from 0 to G_color_count()-1 |
Definition at line 66 of file color_rule_get.c.
Get minimum and maximum value from fp range.
Extract the min/max from the range structure range. If the range structure has no defined min/max (first!=0) there will not be a valid range. In this case the min and max returned must be the NULL-value.
range | pointer to FPRange which holds fp range info | |
[out] | min | minimum value |
[out] | max | maximum value |
Definition at line 764 of file range.c.
References FPRange::first_time, FPRange::max, FPRange::min, Rast_is_d_null_value, and Rast_set_d_null_value().
Referenced by gsd_put_legend(), Rast3d_range_min_max(), Rast_quantize_fp_map(), and Rast_read_range().
struct GDAL_link* Rast_get_gdal_link | ( | const char * | name, |
const char * | mapset | ||
) |
Get GDAL link settings for given raster map.
name | map name |
mapset | name of mapset |
Definition at line 241 of file gdal.c.
Referenced by Rast__open_old().
Returns cat for the nth element in the histogram.
Returns cat for the nth element in the histogram
histogram | struct for histogram |
Definition at line 178 of file histogram.c.
References Histogram::Histogram_list::cat, Histogram::list, and Histogram::num.
long Rast_get_histogram_count | ( | int | n, |
const struct Histogram * | histogram | ||
) |
Returns count for the nth element in the histogram.
Returns count for the nth element in the histogram
n | nth element |
histogram | struct for histogram |
Definition at line 195 of file histogram.c.
References Histogram::Histogram_list::count, Histogram::list, and Histogram::num.
int Rast_get_histogram_num | ( | const struct Histogram * | histogram | ) |
Sorts the histogram in ascending order by counts then category.
Sorts the histogram in ascending order by counts then category. No combining is done.
histogram | struct for histogram |
Definition at line 165 of file histogram.c.
References Histogram::num.
void const char* Rast_get_history | ( | struct History * | hist, |
int | field | ||
) |
Set the string of a specific history field.
hist | pointer to History structure which holds history info |
field | number of a specific history field, should be accessed with macros (HIST_MAPID, ...) |
Definition at line 177 of file history.c.
References History::fields.
void Rast_get_input_window | ( | struct Cell_head * | window | ) |
Read the current input window.
window | pointer to Cell_head |
Definition at line 43 of file raster/window.c.
char* Rast_get_ith_c_cat | ( | const struct Categories * | pcats, |
int | i, | ||
void * | rast1, | ||
void * | rast2 | ||
) |
Get category description (CELL)
Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.
pcats | pointer to Categories structure |
i | index |
rast1,rast2 | raster values (range) |
Definition at line 1084 of file raster/cats.c.
References CELL_TYPE.
char* Rast_get_ith_cat | ( | const struct Categories * | pcats, |
int | i, | ||
void * | rast1, | ||
void * | rast2, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Get category description.
Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.
pcats | pointer to Categories structure |
i | index |
rast1,rast2 | raster values (range) |
data_type | map type |
Definition at line 1112 of file raster/cats.c.
char* Rast_get_ith_d_cat | ( | const struct Categories * | pcats, |
int | i, | ||
DCELL * | rast1, | ||
DCELL * | rast2 | ||
) |
Get category description (DCELL)
Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.
pcats | pointer to Categories structure |
i | index |
rast1,rast2 | raster values (range) |
Definition at line 1029 of file raster/cats.c.
References Categories::labels, Categories::ncats, Categories::q, Rast_quant_get_ith_rule(), and Rast_set_d_null_value().
Referenced by Rast3d_write_cats(), Rast_copy_cats(), Rast_get_next_marked_d_cat(), and Rast_set_d_cat().
char* Rast_get_ith_f_cat | ( | const struct Categories * | pcats, |
int | i, | ||
void * | rast1, | ||
void * | rast2 | ||
) |
Get category description (FCELL)
Returns i-th description and i-th data range from the list of category descriptions with corresponding data ranges. end points of data interval in rast1 and rast2.
pcats | pointer to Categories structure |
i | index |
rast1,rast2 | raster values (range) |
Definition at line 1057 of file raster/cats.c.
References FCELL_TYPE.
RASTER_MAP_TYPE Rast_get_map_type | ( | int | fd | ) |
Determine raster type from descriptor.
Determines if the raster map is floating point or integer. Returns DCELL_TYPE for double maps, FCELL_TYPE for float maps, CELL_TYPE for integer maps, -1 if error has occurred
fd | file descriptor |
Definition at line 918 of file raster/open.c.
References R__::fileinfo, and fileinfo::map_type.
Referenced by Rast_map_to_img_str().
CELL Rast_get_max_c_cat | ( | const char * | name, |
const char * | mapset | ||
) |
Get the max category number.
Return the max category number of a raster map of type CELL.
name | raster map name |
mapset | mapset name |
Definition at line 171 of file raster/cats.c.
References max, min, Rast_get_range_min_max(), Rast_is_c_null_value, and Rast_read_range().
char* Rast_get_next_marked_c_cat | ( | struct Categories * | pcats, |
CELL * | rast1, | ||
CELL * | rast2, | ||
long * | count | ||
) |
Get next marked raster categories (CELL)
pcats | pointer to Categories structure | |
rast1,rast2 | cell values (raster range) | |
[out] | count | count |
Definition at line 643 of file raster/cats.c.
References CELL_TYPE, and Rast_get_next_marked_cat().
char* Rast_get_next_marked_cat | ( | struct Categories * | pcats, |
void * | rast1, | ||
void * | rast2, | ||
long * | count, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Get next marked raster categories.
pcats | pointer to Categories structure | |
rast1,rast2 | cell values (raster range) | |
[out] | count | count |
data_type | map type |
Definition at line 676 of file raster/cats.c.
References Rast_get_next_marked_d_cat(), and Rast_set_d_value().
Referenced by Rast_get_next_marked_c_cat(), and Rast_get_next_marked_f_cat().
char* Rast_get_next_marked_d_cat | ( | struct Categories * | pcats, |
DCELL * | rast1, | ||
DCELL * | rast2, | ||
long * | count | ||
) |
Get next marked raster categories (DCELL)
pcats | pointer to Categories structure | |
rast1,rast2 | cell values (raster range) | |
[out] | count | count |
Definition at line 603 of file raster/cats.c.
References G_debug(), Categories::last_marked_rule, Categories::marks, NULL, Categories::q, Rast_get_ith_d_cat(), and Rast_quant_nof_rules().
Referenced by Rast_get_next_marked_cat().
char* Rast_get_next_marked_f_cat | ( | struct Categories * | pcats, |
FCELL * | rast1, | ||
FCELL * | rast2, | ||
long * | count | ||
) |
Get next marked raster categories (FCELL)
pcats | pointer to Categories structure | |
rast1,rast2 | cell values (raster range) | |
[out] | count | count |
Definition at line 659 of file raster/cats.c.
References FCELL_TYPE, and Rast_get_next_marked_cat().
void Rast_get_null_value_color | ( | int * | red, |
int * | grn, | ||
int * | blu, | ||
const struct Colors * | colors | ||
) |
Gets color for null value.
Puts the red, green, and blue components of colors for the NULL-value into red, grn, and blu.
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 127 of file color_get.c.
void Rast_get_null_value_row | ( | int | fd, |
char * | flags, | ||
int | row | ||
) |
Read or simulate null value row.
Read or simulate null value row and set the cells corresponding to null value to 1. The masked out cells are set to null when the mask exists. (the MASK is taken care of by null values (if the null file doesn't exist for this map, then the null row is simulated by assuming that all zeros in raster map are nulls. Also all masked out cells become nulls.
fd | file descriptor for the opened map |
buf | buffer for the row to be placed into |
flags | |
row | data row desired |
Definition at line 1075 of file raster/get_row.c.
References R__::fileinfo, and fileinfo::reclass_flag.
void Rast_get_output_window | ( | struct Cell_head * | window | ) |
Read the current output window.
window | pointer to Cell_head |
Definition at line 56 of file raster/window.c.
Get range min and max.
The minimum and maximum CELL values are extracted from the range structure.
If the range structure has no defined min/max (first!=0) there will not be a valid range. In this case the min and max returned must be the NULL-value.
range | pointer to Range structure which holds range info | |
[out] | min | minimum value |
[out] | max | maximum value |
Definition at line 714 of file range.c.
References Range::first_time, Range::max, Range::min, Rast_is_c_null_value, and Rast_set_c_null_value().
Referenced by gsd_put_legend(), and Rast_get_max_c_cat().
int Rast_get_reclass | ( | const char * | name, |
const char * | mapset, | ||
struct Reclass * | reclass | ||
) |
Get reclass.
name | map name | |
mapset | mapset name | |
[out] | reclass | pointer to Reclass structure |
Definition at line 140 of file reclass.c.
Referenced by Rast__open_old().
void Rast_get_row | ( | int | fd, |
void * | buf, | ||
int | row, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Get raster row.
If data_type is
DCELL_TYPE, calls Rast_get_d_row()
Reads appropriate information into the buffer buf associated with the requested row row. buf is associated with the current window.
Note, that the type of the data in buf (say X) is independent of the type of the data in the file described by fd (say Y).
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 759 of file raster/get_row.c.
Referenced by Rast_get_c_row(), Rast_get_d_row(), Rast_get_f_row(), and Rast_map_to_img_str().
void Rast_get_row_colors | ( | int | fd, |
int | row, | ||
struct Colors * | colors, | ||
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
unsigned char * | nul | ||
) |
Reads a row of raster data and converts it to RGB.
Reads a row of raster data and converts it to red, green and blue components according to the colors parameter. This provides a convenient way to treat a raster layer as a color image without having to explicitly cater for each of CELL
, FCELL
and DCELL
types.
fd | field descriptor | |
row | row number | |
colors | pointer to Colors structure which holds color info | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
[out] | nul | null value |
Definition at line 39 of file get_row_colr.c.
void Rast_get_row_nomask | ( | int | fd, |
void * | buf, | ||
int | row, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Read raster row without masking.
This routine reads the specified row from the raster map open on file descriptor fd into the buf buffer like Rast_get_c_row() does. The difference is that masking is suppressed. If the user has a mask set, Rast_get_c_row() will apply the mask but Rast_get_c_row_nomask() will ignore it. This routine prints a diagnostic message and returns -1 if there is an error reading the raster map. Otherwise a nonnegative value is returned.
Note. Ignoring the mask is not generally acceptable. Users expect the mask to be applied. However, in some cases ignoring the mask is justified. For example, the GRASS modules r.describe, which reads the raster map directly to report all data values in a raster map, and r.slope.aspect, which produces slope and aspect from elevation, ignore both the mask and the region. However, the number of GRASS modules which do this should be minimal. See Mask for more information about the mask.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 666 of file raster/get_row.c.
Referenced by Rast_get_c_row_nomask(), Rast_get_d_row_nomask(), Rast_get_f_row_nomask(), and Rast_get_vrt_row().
DCELL Rast_get_sample | ( | int | fd, |
const struct Cell_head * | window, | ||
struct Categories * | cats, | ||
double | north, | ||
double | east, | ||
int | usedesc, | ||
INTERP_TYPE | itype | ||
) |
Extract a cell value from raster map.
Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a specified interpolation method.
fd | file descriptor |
window | region settings |
cats | categories |
north | northing position |
east | easting position |
usedesc | flag to scan category label |
itype | interpolation method |
DCELL Rast_get_sample_bilinear | ( | int | fd, |
const struct Cell_head * | window, | ||
struct Categories * | cats, | ||
double | north, | ||
double | east, | ||
int | usedesc | ||
) |
Extract a cell value from raster map (bilinear interpolation).
Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a bilinear interpolation.
fd | file descriptor |
window | region settings |
cats | categories |
north | northing position |
east | easting position |
usedesc | flag to scan category label |
DCELL Rast_get_sample_cubic | ( | int | fd, |
const struct Cell_head * | window, | ||
struct Categories * | cats, | ||
double | north, | ||
double | east, | ||
int | usedesc | ||
) |
Extract a cell value from raster map (cubic interpolation).
Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a cubic interpolation.
fd | file descriptor |
window | region settings |
cats | categories |
north | northing position |
east | easting position |
usedesc | flag to scan category label |
DCELL Rast_get_sample_nearest | ( | int | fd, |
const struct Cell_head * | window, | ||
struct Categories * | cats, | ||
double | north, | ||
double | east, | ||
int | usedesc | ||
) |
Extract a cell value from raster map (neighbor interpolation)
Extract a cell value from raster map at given northing and easting with a sampled 3x3 window using a neighbor interpolation.
fd | file descriptor |
window | region settings |
cats | categories |
north | northing position |
east | easting position |
usedesc | flag to scan category label |
void Rast_get_stats_for_null_value | ( | long * | count, |
const struct Cell_stats * | s | ||
) |
Get number of null values.
Get a number of null values from stats structure.
Note: when reporting values which appear in a map using Rast_next_cell_stats(), to get stats for null, call Rast_get_stats_for_null_value() first, since Rast_next_cell_stats() does not report stats for null.
count | count |
s | pointer to Cell_stats structure which holds cell stats info |
Definition at line 372 of file cell_stats.c.
References Cell_stats::null_data_count.
struct R_vrt* Rast_get_vrt | ( | const char * | , |
const char * | |||
) |
Definition at line 47 of file vrt.c.
References _, tileinfo::cellhd, tileinfo::clist, cmp_wnd(), Cell_head::cols, Cell_head::east, Cell_head::ew_res, G_calloc, G_fatal_error(), G_find_raster(), G_find_raster2(), G_fopen_old_misc(), G_getl2(), G_ilist_add(), G_new_ilist(), G_realloc, G_store(), GNAME_MAX, tileinfo::mapset, name, tileinfo::name, Cell_head::north, NULL, Cell_head::proj, PROJECTION_LL, Rast_get_cellhd(), R__::rd_window, Cell_head::south, R_vrt::tilecount, R_vrt::tileinfo, R_vrt::tlist, and Cell_head::west.
Referenced by Rast__open_old().
int Rast_get_vrt_row | ( | int | , |
void * | , | ||
int | , | ||
RASTER_MAP_TYPE | |||
) |
Definition at line 171 of file vrt.c.
References CELL_TYPE, tileinfo::cellhd, tileinfo::clist, Cell_head::cols, DCELL_TYPE, FCELL_TYPE, R__::fileinfo, G_free(), tileinfo::mapset, ilist::n_values, tileinfo::name, Cell_head::north, Cell_head::ns_res, Rast__open_old(), Rast_allocate_input_buf(), Rast_cell_size(), Rast_get_row_nomask(), Rast_is_null_value(), Rast_set_null_value(), Rast_unopen(), R__::rd_window, Cell_head::rows, Cell_head::south, R_vrt::tileinfo, R_vrt::tlist, ilist::value, and fileinfo::vrt.
void Rast_get_window | ( | struct Cell_head * | window | ) |
Read the current window.
window | pointer to Cell_head |
Definition at line 26 of file raster/window.c.
int Rast_has_band_reference | ( | const char * | name, |
const char * | mapset | ||
) |
Check if band reference for raster map exists.
name | map name |
mapset | mapset name |
Definition at line 32 of file raster/band_reference.c.
References G_find_file2_misc().
Definition at line 15 of file histo_eq.c.
void Rast_histogram_eq_colors | ( | struct Colors * | dst, |
struct Colors * | src, | ||
struct Cell_stats * | statf | ||
) |
Make histogram-stretched version of existing color table.
Generates a histogram contrast-stretched color table that goes from the histogram information in the Cell_stats structure statf. (See Raster Histograms).
[out] | dst | struct to hold new colors |
src | struct containing original colors | |
statf | cell stats info |
Definition at line 30 of file color_xform.c.
void Rast_histogram_eq_fp_colors | ( | struct Colors * | dst, |
struct Colors * | src, | ||
struct FP_stats * | statf | ||
) |
Make histogram-stretched version of existing color table (FP version)
Generates a histogram contrast-stretched color table that goes from the histogram information in the FP_stats structure statf. (See Raster Histograms).
[out] | dst | struct to hold new colors |
src | struct containing original colors | |
statf | cell stats info |
Definition at line 109 of file color_xform.c.
int Rast_history_length | ( | struct History * | ) |
Definition at line 330 of file history.c.
References History::nlines.
void Rast_init | ( | void | ) |
Initialize GRASS GIS engine.
Initializes GIS engine and ensures a valid mapset is available.
Definition at line 44 of file raster/init.c.
References Rast__init().
Referenced by Rast_read_fp_range(), Rast_read_rstats(), Rast_write_fp_range(), and Rast_write_rstats().
void Rast_init_all | ( | void | ) |
Definition at line 142 of file raster/init.c.
References Rast__check_for_auto_masking(), Rast__init(), and Rast_init_gdal().
void Rast_init_cats | ( | const char * | title, |
struct Categories * | pcats | ||
) |
Initialize category structure.
To construct a new category file, the structure must first be initialized. This routine initializes the cats structure, and copies the title into the structure. The number of categories is set initially to n.
For example:
title | title |
pcats | pointer to Categories structure |
Definition at line 1145 of file raster/cats.c.
References Categories::a1, Categories::a2, Categories::fmt, Categories::labels, Categories::last_marked_rule, Categories::m1, Categories::m2, Categories::nalloc, Categories::ncats, NULL, Categories::num, Categories::q, Rast_quant_init(), and Rast_set_cats_title().
Referenced by Rast_copy_cats().
void Rast_init_cell_stats | ( | struct Cell_stats * | s | ) |
Initialize cell stats.
This routine, which must be called first, initializes the Cell_stats structure.
Set the count for NULL-values to zero.
s | pointer to Cell_stats structure |
Definition at line 39 of file cell_stats.c.
void Rast_init_colors | ( | struct Colors * | colors | ) |
Initialize color structure.
The colors structure is initialized for subsequent calls to Rast_add_c_color_rule() and Rast_set_c_color().
colors | pointer to Colors structure |
Definition at line 25 of file color_init.c.
void Rast_init_fp_range | ( | struct FPRange * | range | ) |
Initialize fp range.
Must set a flag in the range structure that indicates that no min/max have been defined - probably a "first"
boolean flag.
range | pointer to FPRange which holds fp range info |
Definition at line 742 of file range.c.
References FPRange::max, FPRange::min, and Rast_set_d_null_value().
Referenced by Rast3d_range_init(), Rast3d_read_range(), and Rast_read_fp_range().
void Rast_init_gdal | ( | void | ) |
Initialization.
Register all GDAL drivers.
Definition at line 218 of file gdal.c.
Referenced by Rast_create_gdal_link(), and Rast_init_all().
void Rast_init_histogram | ( | struct Histogram * | histogram | ) |
initializes the histogram structure
initializes the histogram structure for calls to Rast_set_histogram() and Rast_add_histogram()
histogram |
Definition at line 23 of file histogram.c.
References Histogram::list, NULL, and Histogram::num.
Referenced by Rast_make_histogram_cs(), and Rast_read_histogram().
void Rast_init_range | ( | struct Range * | range | ) |
Initialize range structure.
Initializes the range structure for updates by Rast_update_range() and Rast_row_update_range().
Must set a flag in the range structure that indicates that no min/max have been defined - probably a "first"
boolean flag.
range | pointer to Range structure which holds range info |
Definition at line 690 of file range.c.
References Range::max, Range::min, and Rast_set_c_null_value().
Referenced by Rast_read_range().
int Rast_input_window_cols | ( | void | ) |
Number of columns in active input window.
This routine returns the number of columns in the active input window.
Definition at line 152 of file raster/window.c.
References Cell_head::cols, Rast__init_window(), and R__::rd_window.
Referenced by Rast_allocate_c_input_buf(), Rast_allocate_d_input_buf(), Rast_allocate_f_input_buf(), Rast_allocate_input_buf(), Rast_allocate_null_input_buf(), and Rast_zero_input_buf().
int Rast_input_window_rows | ( | void | ) |
Number of rows in active input window.
This routine returns the number of rows in the active input window.
Definition at line 138 of file raster/window.c.
References Rast__init_window(), R__::rd_window, and Cell_head::rows.
void Rast_insert_c_null_values | ( | CELL * | cellVal, |
char * | null_row, | ||
int | ncols | ||
) |
To insert null values into an integer raster map (CELL)
For each of the count flags which is true(!=0), set the corresponding cell to the NULL value.
rast | pointer raster values |
null_row | null row |
ncols | number of columns |
Definition at line 295 of file null_val.c.
void Rast_insert_d_null_values | ( | DCELL * | dcellVal, |
char * | null_row, | ||
int | ncols | ||
) |
To insert null values into an floating-point raster map (FCELL)
For each for the count flag which is true(!=0), set the corresponding dcell to the NULL value.
dcellVal | pointer raster values |
null_row | null row |
ncols | number of columns |
Definition at line 322 of file null_val.c.
void Rast_insert_f_null_values | ( | FCELL * | fcellVal, |
char * | null_row, | ||
int | ncols | ||
) |
To insert null values into an floating-point raster map (FCELL)
fcellVal | pointer raster values |
null_row | null row |
ncols | number of columns |
Definition at line 307 of file null_val.c.
void Rast_insert_null_values | ( | void * | rast, |
char * | null_row, | ||
int | ncols, | ||
RASTER_MAP_TYPE | data_type | ||
) |
To check if a CELL raster value is set to NULL.
Returns 1 if cell is NULL, 0 otherwise. This will test if the value cell is the largest int
.
cellVal | CELL raster value to check |
To check if a FCELL raster value is set to NULL
Returns 1 if fcell is NULL, 0 otherwise. This will test if the value fcell is a NaN. It isn't good enough to test for a particular NaN bit pattern since the machine code may change this bit pattern to a different NaN. The test will be
or (as suggested by Mark Line)
fcellVal | FCELL raster value to check |
To check if a DCELL raster value is set to NULL
Returns 1 if dcell is NULL, 0 otherwise. This will test if the value dcell is a NaN. Same test as in Rast_is_f_null_value().
dcellVal | DCELL raster value to check |
To insert null values into a map.
rast | pointer raster values |
null_row | null row |
ncols | number of columns |
data_type | type of raster - CELL, FCELL, DCELL |
Definition at line 279 of file null_val.c.
void Rast_invert_colors | ( | struct Colors * | ) |
Definition at line 17 of file color_invrt.c.
int Rast_is_null_value | ( | const void * | rast, |
RASTER_MAP_TYPE | data_type | ||
) |
To check if a raster value is set to NULL.
rast | raster value to check |
data_type | type of raster - CELL, FCELL, DCELL |
Definition at line 179 of file null_val.c.
References CELL_TYPE, DCELL_TYPE, FALSE, FCELL_TYPE, G_warning(), Rast_is_c_null_value, Rast_is_d_null_value, and Rast_is_f_null_value.
Referenced by Rast_get_f_value(), Rast_get_vrt_row(), Rast_map_to_img_str(), Rast_raster_cmp(), and Rast_row_update_fp_range().
int Rast_is_reclass | ( | const char * | name, |
const char * | mapset, | ||
char * | rname, | ||
char * | rmapset | ||
) |
Check if raster map is reclassified.
This function determines if the raster map name in mapset is a reclass file. If it is, then the name and mapset of the referenced raster map are copied into the rname and rmapset buffers.
name | map name | |
mapset | mapset name | |
[out] | rname | name of reference map |
[out] | rmapset | mapset where reference map lives |
Definition at line 43 of file reclass.c.
Referenced by Rast__mask_info(), and Rast_get_cellhd().
int Rast_is_reclassed_to | ( | const char * | name, |
const char * | mapset, | ||
int * | nrmaps, | ||
char *** | rmaps | ||
) |
Get child reclass maps list.
This function generates a child reclass maps list from the cell_misc/reclassed_to file which stores this list. The cell_misc/reclassed_to file is written by Rast_put_reclass(). Rast_is_reclassed_to() is used by g.rename
, g.remove
and r.reclass
to prevent accidentally deleting the parent map of a reclassed raster map.
name | map name | |
mapset | mapset name | |
[out] | nrmaps | number of reference maps |
[out] | rmaps | array of names of reference maps |
Definition at line 79 of file reclass.c.
References G_fopen_old_misc(), G_malloc, G_realloc, l, and NULL.
Load color rules from file.
[out] | colors | pointer to Colors structure |
path | path to the color rules file | |
min,max | min & max values (used only when color rules are in percentage) |
Definition at line 300 of file raster/color_rules.c.
Load color floating-point rules from file.
[out] | colors | pointer to Colors structure |
path | path to the color rules file | |
min,max | min & max values (used only when color rules are in percentage) |
Definition at line 316 of file raster/color_rules.c.
Make logarithmically-scaled version of an existing color table.
[out] | dst | struct to hold new colors |
src | struct containing original colors | |
samples | number of samples |
Definition at line 185 of file color_xform.c.
void Rast_lookup_c_colors | ( | const CELL * | cell, |
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
unsigned char * | set, | ||
int | n, | ||
struct Colors * | colors | ||
) |
Lookup an array of colors.
Extracts colors for an array of cell values. The colors for the n values in the cell array are stored in the red, green, and blue arrays. The values in the set array will indicate if the corresponding cell value has a color or not (1 means it does, 0 means it does not).
The programmer must allocate the red, green, blue, and set arrays to be at least dimension n.
Note: The red, green, and blue intensities will be in the range 0 - 255.
Modified to return a color for NULL-values.
cell | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
set | array which indicates if color is set or not | |
n | number of values | |
colors | pointer to Colors structure which holds color info |
Definition at line 45 of file color_look.c.
void Rast_lookup_colors | ( | const void * | raster, |
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
unsigned char * | set, | ||
int | n, | ||
struct Colors * | colors, | ||
RASTER_MAP_TYPE | map_type | ||
) |
Lookup an array of colors.
raster | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
set | array which indicates if color is set or not | |
n | number of values | |
colors | pointer to Colors structure which holds color info | |
map_type | raster type (CELL, FCELL, DCELL) |
Definition at line 79 of file color_look.c.
Referenced by Rast_map_to_img_str().
void Rast_lookup_d_colors | ( | const DCELL * | dcell, |
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
unsigned char * | set, | ||
int | n, | ||
struct Colors * | colors | ||
) |
Lookup an array of colors (DCELL)
Converts the n double-precision values in the dcell array to their r,g,b color components. Embedded NULL-values are handled properly as well.
dcell | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
set | array which indicates if color is set or not | |
n | number of values | |
colors | pointer to Colors structure which holds color info |
Definition at line 146 of file color_look.c.
void Rast_lookup_f_colors | ( | const FCELL * | fcell, |
unsigned char * | red, | ||
unsigned char * | grn, | ||
unsigned char * | blu, | ||
unsigned char * | set, | ||
int | n, | ||
struct Colors * | colors | ||
) |
Lookup an array of colors (FCELL)
Converts the n floating-point values in the fcell array to their r,g,b color components. Embedded NULL-values are handled properly as well.
fcell | raster cell value | |
[out] | red | red value |
[out] | grn | green value |
[out] | blu | blue value |
set | array which indicates if color is set or not | |
n | number of values | |
colors | pointer to Colors structure which holds color info |
Definition at line 113 of file color_look.c.
Make aspect colors (integer)
Generates a color table for aspect data.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 299 of file color_compat.c.
Make aspect colors (floating-point)
Generates a color table for aspect data.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 313 of file color_compat.c.
Create BGYR color table (integer)
Generates a color table blue-green-yellow-red.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 243 of file color_compat.c.
Create BGYR color table (floating-point)
Generates a color table blue-green-yellow-red.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 257 of file color_compat.c.
Create BYG color table (integer)
Generates a color table blue-yellow-green.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 271 of file color_compat.c.
Create BYG color table (floating-point)
Generates a color table blue-yellow-green.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 285 of file color_compat.c.
Create BYR color table (integer)
Generates a color table blue-yellow-red.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 215 of file color_compat.c.
Create BYR color table (floating-point)
Generates a color table blue-yellow-red.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 229 of file color_compat.c.
Load color rules from predefined color table.
[out] | colors | pointer to Colors structure |
name | name of color table to load | |
min,max | min & max values (used only when color rules are in percentage) |
Definition at line 340 of file raster/color_rules.c.
Load color rules from predefined floating-point color table.
[out] | colors | pointer to Colors structure |
name | name of color table to load | |
min,max | min & max values (used only when color rules are in percentage) |
Definition at line 353 of file raster/color_rules.c.
Make linear grey scale (integer)
Generates a grey scale color table. Each color is a level of grey, increasing from black to white.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 185 of file color_compat.c.
Make linear grey scale (floating-point)
Generates a grey scale color table. Each color is a level of grey, increasing from black to white.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 200 of file color_compat.c.
Create GYR color table (integer)
Generates a color table green-yellow-red.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 156 of file color_compat.c.
Create GYR color table (floating-point)
Generates a color table green-yellow-red.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 170 of file color_compat.c.
void Rast_make_histogram_cs | ( | struct Cell_stats * | statf, |
struct Histogram * | histogram | ||
) |
Creates histogram based on cell statistics.
statf | cell statistics |
histogram | raster histogram |
Definition at line 141 of file histogram.c.
References count, Rast_add_histogram(), Rast_init_histogram(), Rast_next_cell_stat(), Rast_rewind_cell_stats(), and Rast_sort_histogram().
void Rast_make_histogram_eq_colors | ( | struct Colors * | colors, |
struct Cell_stats * | statf | ||
) |
Make histogram-stretched grey colors.
Generates a histogram contrast-stretched grey scale color table that goes from the, histogram information in the Cell_stats structure (see Raster Histograms).
Color range is 0-255.
colors | pointer to Colors structure which holds color info |
statf | pointer to Cell_stats structure which holds cell stats info |
Definition at line 32 of file color_hist.c.
void Rast_make_histogram_log_colors | ( | struct Colors * | colors, |
struct Cell_stats * | statf, | ||
int | min, | ||
int | max | ||
) |
Generates histogram with normalized log transformed grey scale.
Generates histogram with normalized log transformed grey scale from cell stats structure info. Color range is 0-255.
colors | pointer to Colors structure which holds color info |
statf | pointer to Cell_stats structure which holds cell stats info |
min | minimum value |
max | maximum value |
Definition at line 101 of file color_hist.c.
Make rainbow colors (integer)
Generates a "shifted" rainbow color table - yellow to green to cyan to blue to magenta to red. The color table is based on rainbow colors. (Normal rainbow colors are red, orange, yellow, green, blue, indigo, and violet.) This table is good for continuous data, such as elevation.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 124 of file color_compat.c.
Make rainbow colors (floating-point)
Generates a "shifted" rainbow color table - yellow to green to cyan to blue to magenta to red. The color table is based on rainbow colors. (Normal rainbow colors are red, orange, yellow, green, blue, indigo, and violet.) This table is good for continuous data, such as elevation.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 142 of file color_compat.c.
Make color ramp (integer)
Generates a color table with 3 sections: red only, green only, and blue only, each increasing from none to full intensity. This table is good for continuous data, such as elevation.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 90 of file color_compat.c.
Make color ramp (floating-point)
Generates a color table with 3 sections: red only, green only, and blue only, each increasing from none to full intensity. This table is good for continuous data, such as elevation.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 106 of file color_compat.c.
make random colors
Generates random colors. Good as a first pass at a color table for nominal data.
colors | |
min | |
max |
Definition at line 25 of file color_rand.c.
Create RYG color table (integer)
Generates a color table red-yellow-green.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 60 of file color_compat.c.
Create RYG color table (floating-point)
Generates a color table red-yellow-green.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 74 of file color_compat.c.
Make color wave (integer)
Generates a color table with 3 sections: red only, green only, and blue only, each increasing from none to full intensity and back down to none. This table is good for continuous data like elevation.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 29 of file color_compat.c.
Make color wave (floating-point)
Generates a color table with 3 sections: red only, green only, and blue only, each increasing from none to full intensity and back down to none. This table is good for continuous data like elevation.
colors | pointer to Colors structure which holds color info |
min | minimum value |
max | maximum value |
Definition at line 46 of file color_compat.c.
int Rast_map_is_fp | ( | const char * | name, |
const char * | mapset | ||
) |
Check if raster map is floating-point.
Returns true (1) if raster map name in mapset is a floating-point dataset; false(0) otherwise.
name | map name |
mapset | mapset name |
Definition at line 847 of file raster/open.c.
References _, G_fatal_error(), G_file_name(), G_find_raster2(), G_fully_qualified_name(), and GPATH_MAX.
Referenced by gsd_put_legend().
int Rast_map_to_img_str | ( | char * | , |
int | , | ||
unsigned char * | |||
) |
Definition at line 58 of file rast_to_img_string.c.
References CELL_TYPE, DCELL_TYPE, DEF_BLU, DEF_GRN, DEF_RED, FCELL_TYPE, G_find_raster2(), G_free(), G_malloc, NULL, Rast_allocate_c_buf(), Rast_allocate_d_buf(), Rast_allocate_f_buf(), Rast_close(), Rast_free_colors(), Rast_get_map_type(), Rast_get_row(), Rast_is_null_value(), Rast_lookup_colors(), Rast_open_old(), Rast_read_colors(), Rast_window_cols(), and Rast_window_rows().
RASTER_MAP_TYPE Rast_map_type | ( | const char * | name, |
const char * | mapset | ||
) |
Determine raster data type.
Determines if the raster map is floating point or integer. Returns DCELL_TYPE for double maps, FCELL_TYPE for float maps, CELL_TYPE for integer maps, -1 if error has occurred
name | map name |
mapset | mapset where map name lives |
Definition at line 880 of file raster/open.c.
References _, CELL_TYPE, DCELL_TYPE, G_fatal_error(), G_file_name(), G_find_raster2(), GPATH_MAX, and Rast__check_fp_type().
Referenced by Rast__open_old(), Rast__quant_import(), Rast_read_fp_range(), Rast_read_range(), Rast_write_quant(), and Rast_write_range().
void Rast_mark_c_cats | ( | const CELL * | rast_row, |
int | ncols, | ||
struct Categories * | pcats | ||
) |
Looks up the category label for each raster value (CELL).
Looks up the category label for each raster value in the rast_row and updates the marks for labels found.
Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.
rast_row | raster row to update stats |
ncols | number of columns |
pcats | pointer to Categories structure |
Definition at line 494 of file raster/cats.c.
int Rast_mark_cats | ( | const void * | rast_row, |
int | ncols, | ||
struct Categories * | pcats, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Looks up the category label for each raster value (DCELL).
Looks up the category label for each raster value in the rast_row and updates the marks for labels found.
Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.
rast_row | raster row to update stats |
ncols | number of columns |
pcats | pointer to Categories structure |
data_type | map type |
Definition at line 560 of file raster/cats.c.
void Rast_mark_colors_as_fp | ( | struct Colors * | colors | ) |
Mark colors as floating-point.
Sets a flag in the colors structure that indicates that these colors should only be looked up using floating-point raster data (not integer data). In particular if this flag is set, the routine Rast_get_c_colors_min_max() should return min=-255$^3$ and max=255$^3$.
colors | pointer to Colors structure |
Definition at line 394 of file raster/color_read.c.
References Colors::is_float.
void Rast_mark_d_cats | ( | const DCELL * | rast_row, |
int | ncols, | ||
struct Categories * | pcats | ||
) |
Looks up the category label for each raster value (DCELL).
Looks up the category label for each raster value in the rast_row and updates the marks for labels found.
Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.
rast_row | raster row to update stats |
ncols | number of columns |
pcats | pointer to Categories structure |
Definition at line 536 of file raster/cats.c.
void Rast_mark_f_cats | ( | const FCELL * | rast_row, |
int | ncols, | ||
struct Categories * | pcats | ||
) |
Looks up the category label for each raster value (FCELL).
Looks up the category label for each raster value in the rast_row and updates the marks for labels found.
Note: Non-zero mark for i-th label stores the number of of raster cells read so far which are labeled with i-th label and fall into i-th data range.
rast_row | raster row to update stats |
ncols | number of columns |
pcats | pointer to Categories structure |
Definition at line 515 of file raster/cats.c.
char* Rast_mask_info | ( | void | ) |
Definition at line 35 of file mask_info.c.
References _, G_store(), GMAPSET_MAX, GNAME_MAX, name, and Rast__mask_info().
int Rast_maskfd | ( | void | ) |
Test for MASK.
Definition at line 26 of file maskfd.c.
References R__::auto_mask, R__::mask_fd, and Rast__check_for_auto_masking().
Referenced by IL_create_bitmask().
int Rast_next_cell_stat | ( | CELL * | cat, |
long * | count, | ||
struct Cell_stats * | s | ||
) |
Retrieve sorted cell stats.
Retrieves the next cat, count combination from the structure. Returns 0 if there are no more items, non-zero if there are more. For example:
Do not return a record for the NULL-value
cat | raster value | |
[out] | count | |
s | pointer to Cell_stats structure which holds cell stats info |
Definition at line 314 of file cell_stats.c.
References Cell_stats::curoffset, and Cell_stats::N.
Referenced by Rast_make_histogram_cs().
double Rast_northing_to_row | ( | double | north, |
const struct Cell_head * | window | ||
) |
Northing to row.
Converts a northing relative to a window to a row.
Note: The result is a double. Casting it to an integer will give the row number.
north | northing value |
window | pointer to Cell_head |
Definition at line 201 of file raster/window.c.
int Rast_number_of_cats | ( | struct Categories * | pcats | ) |
Get number of raster categories.
pcats | pointer to Categories structure |
Definition at line 1269 of file raster/cats.c.
References Categories::ncats.
int Rast_open_c_new | ( | const char * | name | ) |
Opens a new cell file in a database (compressed)
Opens a new cell file name in the current mapset for writing by Rast_put_row().
The file is created and filled with no data it is assumed that the new cell file is to conform to the current window.
The file must be written sequentially. Use Rast_open_new_random() for non sequential writes.
Note: the open actually creates a temporary file Rast_close() will move the temporary file to the cell file and write out the necessary support files (cellhd, cats, hist, etc.).
Diagnostics: warning message printed if open fails
Warning: calls to Rast_set_window() made after opening a new cell file may create confusion and should be avoided the new cell file will be created to conform to the window at the time of the open.
name | map name |
Definition at line 410 of file raster/open.c.
int Rast_open_c_new_uncompressed | ( | const char * | name | ) |
Opens a new cell file in a database (uncompressed)
See also Rast_open_new().
name | map name |
Definition at line 425 of file raster/open.c.
int Rast_open_fp_new | ( | const char * | name | ) |
Opens new fcell file in a database.
Opens a new floating-point map name in the current mapset for writing. The type of the file (i.e. either double or float) is determined and fixed at this point. The default is FCELL_TYPE. In order to change this default
Use Rast_set_fp_type() where type is one of DCELL_TYPE or FCELL_TYPE.
See warnings and notes for Rast_open_new().
name | map name |
Definition at line 499 of file raster/open.c.
int Rast_open_fp_new_uncompressed | ( | const char * | name | ) |
Opens new fcell file in a database (uncompressed)
See Rast_open_fp_new() for details.
name | map name |
Definition at line 513 of file raster/open.c.
int Rast_open_new | ( | const char * | name, |
RASTER_MAP_TYPE | wr_type | ||
) |
Opens a new raster map.
Opens a new raster map of type wr_type
See warnings and notes for Rast_open_new().
Supported data types:
On CELL_TYPE calls Rast_open_new() otherwise Rast_open_fp_new().
name | map name |
wr_type | raster data type |
Definition at line 997 of file raster/open.c.
int Rast_open_new_uncompressed | ( | const char * | name, |
RASTER_MAP_TYPE | wr_type | ||
) |
Opens a new raster map (uncompressed)
See Rast_open_new().
name | map name |
wr_type | raster data type |
Definition at line 1012 of file raster/open.c.
int Rast_open_old | ( | const char * | name, |
const char * | mapset | ||
) |
Open an existing integer raster map (cell)
Opens the existing cell file name in the mapset for reading by Rast_get_row() with mapping into the current window.
This routine opens the raster map name in mapset for reading. A nonnegative file descriptor is returned if the open is successful. Otherwise a diagnostic message is printed and a negative value is returned. This routine does quite a bit of work. Since GRASS users expect that all raster maps will be resampled into the current region, the resampling index for the raster map is prepared by this routine after the file is opened. The resampling is based on the active module region (see also The_Region}. Preparation required for reading the various raster file formats (see Raster_File_Format for an explanation of the various raster file formats) is also done.
Diagnostics: warning message printed if open fails.
name | map name |
mapset | mapset name where raster map name lives |
Definition at line 112 of file raster/open.c.
References Rast__check_for_auto_masking(), and Rast__open_old().
Referenced by IL_create_bitmask(), open_band_files(), and Rast_map_to_img_str().
int Rast_option_to_interp_type | ( | const struct Option * | option | ) |
Get interpolation method from the option.
Calls G_fatal_error() on unknown interpolation method.
Supported methods:
option | pointer to interpolation option |
Definition at line 193 of file interp.c.
References _, Option::answer, G_fatal_error(), INTERP_BICUBIC, INTERP_BILINEAR, INTERP_NEAREST, and INTERP_UNKNOWN.
int Rast_output_window_cols | ( | void | ) |
Number of columns in active output window.
This routine returns the number of columns in the active output window.
Definition at line 180 of file raster/window.c.
References Cell_head::cols, Rast__init_window(), and R__::wr_window.
Referenced by Rast_allocate_c_output_buf(), Rast_allocate_d_output_buf(), Rast_allocate_f_output_buf(), Rast_allocate_null_output_buf(), Rast_allocate_output_buf(), and Rast_zero_output_buf().
int Rast_output_window_rows | ( | void | ) |
Number of rows in active output window.
This routine returns the number of rows in the active output window.
Definition at line 166 of file raster/window.c.
References Rast__init_window(), Cell_head::rows, and R__::wr_window.
int Rast_parse_color_rule | ( | DCELL | min, |
DCELL | max, | ||
const char * | buf, | ||
DCELL * | val, | ||
int * | r, | ||
int * | g, | ||
int * | b, | ||
int * | norm, | ||
int * | nval, | ||
int * | dflt | ||
) |
Read color rule.
The val output parameter is always an absolute value and is derived from the rule and the min and max values in case the rule is in percents.
Always only one of the norm, nval, and dflt output parameters is set to non-zero value, the others are set to zero.
The return code can be translated to an error message using the Rast_parse_color_rule_error() function.
min,max | min & max values (used only when color rules are in percentage) | |
buf | string with the color rule | |
[out] | val | value which the color is assigned to |
[out] | r,g,b | color values |
[out] | norm | set to non-zero value if the value and color are set |
[out] | nval | set to non-zero value if rule is for null value |
[out] | dflt | set to non-zero value if rule specifies the default color |
Definition at line 60 of file raster/color_rules.c.
const char* Rast_parse_color_rule_error | ( | int | code | ) |
Parse color rule.
code |
Definition at line 114 of file raster/color_rules.c.
References _, CR_ERROR_COLOR_SYNTAX, CR_ERROR_PERCENT, CR_ERROR_RULE_SYNTAX, CR_ERROR_VALUE, and CR_OK.
Print color table.
colors | pointer to Colors structure |
min,max | minimum and maximum value for percentage output (used only when perc is non-zero) |
fp | file where to print color table rules |
perc | TRUE for percentage output |
Definition at line 41 of file color_out.c.
void Rast_put_c_row | ( | int | fd, |
const CELL * | buf | ||
) |
Writes the next row for cell file (CELL version)
See Rast_put_row() for details.
fd | file descriptor where data is to be written |
buf | buffer holding data |
Definition at line 80 of file raster/put_row.c.
References CELL_TYPE, and Rast_put_row().
int Rast_put_cell_title | ( | const char * | , |
const char * | |||
) |
Definition at line 16 of file put_title.c.
References fileinfo::mapset.
void Rast_put_cellhd | ( | const char * | name, |
struct Cell_head * | cellhd | ||
) |
Writes the raster file header.
Writes the cell file header information associated with map layer "map" into current mapset from the structure "cellhd".
name | name of map |
cellhd | structure holding cell header info |
Definition at line 28 of file put_cellhd.c.
References _, G__write_Cell_head(), G_fatal_error(), and G_fopen_new().
void Rast_put_d_row | ( | int | fd, |
const DCELL * | buf | ||
) |
Writes the next row for dcell file (DCELL version)
See Rast_put_row() for details.
fd | file descriptor where data is to be written |
buf | buffer holding data |
Definition at line 110 of file raster/put_row.c.
References DCELL_TYPE, and Rast_put_row().
void Rast_put_f_row | ( | int | fd, |
const FCELL * | buf | ||
) |
Writes the next row for fcell file (FCELL version)
See Rast_put_row() for details.
fd | file descriptor where data is to be written |
buf | buffer holding data |
Definition at line 95 of file raster/put_row.c.
References FCELL_TYPE, and Rast_put_row().
int Rast_put_reclass | ( | const char * | name, |
const struct Reclass * | reclass | ||
) |
Put reclass.
name | map name |
reclass | pointer to Reclass structure |
Definition at line 262 of file reclass.c.
References _, G_fatal_error(), GNAME_MAX, GPATH_MAX, max, Reclass::max, min, Reclass::min, Reclass::num, RECLASS_TABLE, and Reclass::type.
void Rast_put_row | ( | int | fd, |
const void * | buf, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Writes the next row for cell/fcell/dcell file.
Writes the next row for the cell file opened on 'fd' from 'buf' All writes go into NEW files that exactly match the current window. The file must have been opened with Rast_open_new() and be written sequentially, ie no skipping rows.
When the null values are embedded into the data, corresponding cells are changed to 0's and the corresponding null value row is written into null file.
A map cannot be copied using Rast_get_row() and Rast_put_row(). The former resamples the data of the original map into a row buffer that matches the current window. The later writes out rows associated with the window.
Keeps track of the minimum and maximum cell value for use in updating the range file upon close of the cell file. HOWEVER when nulls are not embedded, the cells are considered 0's as far as updating range is concerned, even if the corresponding cell is null in the resulting null file, so programmer should be carefult to set all the null values using Rast_set_null_value() or G_insert_d_null_values() or G_insert_f_null_values().
fd | file descriptor where data is to be written |
buf | buffer holding data |
data_type | raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE) |
Definition at line 65 of file raster/put_row.c.
Referenced by Rast_put_c_row(), Rast_put_d_row(), and Rast_put_f_row().
Adds a new rule to the set of quantization rules.
If dLow < dHigh the rule will be stored with the low and high values interchanged.
Note: currently no cleanup of rules is performed, i.e. redundant rules are not removed. This can't be changed because Categories structure HEAVILY depends of quant rules stored in exactly the same order they are entered. So if the cleanup or rearrangement is done in the future make a flag for add_rule whether or not to do it, then quant will not set this flag.
q | pointer to Quant structure which holds quant rules info |
dLow | minimum fp value |
dHigh | maximum fp value |
cLow | minimum value |
cHigh | maximum value |
Definition at line 478 of file quant.c.
Referenced by Rast_quantize_fp_map_range(), Rast_set_d_cat(), and Rast_set_quant_rules().
void Rast_quant_clear | ( | struct Quant * | q | ) |
Resets the number of defined rules and number of infinite rules to 0.
q | pointer to Quant structure to be reset |
Definition at line 46 of file quant.c.
References Quant::infiniteLeftSet, Quant::infiniteRightSet, and Quant::nofRules.
Referenced by Rast_quant_free(), and Rast_quant_init().
void Rast_quant_free | ( | struct Quant * | q | ) |
Resets and frees allocated memory.
Resets the number of defined rules to 0 and free's space allocated for rules. Calls Rast_quant_clear().
q | pointer to Quant structure to be reset |
Definition at line 60 of file quant.c.
References Quant::active, Quant::fp_lookup, G_free(), Quant::maxNofRules, Quant::nalloc, Rast_quant_clear(), Quant::rules, Quant::table, and Quant::vals.
Referenced by Rast__quant_import(), and Rast_free_cats().
Returns a CELL category for the floating-point value based on the quantization rules in q. The first rule found that applies is used. The rules are searched in the reverse order they are added to q. If no rule is found, the value is first tested against the negative infinite rule, and finally against the positive infinite rule. If none of these rules apply, the NULL-value is returned.
Note: See G_quant_organize_fp_lookup() for details on how the values are looked up from fp_lookup table when it is active. Right now fp_lookup is automatically organized during the first call to Rast_quant_get_cell_value().
q | pointer to Quant structure which holds quant rules info |
dcellValue | fp cell value |
Definition at line 601 of file quant.c.
Referenced by Rast_quant_perform_d(), and Rast_quant_perform_f().
void Rast_quant_get_ith_rule | ( | const struct Quant * | q, |
int | i, | ||
DCELL * | dLow, | ||
DCELL * | dHigh, | ||
CELL * | cLow, | ||
CELL * | cHigh | ||
) |
Returns the i'th quantization rule.
For 0 <= i < Rast_quant_nof_rules(). A larger value for i means that the rule has been added later.
q | pointer to Quant structure which holds quant rules info | |
i | index | |
[out] | dLow | minimum fp value |
[out] | dHigh | maximum fp value |
[out] | cLow | minimum value |
[out] | cHigh | maximum value |
Definition at line 333 of file quant.c.
References Quant_table::cHigh, Quant_table::cLow, Quant_table::dHigh, Quant_table::dLow, and Quant::table.
Referenced by Rast_get_ith_d_cat().
int Rast_quant_get_limits | ( | const struct Quant * | q, |
DCELL * | dMin, | ||
DCELL * | dMax, | ||
CELL * | cMin, | ||
CELL * | cMax | ||
) |
Returns the minimum and maximum cell and dcell values of all the ranges defined.
Extracts the minimum and maximum floating-point and integer values from all the rules (except the "infinite" rules) in q into dmin, dmax, cmin, and cmax.
quant | pointer to Quant structure which holds quant rules info | |
[out] | dmin | minimum fp value |
[out] | dmax | maximum fp value |
[out] | cmin | minimum value |
[out] | cmax | maximum value |
Definition at line 286 of file quant.c.
References Quant::cMax, Quant::cMin, Quant::dMax, Quant::dMin, NO_EXPLICIT_RULE, Rast_set_c_null_value(), and Rast_set_d_null_value().
Referenced by Rast_read_range(), and Rast_write_quant().
Returns in "dLeft" and "c" the rule values.
For the negative infinite interval (see Rast_quant_set_neg_infinite_rule()).
q | pointer to Quant structure which holds quant rules info | |
[out] | dLeft | fp value |
[out] | c | value |
Definition at line 399 of file quant.c.
Referenced by Rast_set_quant_rules().
Returns in "dRight" and "c" the rule values.
For the positive infinite interval (see Rast_quant_set_pos_infinite_rule()).
q | pointer to Quant structure which holds quant rules info | |
[out] | dRight | fp value |
[out] | c | value |
Definition at line 447 of file quant.c.
Referenced by Rast_set_quant_rules().
void Rast_quant_init | ( | struct Quant * | quant | ) |
Initialize the structure.
Initializes the q struct.
quant | pointer to Quant structure to be initialized |
Definition at line 179 of file quant.c.
References Quant::active, Quant::fp_lookup, Quant::maxNofRules, Rast_quant_clear(), Quant::round_only, and Quant::truncate_only.
Referenced by Rast_init_cats(), Rast_quantize_fp_map_range(), Rast_read_quant(), Rast_round_fp_map(), Rast_set_quant_rules(), and Rast_truncate_fp_map().
int Rast_quant_is_round | ( | const struct Quant * | quant | ) |
Returns whether or not quant rules are set to round map.
quant | pointer to Quant structure which holds quant rules info |
Definition at line 208 of file quant.c.
References Quant::round_only.
Referenced by Rast_read_range().
int Rast_quant_is_truncate | ( | const struct Quant * | quant | ) |
Returns whether or not quant rules are set to truncate map.
quant | pointer to Quant structure which holds quant rules info |
Definition at line 196 of file quant.c.
References Quant::truncate_only.
Referenced by Rast_read_range().
int Rast_quant_nof_rules | ( | const struct Quant * | q | ) |
Returns the number of quantization rules defined.
This number does not include the 2 infinite intervals.
q | pointer to Quant structure which holds quant rules info |
Definition at line 315 of file quant.c.
References Quant::nofRules.
Referenced by Rast3d_write_cats(), and Rast_get_next_marked_d_cat().
Returns in "cell" the quantized CELL values.
Returns in "cell" the quantized CELL values corresponding to the DCELL values stored in "dcell". the number of elements quantized is n. quantization is performed by repeated application of Rast_quant_get_cell_value().
q | pointer to Quant structure which holds quant rules info | |
dcell | pointer to fp cell values array | |
[out] | cell | pointer cell values array |
n | number of cells |
Definition at line 721 of file quant.c.
References Rast_is_d_null_value, Rast_quant_get_cell_value(), and Rast_set_c_null_value().
Same as Rast_quant_perform_d(), except the type.
q | pointer to Quant structure which holds quant rules info | |
fcell | pointer to fp cell values array | |
[out] | cell | pointer cell values array |
n | number of cells |
Definition at line 741 of file quant.c.
References Rast_is_f_null_value, Rast_quant_get_cell_value(), and Rast_set_c_null_value().
void Rast_quant_reverse_rule_order | ( | struct Quant * | q | ) |
Rreverses the order in which the qunatization rules are stored.
See also Rast_quant_get_ith_rule() and Rast_quant_perform_d()).
q | pointer to Quant rules which holds quant rules info |
Definition at line 522 of file quant.c.
References Quant_table::cHigh, Quant_table::cLow, Quant_table::dHigh, Quant_table::dLow, Quant::nofRules, and Quant::table.
void Rast_quant_round | ( | struct Quant * | quant | ) |
Sets the quant rules to perform simple rounding on floats.
Sets the quant for q rules to perform simple rounding on floats.
quant | pointer to Quant structure which holds quant rules info |
Definition at line 234 of file quant.c.
References Quant::round_only.
Referenced by Rast_round_fp_map().
Defines a rule for values "dLeft" and smaller.
Values in this range are mapped to "c" if none of the "finite" quantization rules applies.
q | pointer to Quant structure which holds quant rules info |
dLeft | fp value |
c | value |
Definition at line 373 of file quant.c.
Referenced by Rast_set_quant_rules().
Defines a rule for values "dRight" and larger.
Values in this range are mapped to "c" if none of the "finite" quantization rules or the negative infinite rule applies.
q | pointer to Quant structure which holds quant rules info |
dRight | fp value |
c | value |
Definition at line 421 of file quant.c.
Referenced by Rast_set_quant_rules().
void Rast_quant_truncate | ( | struct Quant * | quant | ) |
Sets the quant rules to perform simple truncation on floats.
Sets the quant for q rules to perform simple truncation on floats.
quant | pointer to Quant structure which holds quant rules info |
Definition at line 221 of file quant.c.
References Quant::truncate_only.
Referenced by Rast_set_quant_rules(), and Rast_truncate_fp_map().
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 whould 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(), 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 whould 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 Rast_quant_add_rule(), Rast_quant_init(), and Rast_write_quant().
Referenced by Rast_quantize_fp_map().
int Rast_raster_cmp | ( | const void * | v1, |
const void * | v2, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Compares raster values.
v1,v2 | values to be compared |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 29 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, and Rast_is_null_value().
void Rast_raster_cpy | ( | void * | v1, |
const void * | v2, | ||
int | n, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Copies raster values.
If v2
is null value, sets v2
to null value. n
is typically size of the destination array and the source array is at least that large.
v1 | destination array for raster values |
v2 | source array with raster values |
n | number of values to copy |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 79 of file raster/raster.c.
References Rast_cell_size().
int Rast_read_band_reference | ( | const char * | name, |
const char * | mapset, | ||
char ** | filename, | ||
char ** | band_reference | ||
) |
Read raster map band reference identifier.
Note that output arguments should be freed by the caller using G_free().
name | map name | |
mapset | mapset name | |
[out] | filename | filename JSON reference |
[out] | band_reference | band reference identifier |
Definition at line 54 of file raster/band_reference.c.
int Rast_read_cats | ( | const char * | name, |
const char * | mapset, | ||
struct Categories * | pcats | ||
) |
Read raster category file.
The category file for raster map name in mapset is read into the cats structure. If there is an error reading the category file, a diagnostic message is printed and -1 is returned. Otherwise, 0 is returned.
name | raster map name | |
mapset | mapset name | |
[out] | pcats | pointer to Cats structure |
Definition at line 104 of file raster/cats.c.
Referenced by gsd_put_legend().
int Rast_read_color_rule | ( | void * | closure, |
DCELL | min, | ||
DCELL | max, | ||
DCELL * | val, | ||
int * | r, | ||
int * | g, | ||
int * | b, | ||
int * | norm, | ||
int * | nval, | ||
int * | dflt | ||
) |
Read color rule.
closure | ||
min,max | min & max values (used only when color rules are in percentage) | |
val | value | |
[out] | r,g,b | color values |
norm | ||
nval | ||
dflt |
Definition at line 152 of file raster/color_rules.c.
int Rast_read_color_rules | ( | struct Colors * | colors, |
DCELL | min, | ||
DCELL | max, | ||
read_rule_fn * | read_rule, | ||
void * | closure | ||
) |
Read color rules from file.
[out] | colors | pointer to Colors structure |
min,max | min & max values (used only when color rules are in percentage) | |
read_rule | pointer to read_rule_fn structure | |
closure |
Definition at line 198 of file raster/color_rules.c.
int Rast_read_colors | ( | const char * | name, |
const char * | mapset, | ||
struct Colors * | colors | ||
) |
Read color table of raster map.
The color table for the raster map name in the specified mapset is read into the colors structure. If the data layer has no color table, a default color table is generated and 0 is returned. If there is an error reading the color table, a diagnostic message is printed and -1 is returned. If the color table is read ok, 1 is returned.
This routine reads the rules from the color file. If the input raster map is is a floating-point map it calls Rast_mark_colors_as_fp().
Note: If a secondary color file for map name name exists in the current project, that color file is read. This allows the user to define their own color lookup tables for cell maps found in other mapsets.
Warning message is printed if the color file is missing or invalid.
name | map name | |
mapset | mapset name | |
[out] | colors | pointer to Colors structure |
Definition at line 55 of file raster/color_read.c.
Referenced by gsd_put_legend(), and Rast_map_to_img_str().
int Rast_read_fp_range | ( | const char * | name, |
const char * | mapset, | ||
struct FPRange * | drange | ||
) |
Read floating-point range.
Read the floating point range file drange. This file is written in binary using XDR format.
An empty range file indicates that the min, max are undefined. This is a valid case, and the result should be an initialized range struct with no defined min/max. If the range file is missing and the map is a floating-point map, this function will create a default range by calling G_construct_default_range().
name | map name |
mapset | mapset name |
drange | pointer to FPRange structure which holds fp range |
Definition at line 71 of file range.c.
References _, CELL_TYPE, Range::first_time, G_debug(), G_find_file2_misc(), G_fully_qualified_name(), G_open_old_misc(), G_warning(), G_xdr_get_double(), Range::max, Range::min, Rast_init(), Rast_init_fp_range(), Rast_map_type(), Rast_read_range(), Rast_update_fp_range(), and XDR_DOUBLE_NBYTES.
Referenced by gsd_put_legend(), Rast_quantize_fp_map(), and Rast_read_range().
int Rast_read_histogram | ( | const char * | name, |
const char * | mapset, | ||
struct Histogram * | histogram | ||
) |
read the histogram information
Reads the histogram information associated with map layer "map" in mapset "mapset" into the structure "histogram".
note: a warning message is printed if the file is missing or incorrect
name | name of map |
mapset | mapset that map belongs to |
histogram | struct for histogram |
Definition at line 44 of file histogram.c.
References _, count, G_fatal_error(), G_find_file2_misc(), G_fopen_old_misc(), G_warning(), NULL, Histogram::num, Rast_extend_histogram(), Rast_init_histogram(), and Rast_sort_histogram().
int Rast_read_history | ( | const char * | name, |
const char * | mapset, | ||
struct History * | hist | ||
) |
Read raster history file.
This routine reads the history file for the raster map name in mapset into the hist structure.
A diagnostic message is printed and -1 is returned if there is an error reading the history file. Otherwise, 0 is returned.
name | map name |
mapset | mapset name |
hist | pointer to History structure which holds history info |
Definition at line 106 of file history.c.
References _, G_fopen_old(), G_warning(), G_zero(), and Rast__read_history().
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 186 of file quant_rw.c.
References Rast__quant_import(), and Rast_quant_init().
Referenced by Rast_read_range().
int Rast_read_range | ( | const char * | name, |
const char * | mapset, | ||
struct Range * | range | ||
) |
Read raster range (CELL)
This routine reads the range information for the raster map name in mapset into the range structure.
A diagnostic message is printed and -1 is returned if there is an error reading the range file. Otherwise, 0 is returned.
Old range file (those with 4 numbers) should treat zeros in this file as NULL-values. New range files (those with just 2 numbers) should treat these numbers as real data (zeros are real data in this case). An empty range file indicates that the min, max are undefined. This is a valid case, and the result should be an initialized range struct with no defined min/max. If the range file is missing and the map is a floating-point map, this function will create a default range by calling G_construct_default_range().
name | map name | |
mapset | mapset name | |
[out] | range | pointer to Range structure which holds range info |
Definition at line 160 of file range.c.
References _, CELL_TYPE, count, G_find_file2_misc(), G_fopen_old_misc(), G_fully_qualified_name(), G_warning(), NULL, Rast_get_fp_range_min_max(), Rast_init_range(), Rast_map_type(), Rast_quant_get_limits(), Rast_quant_is_round(), Rast_quant_is_truncate(), Rast_read_fp_range(), Rast_read_quant(), Rast_update_range(), and x.
Referenced by gsd_put_legend(), Rast_get_max_c_cat(), and Rast_read_fp_range().
int Rast_read_rstats | ( | const char * | name, |
const char * | mapset, | ||
struct R_stats * | rstats | ||
) |
Read raster stats.
Read the stats file stats. This file is written in binary using XDR format.
An empty stats file indicates that all cells are NULL. This is a valid case, and the result should be an initialized rstats struct with no defined stats. If the stats file is missing this function will create a default stats with count = 0.
name | map name |
mapset | mapset name |
rstats | pointer to R_stats structure which holds raster stats |
Definition at line 275 of file range.c.
References count, Rast_init(), and XDR_DOUBLE_NBYTES.
char* Rast_read_units | ( | const char * | name, |
const char * | mapset | ||
) |
Get a raster map's units metadata string.
Read the raster's units metadata file and put string in str
name | raster map name |
mapset | mapset name |
Definition at line 36 of file raster_metadata.c.
char* Rast_read_vdatum | ( | const char * | name, |
const char * | mapset | ||
) |
Get a raster map's vertical datum metadata string.
Read the raster's vertical datum metadata file and put string in str
name | raster map name |
mapset | mapset name |
Definition at line 65 of file raster_metadata.c.
int Rast_read_vector_cats | ( | const char * | name, |
const char * | mapset, | ||
struct Categories * | pcats | ||
) |
Read vector category file.
Note: This function works with old vector format.
The category file for vector map name in mapset is read into the cats structure. If there is an error reading the category file, a diagnostic message is printed and -1 is returned. Otherwise, 0 is returned.
name | vector map name | |
mapset | mapset name | |
[out] | pcats | pointer to Cats structure |
Definition at line 140 of file raster/cats.c.
int Rast_remove_band_reference | ( | const char * | name | ) |
Remove band reference from raster map.
Only band reference files in current mapset can be removed.
name | map name |
Definition at line 123 of file raster/band_reference.c.
References G_remove_misc().
int Rast_remove_colors | ( | const char * | name, |
const char * | mapset | ||
) |
Remove color table of raster map.
name | name of raster map |
mapset | name of mapset |
Definition at line 28 of file raster/color_remove.c.
References G_mapset(), G_name_is_fully_qualified(), G_remove(), GMAPSET_MAX, and GNAME_MAX.
void Rast_remove_histogram | ( | const char * | name | ) |
Removes the histogram.
Removes the histogram information associated with map layer "name"
name | name of map |
Definition at line 344 of file histogram.c.
References G_remove_misc().
void Rast_rewind_cats | ( | struct Categories * | pcats | ) |
Rewind raster categories.
After call to this function Rast_get_next_marked_cat() returns the first marked cat label.
pcats | pointer to Categories structure |
Definition at line 588 of file raster/cats.c.
References Categories::last_marked_rule.
int Rast_rewind_cell_stats | ( | struct Cell_stats * | s | ) |
Reset/rewind cell stats.
The structure s is rewound (i.e., positioned at the first raster category) so that sorted sequential retrieval can begin.
s | pointer to Cell_stats structure which holds cell stats info |
Definition at line 250 of file cell_stats.c.
Referenced by Rast_make_histogram_cs().
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 Rast_quant_init(), Rast_quant_round(), and Rast_write_quant().
int Rast_row_repeat_nomask | ( | int | fd, |
int | row | ||
) |
Loops rows until mismatch?.
This routine works fine if the mask is not set. It may give incorrect results with a mask, since the mask row may have a different repeat value. The issue can be fixed by doing it for the mask as well and using the smaller value.
fd | file descriptor |
row | starting row |
Definition at line 134 of file raster/window_map.c.
References fileinfo::C1, fileinfo::C2, count, R__::fileinfo, R__::rd_window, and Cell_head::rows.
double Rast_row_to_northing | ( | double | row, |
const struct Cell_head * | window | ||
) |
Row to northing.
Converts a row relative to a window to a northing.
Note: row is a double:
row | row number | |
[in] | window | pointer to Cell_head |
Definition at line 244 of file raster/window.c.
void Rast_row_update_fp_range | ( | const void * | rast, |
int | n, | ||
struct FPRange * | range, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Update range structure based on raster row (floating-point)
This routine updates the range data just like Rast_update_range(), but for n values from the cell array.
cell | raster values |
n | number of values |
range | pointer to Range structure which holds range info |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 630 of file range.c.
References CELL_TYPE, R_stats::count, DCELL_TYPE, FCELL_TYPE, FPRange::first_time, G_incr_void_ptr, FPRange::max, min, FPRange::min, Rast_cell_size(), Rast_is_null_value(), FPRange::rstats, R_stats::sum, and R_stats::sumsq.
Update range structure based on raster row (CELL)
This routine updates the range data just like Rast_update_range(), but for n values from the cell array.
cell | raster values |
n | number of values |
range | pointer to Range structure which holds range info |
Definition at line 572 of file range.c.
References Rast__row_update_range().
int Rast_set_c_cat | ( | const CELL * | rast1, |
const CELL * | rast2, | ||
const char * | label, | ||
struct Categories * | pcats | ||
) |
Set a raster category label (CELL)
Adds the label for range rast1 through rast2 in category structure pcats.
rast1,rast2 | raster values (range) |
label | category label |
pcats | pointer to Categories structure |
Definition at line 770 of file raster/cats.c.
References CELL_TYPE, and Rast_set_cat().
Set a category color (CELL)
The red, green, and blue intensities for the color associated with category cat are set in the colors structure. The intensities must be in the range 0 - 255. Values below zero are set as zero, values above 255 are set as 255.
Warning: Use of this routine is discouraged because it defeats the new color logic.
It is provided only for backward compatibility. Overuse can create large color tables. Rast_add_c_color_rule() should be used whenever possible.
Note: The colors structure must have been initialized by G_init_color().
cat | raster cell value |
r | red value |
g | green value |
b | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 41 of file color_set.c.
Set color range (CELL version)
min,max | minimum and maximum value |
colors | pointer to Colors structure which holds color info |
Definition at line 24 of file color_range.c.
void Rast_set_c_null_value | ( | CELL * | cellVals, |
int | numVals | ||
) |
To set a number of CELL raster values to NULL.
cellVals | pointer to CELL values to set to null |
numVals | number of values to set to null |
Definition at line 124 of file null_val.c.
Referenced by N_copy_array_2d(), Rast_fpreclass_perform_di(), Rast_fpreclass_perform_fi(), Rast_fpreclass_perform_ii(), Rast_get_range_min_max(), Rast_init_range(), Rast_quant_get_limits(), Rast_quant_perform_d(), Rast_quant_perform_f(), and Rast_set_null_value().
void Rast_set_c_value | ( | void * | rast, |
CELL | cval, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Places a CELL raster value.
If Rast_is_c_null_value() is true, sets p to null value. Converts CELL val to data_type (type of p) and stores result in p. Used for assigning CELL values to raster cells of any type.
rast | pointer to raster cell value |
cval | value to set |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 96 of file raster/raster.c.
int Rast_set_cat | ( | const void * | rast1, |
const void * | rast2, | ||
const char * | label, | ||
struct Categories * | pcats, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Set a raster category label.
Adds the label for range rast1 through rast2 in category structure pcats.
rast1,rast2 | raster values (range) |
label | category label |
pcats | pointer to Categories structure |
data_type | map type |
Definition at line 914 of file raster/cats.c.
References Rast_get_d_value(), and Rast_set_d_cat().
Referenced by Rast_set_c_cat(), and Rast_set_f_cat().
void Rast_set_cats_fmt | ( | const char * | fmt, |
double | m1, | ||
double | a1, | ||
double | m2, | ||
double | a2, | ||
struct Categories * | pcats | ||
) |
Set category fmt (?)
fmt | |
m1 | |
a1 | |
m2 | |
a2 | |
pcats | pointer to Categories structure |
Definition at line 1190 of file raster/cats.c.
void Rast_set_cats_title | ( | const char * | title, |
struct Categories * | pcats | ||
) |
Set title in category structure.
The title is copied into the pcats structure.
title | title |
pcats | pointer to Categories structure |
Definition at line 1171 of file raster/cats.c.
References G_newlines_to_spaces(), G_store(), G_strip(), NULL, and Categories::title.
Referenced by Rast_init_cats().
void Rast_set_cell_format | ( | int | n | ) |
Sets the format for subsequent opens on new integer cell files (uncompressed and random only).
Warning: subsequent put_row calls will only write n+1 bytes per cell. If the data requires more, the cell file will be written incorrectly (but with n+1 bytes per cell)
When writing float map: format is -1
n | format |
Definition at line 455 of file raster/open.c.
References R__::nbytes.
int Rast_set_d_cat | ( | const DCELL * | rast1, |
const DCELL * | rast2, | ||
const char * | label, | ||
struct Categories * | pcats | ||
) |
Set a raster category label (DCELL)
Adds the label for range rast1 through rast2 in category structure pcats.
rast1,rast2 | raster values (range) |
label | category label |
pcats | pointer to Categories structure |
Definition at line 808 of file raster/cats.c.
References G_free(), G_malloc, G_newlines_to_spaces(), G_realloc, G_store(), G_strip(), Categories::labels, Categories::marks, Categories::nalloc, Categories::ncats, NULL, Categories::num, Categories::q, Rast_get_ith_d_cat(), Rast_is_d_null_value, and Rast_quant_add_rule().
Referenced by Rast_copy_cats(), and Rast_set_cat().
Set a category color (DCELL)
See Rast_set_c_color() for detailed information.
val | raster cell value |
r | red value |
g | green value |
b | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 60 of file color_set.c.
Set color range (DCELL version)
min,max | minimum and maximum value |
colors | pointer to Colors structure which holds color info |
Definition at line 42 of file color_range.c.
void Rast_set_d_null_value | ( | DCELL * | dcellVals, |
int | numVals | ||
) |
To set a number of DCELL raster values to NULL.
dcellVals | pointer to DCELL values to set to null |
numVals | number of values to set to null |
Definition at line 155 of file null_val.c.
Referenced by c_ave(), c_intr(), c_kurt(), c_max(), c_maxx(), c_median(), c_min(), c_minx(), c_quant(), c_range(), c_skew(), c_stddev(), c_sum(), c_var(), N_copy_array_2d(), Rast_fpreclass_perform_dd(), Rast_fpreclass_perform_fd(), Rast_fpreclass_perform_id(), Rast_get_fp_range_min_max(), Rast_get_ith_d_cat(), Rast_init_fp_range(), Rast_quant_get_limits(), Rast_set_null_value(), w_ave(), w_kurt(), w_max(), w_median(), w_min(), w_quant(), w_skew(), w_stddev(), w_sum(), and w_var().
void Rast_set_d_value | ( | void * | rast, |
DCELL | dval, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Places a DCELL raster value.
If Rast_is_d_null_value() is true, sets p to null value. Converts DCELL val to data_type (type of p) and stores result in p. Used for assigning DCELL values to raster cells of any type.
rast | pointer to raster cell value |
fval | value to set |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 163 of file raster/raster.c.
Referenced by Rast_get_next_marked_cat().
void Rast_set_default_color | ( | int | red, |
int | grn, | ||
int | blu, | ||
struct Colors * | colors | ||
) |
Set default color value.
Sets the default color (in colors) to red, green, blue. This is the color for values which do not have an explicit rule.
red | red value |
grn | green value |
blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 100 of file color_set.c.
int Rast_set_f_cat | ( | const FCELL * | rast1, |
const FCELL * | rast2, | ||
const char * | label, | ||
struct Categories * | pcats | ||
) |
Set a raster category label (FCELL)
Adds the label for range rast1 through rast2 in category structure pcats.
rast1,rast2 | raster values (range) |
label | category label |
pcats | pointer to Categories structure |
Definition at line 788 of file raster/cats.c.
References FCELL_TYPE, and Rast_set_cat().
void Rast_set_f_null_value | ( | FCELL * | fcellVals, |
int | numVals | ||
) |
To set a number of FCELL raster values to NULL.
fcellVals | pointer to FCELL values to set to null |
numVals | number of values to set to null |
Definition at line 138 of file null_val.c.
Referenced by N_copy_array_2d(), Rast_fpreclass_perform_df(), Rast_fpreclass_perform_ff(), Rast_fpreclass_perform_if(), Rast_get_f_value(), and Rast_set_null_value().
void Rast_set_f_value | ( | void * | rast, |
FCELL | fval, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Places a FCELL raster value.
If Rast_is_f_null_value() is true, sets p to null value. Converts FCELL val to data_type (type of p) and stores result in p. Used for assigning FCELL values to raster cells of any type.
rast | pointer to raster cell value |
fval | value to set |
data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 129 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, Rast_is_f_null_value, and Rast_set_null_value().
void Rast_set_fp_type | ( | RASTER_MAP_TYPE | map_type | ) |
Set raster map floating-point data format.
This controls the storage type for floating-point maps. It affects subsequent calls to G_open_fp_map_new(). The type must be one of FCELL_TYPE (float) or DCELL_TYPE (double). The use of this routine by applications is discouraged since its use would override user preferences.
type | raster data type |
Definition at line 820 of file raster/open.c.
References _, DCELL_TYPE, FCELL_TYPE, R__::fp_type, G_fatal_error(), fileinfo::map_type, and Rast__init().
sets the histogram value for cat to count
sets the histogram value for cat to count
cat | category |
count | |
histogram | struct for histogram |
Definition at line 386 of file histogram.c.
References Histogram::Histogram_list::cat, count, Histogram::Histogram_list::count, Histogram::list, Histogram::num, and Rast_extend_histogram().
void Rast_set_history | ( | struct History * | hist, |
int | field, | ||
const char * | str | ||
) |
Set the string of a specific history field.
hist | pointer to History structure which holds history info |
field | number of a specific history field, should be accessed with macros (HIST_MAPID, ...) |
str | string of the history field |
Definition at line 192 of file history.c.
References History::fields, G_free(), G_store(), and NULL.
void Rast_set_input_window | ( | struct Cell_head * | window | ) |
Establishes 'window' as the current working window for input.
Any opened cell files has its file-to-window mapping reworked.
window | window to become operative window |
Definition at line 96 of file raster/set_window.c.
void Rast_set_null_value | ( | void * | buf, |
int | numVals, | ||
RASTER_MAP_TYPE | data_type | ||
) |
To set one or more raster values to null.
buf | pointer to values to set to null |
numVals | number of values to set to null |
data_type | type of raster - CELL, FCELL, DCELL |
Definition at line 98 of file null_val.c.
References _, CELL_TYPE, DCELL_TYPE, FCELL_TYPE, G_warning(), Rast_set_c_null_value(), Rast_set_d_null_value(), and Rast_set_f_null_value().
Referenced by Rast__set_null_value(), Rast_get_vrt_row(), and Rast_set_f_value().
void Rast_set_null_value_color | ( | int | red, |
int | grn, | ||
int | blu, | ||
struct Colors * | colors | ||
) |
Set color for NULL-value.
Sets the color (in colors) for the NULL-value to red, green, blue.
red | red value |
grn | green value |
blu | blue value |
colors | pointer to Colors structure which holds color info |
Definition at line 79 of file color_set.c.
void Rast_set_output_window | ( | struct Cell_head * | window | ) |
Establishes 'window' as the current working window for output.
window | window to become operative window |
Definition at line 74 of file raster/set_window.c.
void Rast_set_quant_rules | ( | int | fd, |
struct Quant * | q | ||
) |
Sets quant translation rules for raster map opened for reading.
Returned by Rast_open_old(). After calling this function, Rast_get_c_row() and Rast_get_c_row() will use rules defined by q (instead of using rules defined in map's quant file) to convert floats to ints.
fd | file descriptor (cell file) |
q | pointer to Quant structure |
Definition at line 1031 of file raster/open.c.
References _, Quant_table::cHigh, Quant_table::cLow, Quant_table::dHigh, Quant_table::dLow, R__::fileinfo, G_fatal_error(), Quant::nofRules, fileinfo::open_mode, OPEN_OLD, fileinfo::quant, Rast_quant_add_rule(), Rast_quant_get_neg_infinite_rule(), Rast_quant_get_pos_infinite_rule(), Rast_quant_init(), Rast_quant_set_neg_infinite_rule(), Rast_quant_set_pos_infinite_rule(), Rast_quant_truncate(), Quant::table, and Quant::truncate_only.
void Rast_set_window | ( | struct Cell_head * | window | ) |
Establishes 'window' as the current working window.
window | window to become operative window |
Definition at line 43 of file raster/set_window.c.
Referenced by D_setup().
Definition at line 17 of file color_shift.c.
Definition at line 22 of file color_shift.c.
void Rast_short_history | ( | const char * | name, |
const char * | type, | ||
struct History * | hist | ||
) |
Initialize history structure.
This routine initializes the hist structure, recording the date, user, module name and the raster map name structure. The type can be "raster", "reclass", "GDAL-link", or "virtual".
Note: This routine only initializes the data structure. It does not write the history file.
name | map name |
type | map type |
hist | pointer to History structure which holds history info |
int Rast_sort_cats | ( | struct Categories * | pcats | ) |
Sort categories.
pcats | pointer to Categories structure |
Definition at line 1282 of file raster/cats.c.
References G_debug(), Categories::ncats, and Rast_copy_cats().
int Rast_sort_histogram | ( | struct Histogram * | histogram | ) |
Sorts the histogram.
Sorts the histogram in ascending order by category, combining (by adding) elements that have the same category.
histogram | struct for histogram |
Definition at line 228 of file histogram.c.
Referenced by Rast_make_histogram_cs(), and Rast_read_histogram().
int Rast_sort_histogram_by_count | ( | struct Histogram * | histogram | ) |
Sorts the histogram by counts.
Sorts the histogram in ascending order by counts then category. No combining is done.
histogram | struct for histogram |
Definition at line 288 of file histogram.c.
References LIST, list, Histogram::list, and Histogram::num.
void Rast_suppress_masking | ( | void | ) |
Suppresses masking.
Definition at line 87 of file auto_mask.c.
References R__::auto_mask, R__::mask_fd, Rast__init(), and Rast_close().
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 Rast_quant_init(), Rast_quant_truncate(), and Rast_write_quant().
void Rast_unmark_cats | ( | struct Categories * | pcats | ) |
Sets marks for all categories to 0.
This initializes Categories structure for subsequent calls to Rast_mark_cats() for each row of data, where non-zero mark for i-th label means that some of the cells in rast_row are labeled with i-th label and fall into i-th data range. These marks help determine from the Categories structure which labels were used and which weren't.
pcats | pointer to Categories structure |
Definition at line 471 of file raster/cats.c.
References Categories::marks, and Categories::ncats.
void Rast_unopen | ( | int | fd | ) |
Unopen a raster map.
The raster map opened on file descriptor fd is closed. Memory allocated for raster processing is freed. If open for writing, the raster map is not created and the temporary file created when the raster map was opened is removed (see Creating and Opening New Raster Files). This routine is useful when errors are detected and it is desired to not create the new raster map. While it is true that the raster map will not be created if the module exits without closing the file, the temporary file will not be removed at module exit. GRASS database management will eventually remove the temporary file, but the file can be quite large and will take up disk space until GRASS does remove it. Use this routine as a courtesy to the user.
fd | file descriptor |
Definition at line 132 of file raster/close.c.
References _, R__::fileinfo, R__::fileinfo_count, G_fatal_error(), fileinfo::open_mode, and OPEN_OLD.
Referenced by Rast__check_for_auto_masking(), and Rast_get_vrt_row().
void Rast_unset_window | ( | void | ) |
Unset current window.
Definition at line 63 of file raster/set_window.c.
References G_debug(), and R__::window_set.
void Rast_unsuppress_masking | ( | void | ) |
Unsuppresses masking.
Definition at line 106 of file auto_mask.c.
References R__::auto_mask, R__::mask_fd, Rast__check_for_auto_masking(), and Rast__init().
int Rast_update_cell_stats | ( | const CELL * | cell, |
int | n, | ||
struct Cell_stats * | s | ||
) |
Add data to cell stats.
The n CELL values in the data array are inserted (and counted) in the Cell_stats structure.
Look for NULLs and update the NULL-value count.
cell | raster values |
n | number of values |
s | pointer to Cell_stats structure which holds cell stats info |
Definition at line 62 of file cell_stats.c.
Update range structure (floating-point)
Compares the cat value with the minimum and maximum values in the range structure, modifying the range if cat extends the range.
NULL-values must be detected and ignored.
val | raster value |
range | pointer to Range structure which holds range info |
Definition at line 545 of file range.c.
References FPRange::first_time, FPRange::max, min, FPRange::min, and Rast_is_d_null_value.
Referenced by Rast3d_read_range(), and Rast_read_fp_range().
Update range structure (CELL)
Compares the cat value with the minimum and maximum values in the range structure, modifying the range if cat extends the range.
NULL-values must be detected and ignored.
cat | raster value |
range | pointer to Range structure which holds range info |
Definition at line 517 of file range.c.
References Range::first_time, Range::max, min, Range::min, and Rast_is_c_null_value.
Referenced by Rast_construct_default_range(), and Rast_read_range().
void Rast_want_histogram | ( | int | flag | ) |
Save histogram for newly create raster map (cell)
If newly created cell files should have histograms, set flag=1 otherwise set flag=0. Applies to subsequent opens.
flag | flag indicator |
Definition at line 438 of file raster/open.c.
References R__::want_histogram.
int Rast_window_cols | ( | void | ) |
Number of columns in active window.
These routines return the number of rows and columns (respectively) in the active module region. Before raster maps can be read or written, it is necessary to known how many rows and columns are in the active region. For example:
Definition at line 120 of file raster/window.c.
References _, Cell_head::cols, G_fatal_error(), Rast__init_window(), R__::split_window, and R__::wr_window.
Referenced by Rast_allocate_buf(), Rast_allocate_c_buf(), Rast_allocate_d_buf(), Rast_allocate_f_buf(), Rast_allocate_null_buf(), Rast_map_to_img_str(), and Rast_zero_buf().
int Rast_window_rows | ( | void | ) |
Number of rows in active window.
This routine returns the number of rows in the active module window. Before raster files can be read or written, it is necessary to known how many rows are in the active window. For example:
Definition at line 85 of file raster/window.c.
References _, G_fatal_error(), Rast__init_window(), Cell_head::rows, R__::split_window, and R__::wr_window.
Referenced by Rast_map_to_img_str().
int Rast_write_band_reference | ( | const char * | name, |
const char * | filename, | ||
const char * | band_reference | ||
) |
Write raster map band reference identifier.
name | map name |
filename | filename JSON reference |
band_reference | band reference identifier |
Definition at line 94 of file raster/band_reference.c.
void Rast_write_cats | ( | const char * | name, |
struct Categories * | cats | ||
) |
Write raster category file.
Writes the category file for the raster map name in the current mapset from the cats structure.
name | map name |
cats | pointer to Categories structure |
Definition at line 938 of file raster/cats.c.
void Rast_write_colors | ( | const char * | name, |
const char * | mapset, | ||
struct Colors * | colors | ||
) |
Write map layer color table.
The color table is written for the raster map name in the specified mapset from the colors structure.
If there is an error, -1 is returned. No diagnostic is printed. Otherwise, 1 is returned.
The colors structure must be created properly, i.e., Rast_init_colors() to initialize the structure and Rast_add_c_color_rule() to set the category colors. These routines are called by higher level routines which read or create entire color tables, such as Rast_read_colors() or Rast_make_ramp_colors().
Note: The calling sequence for this function deserves special attention. The mapset parameter seems to imply that it is possible to overwrite the color table for a raster map which is in another mapset. However, this is not what actually happens. It is very useful for users to create their own color tables for raster maps in other mapsets, but without overwriting other users' color tables for the same raster map. If mapset is the current mapset, then the color file for name will be overwritten by the new color table. But if mapset is not the current mapset, then the color table is actually written in the current mapset under the colr2
element as: colr2/mapset/name
.
The rules are written out using floating-point format, removing trailing zeros (possibly producing integers). The flag marking the colors as floating-point is not written.
If the environment variable FORCE_GRASS3_COLORS is set (to anything at all) then the output format is 3.0, even if the structure contains 4.0 rules. This allows users to create 3.0 color files for export to sites which don't yet have 4.0
name | map name |
mapset | mapset name |
colors | pointer to structure Colors which holds color info |
Definition at line 72 of file raster/color_write.c.
void Rast_write_fp_range | ( | const char * | name, |
const struct FPRange * | range | ||
) |
Write raster range file (floating-point)
Write the floating point range file f_range
. This file is written in binary using XDR format. If there is no defined min/max in range, an empty f_range
file is created.
name | map name |
range | pointer to FPRange which holds fp range info |
Definition at line 406 of file range.c.
References _, FPRange::first_time, G_fatal_error(), G_open_new_misc(), G_remove_misc(), G_xdr_put_double(), FPRange::max, FPRange::min, Rast_init(), Rast_write_rstats(), FPRange::rstats, and XDR_DOUBLE_NBYTES.
void Rast_write_histogram | ( | const char * | name, |
const struct Histogram * | histogram | ||
) |
Writes the histogram information.
Writes the histogram information associated with map layer "name"
name | name of map |
histogram | struct for histogram |
Definition at line 90 of file histogram.c.
void Rast_write_histogram_cs | ( | const char * | name, |
struct Cell_stats * | statf | ||
) |
Writes the histogram based on cell statistics to file.
name | name of map |
statf | cell statistics |
Definition at line 116 of file histogram.c.
References count.
void Rast_write_history | ( | const char * | name, |
struct History * | hist | ||
) |
Write raster history file.
This routine writes the history file for the raster map name in the current mapset from the hist structure.
A diagnostic message is printed and -1 is returned if there is an error writing the history file. Otherwise, 0 is returned.
Note: The hist structure should first be initialized using Rast_short_history().
name | map name | |
[out] | hist | pointer to History structure which holds history info |
Definition at line 158 of file history.c.
References _, G_fatal_error(), G_fopen_new(), and Rast__write_history().
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 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(), 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().
void Rast_write_range | ( | const char * | name, |
const struct Range * | range | ||
) |
Write raster range file.
This routine writes the range information for the raster map name in the current mapset from the range structure. A diagnostic message is printed and -1 is returned if there is an error writing the range file. Otherwise, 0 is returned.
This routine only writes 2 numbers (min,max) to the range file, instead of the 4 (pmin,pmax,nmin,nmax) previously written. If there is no defined min,max, an empty file is written.
name | map name |
range | pointer to Range structure which holds range info |
Definition at line 372 of file range.c.
References _, CELL_TYPE, Range::first_time, G_fatal_error(), G_fopen_new_misc(), G_mapset(), G_remove_misc(), Range::max, Range::min, Rast_map_type(), Rast_write_rstats(), and Range::rstats.
void Rast_write_rstats | ( | const char * | name, |
const struct R_stats * | rstats | ||
) |
Write raster stats file.
Write the stats file stats
. This file is written in binary using XDR format. If the count is < 1 in rstats, an empty stats
file is created.
name | map name |
rstats | pointer to R_stats which holds stats info |
Definition at line 448 of file range.c.
References _, count, R_stats::count, G_fatal_error(), G_open_new_misc(), G_remove_misc(), G_xdr_put_double(), Rast_init(), R_stats::sum, R_stats::sumsq, and XDR_DOUBLE_NBYTES.
Referenced by Rast_write_fp_range(), and Rast_write_range().
void Rast_write_units | ( | const char * | name, |
const char * | str | ||
) |
Write a string to a raster map's units metadata file.
Raster map must exist in the current mapset.
name | raster map name |
str | string containing data to be written |
Definition at line 49 of file raster_metadata.c.
void Rast_write_vdatum | ( | const char * | name, |
const char * | str | ||
) |
Write a string into a raster's vertical datum metadata file.
Raster map must exist in the current mapset.
name | raster map name |
str | string containing data to be written |
Definition at line 79 of file raster_metadata.c.
void Rast_write_vector_cats | ( | const char * | name, |
struct Categories * | cats | ||
) |
Write vector category file.
Note: Used for only old vector format!
name | map name |
cats | pointer to Categories structure |
Definition at line 955 of file raster/cats.c.
void Rast_zero_buf | ( | void * | rast, |
RASTER_MAP_TYPE | data_type | ||
) |
Zero a raster buffer.
This routines assigns each member of the raster buffer array rast to zero. It assumes that rast has been allocated using Rast_allocate_c_buf().
rast | data buffer |
data_type | raster type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE) |
Definition at line 28 of file zero_cell.c.
References Rast_cell_size(), and Rast_window_cols().
void Rast_zero_histogram | ( | struct Histogram * | histogram | ) |
Zero out histogram struct.
histogram | struct for histogram |
Definition at line 426 of file histogram.c.
References Histogram::Histogram_list::count, Histogram::list, and Histogram::num.
void Rast_zero_input_buf | ( | void * | , |
RASTER_MAP_TYPE | |||
) |
Definition at line 33 of file zero_cell.c.
References Rast_cell_size(), and Rast_input_window_cols().
void Rast_zero_output_buf | ( | void * | , |
RASTER_MAP_TYPE | |||
) |
Definition at line 38 of file zero_cell.c.
References Rast_cell_size(), and Rast_output_window_cols().