|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-6050dcdd58
|


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 *) |
Definition at line 413 of file defs/raster.h.
Definition at line 417 of file defs/raster.h.
Definition at line 415 of file defs/raster.h.
Definition at line 232 of file defs/raster.h.
Allocates memory for null bits.
Allocates an array of unsigned char based on cols.
| cols | number of columns in region |
Definition at line 133 of file alloc_cell.c.
References G_calloc, and Rast__null_bitstream_size().
Referenced by Rast__open_null_write(), and Rast__open_old().
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 33 of file auto_mask.c.
References _, R__::auto_mask, G_find_raster2(), G_free(), G_projection(), G_warning(), G_zone(), R__::mask_fd, Cell_head::proj, Rast__init(), Rast__open_old(), Rast_get_cellhd(), Rast_mask_name(), Rast_unopen(), and Cell_head::zone.
Referenced by Rast_init_all(), Rast_maskfd(), Rast_open_old(), and Rast_unsuppress_masking().
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 64 of file raster/format.c.
References R__::fileinfo, G_calloc, Rast__read_row_ptrs(), and read.
Referenced by Rast__open_old().
| 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 937 of file raster/open.c.
References _, access, 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, name, and NULL.
Referenced by Rast_map_type().
Checks to see if GIS engine is initialized.
Definition at line 52 of file raster/init.c.
References _, and G_fatal_error().
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 335 of file null_val.c.
References G_fatal_error().
Referenced by G__set_flags_from_01_random().
Definition at line 537 of file raster/close.c.
References _, close, err(), R__::fileinfo, G__make_mapset_element_misc(), G_fatal_error(), G_file_name_misc(), G_free(), G_mapset(), G_warning(), GPATH_MAX, AMI_STREAM< T >::name(), NULL_FILE, NULLC_FILE, and Rast__write_null_row_ptrs().
| 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 G_free().
| 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 G_free().
Referenced by Rast__color_reset().
| 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.
References G_free(), _Color_Rule_::next, and NULL.
Referenced by Rast__color_reset().
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.
References Colors::fixed, Colors::modular, Rast__color_free_lookup(), Rast__color_free_rules(), and Colors::version.
Referenced by Rast_free_colors().
?
Note: Only for internal use.
| zero_ones | |
| flags | |
| n |
Definition at line 420 of file null_val.c.
References count, and Rast__null_bitstream_size().
Referenced by G__set_flags_from_01_random().
?
Note: Only for internal use.
| zero_ones | |
| flags | |
| n |
Definition at line 457 of file null_val.c.
References count, and Rast__null_bitstream_size().
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 31 of file raster/window_map.c.
References alloc_index, fileinfo::C1, fileinfo::C2, fileinfo::cellhd, R__::fileinfo, G_debug(), G_free(), OPEN_OLD, PROJECTION_LL, R__::rd_window, and x.
Referenced by Rast__open_old().
Definition at line 69 of file raster/init.c.
References Rast__unopen_all().
Definition at line 61 of file raster/init.c.
References G_initialize_done(), G_is_initialized(), and init().
Referenced by Rast__check_for_auto_masking(), Rast__open_null_write(), Rast__open_old(), Rast_init(), Rast_init_all(), Rast_set_fp_type(), Rast_set_input_window(), Rast_set_output_window(), Rast_set_window(), Rast_suppress_masking(), and Rast_unsuppress_masking().
?
Note: Only for internal use.
| flags | |
| cols |
Definition at line 490 of file null_val.c.
References Rast__null_bitstream_size().
Referenced by Rast__read_null_bits().
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_create_gdal_link(), Rast_get_input_window(), Rast_get_output_window(), Rast_get_window(), Rast_input_window_cols(), Rast_input_window_rows(), Rast_output_window_cols(), Rast_output_window_rows(), Rast_window_cols(), and Rast_window_rows().
| 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 422 of file color_look.c.
References _Color_Rule_::high.
Referenced by Rast__lookup_colors().
| 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.
References b, CELL_TYPE, Colors::fixed, g, G_incr_void_ptr, _Color_Rule_::high, Colors::invert, max, min, Colors::modular, _Color_Rule_::next, NULL, r, Rast__interpolate_color_rule(), Rast_cell_size(), Rast_get_d_value(), Rast_get_default_color(), Rast_get_null_value_color(), Rast_is_null_value(), Rast_raster_cmp(), and Colors::shift.
Referenced by Rast_lookup_c_colors(), Rast_lookup_colors(), Rast_lookup_d_colors(), and Rast_lookup_f_colors().
Get information about the current mask.
Determines the status of the automatic masking and the name of the 2D raster which forms the mask. Typically, mask is raster called MASK in the current mapset, but when used with r.mask, it is usually a reclassed raster, and so when a mask raster is present and it is a reclass raster, the name and mapset of the underlying reclassed raster are returned.
The name and mapset is written to the parameter which need to be defined with a sufficient size, least as char name[GNAME_MAX], mapset[GMAPSET_MAX].
When the masking is not active, -1 is returned and name and mapset are undefined. When the masking is active, 1 is returned and name and mapset will hold the name and mapset of the underlying raster.
| [out] | name | Name of the raster map used as mask |
| [out] | mapset | Name of the map's mapset |
Definition at line 179 of file mask_info.c.
References GMAPSET_MAX, GNAME_MAX, name, Rast_is_reclass(), and strcpy.
Referenced by Rast_mask_info().
Determines null bitstream size.
| cols | number of columns |
Definition at line 146 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(), Rast__read_null_bits(), and Rast__write_null_bits().
Definition at line 752 of file raster/open.c.
References _, R__::compress_nulls, creat, err(), R__::fileinfo, G_calloc, G_fatal_error(), G_find_raster2(), G_free(), G_mapset(), G_store(), G_tempfile(), G_unqualified_name(), G_zero(), GMAPSET_MAX, GNAME_MAX, fileinfo::mapset, AMI_STREAM< T >::name(), name, Rast__allocate_null_bits(), Rast__init(), Rast__write_null_row_ptrs(), and Rast_get_cellhd().
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 151 of file raster/open.c.
References _, CELL_TYPE, close, Cell_head::cols, Cell_head::compressed, DCELL_TYPE, FCELL_TYPE, R__::fileinfo, Cell_head::format, G_calloc, G_check_compressor(), G_compressor_name(), G_fatal_error(), G_find_raster2(), G_free(), G_fully_qualified_name(), G_open_old(), G_open_old_misc(), G_projection_name(), G_store(), G_unqualified_name(), GMAPSET_MAX, GNAME_MAX, Reclass::mapset, AMI_STREAM< T >::name(), Reclass::name, name, NULL, NULL_FILE, NULLC_FILE, OPEN_OLD, Cell_head::proj, Rast__allocate_null_bits(), Rast__check_format(), Rast__create_window_mapping(), Rast__init(), Rast__read_null_row_ptrs(), Rast_get_cellhd(), Rast_get_gdal_link(), Rast_get_reclass(), Rast_get_vrt(), Rast_map_type(), Rast_read_quant(), 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().
Definition at line 12 of file color_org.c.
References Colors::organizing.
Referenced by Rast_lookup_c_colors(), Rast_lookup_colors(), Rast_lookup_d_colors(), and Rast_lookup_f_colors().
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 274 of file quant_io.c.
References G__make_mapset_element_misc(), G_fopen_new(), G_fopen_new_misc(), G_make_mapset_object_group(), G_mapset(), G_name_is_fully_qualified(), G_remove(), G_remove_misc(), GMAPSET_MAX, GNAME_MAX, name, and QUANT_FILE_NAME.
Referenced by Rast_write_quant().
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 774 of file quant.c.
References Quant_table::dHigh, Quant_table::dLow, Quant::nofRules, NULL, and Quant::table.
Referenced by Rast__quant_organize_fp_lookup(), and Rast_quant_get_cell_value().
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 95 of file quant_io.c.
References _, CELL_TYPE, G_fopen_old(), G_fopen_old_misc(), G_free(), G_fully_qualified_name(), G_mapset(), G_name_is_fully_qualified(), G_warning(), GMAPSET_MAX, GNAME_MAX, name, QUANT_FILE_NAME, Rast_map_type(), and Rast_quant_free().
Referenced by Rast_read_quant().
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 in between 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 |
Definition at line 90 of file quant.c.
References Quant_table::dHigh, Quant_table::dLow, Quant::fp_lookup, G_calloc, Quant::infiniteCLeft, Quant::infiniteCRight, Quant::infiniteDLeft, Quant::infiniteDRight, MAX_LOOKUP_TABLE_SIZE, NO_DATA, NO_FINITE_RULE, NO_LEFT_INFINITE_RULE, NO_RIGHT_INFINITE_RULE, Quant::nofRules, Rast__quant_get_rule_for_d_raster_val(), and Quant::table.
Referenced by Rast_quant_get_cell_value().
| int Rast__read_colors | ( | const char * | element, |
| const char * | name, | ||
| const char * | mapset, | ||
| struct Colors * | colors | ||
| ) |
Definition at line 115 of file raster/color_read.c.
References G_fopen_old(), G_fseek(), G_strip(), name, NULL, and Colors::version.
Referenced by Rast_read_colors(), and Vect_read_colors().
Definition at line 59 of file raster/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().
Definition at line 880 of file raster/get_row.c.
References _, R__::fileinfo, G_fatal_error(), AMI_STREAM< T >::name(), fileinfo::null_fd, Rast__init_null_bits(), Rast__null_bitstream_size(), and read.
Definition at line 173 of file raster/format.c.
References _, R__::fileinfo, G_warning(), AMI_STREAM< T >::name(), and fileinfo::null_fd.
Referenced by Rast__open_old().
Definition at line 158 of file raster/format.c.
References _, R__::fileinfo, G_warning(), and AMI_STREAM< T >::name().
Referenced by Rast__check_format().
Remove floating-point range.
Note: For internal use only.
| name | map name |
Definition at line 33 of file raster/range.c.
References G_remove_misc(), and name.
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 607 of file raster/range.c.
References Range::first_time, Range::max, Range::min, min, Rast_is_c_null_value, and Range::rstats.
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().
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, OPEN_NEW_COMPRESSED, and OPEN_NEW_UNCOMPRESSED.
Referenced by Rast__error_handler().
Write map layer color table.
| fd | file descriptor |
| colors | pointer to Colors structure which holds color info |
Definition at line 111 of file raster/color_write.c.
References Colors::version.
Referenced by Rast3d_write_colors(), Rast_write_colors(), and Vect_write_colors().
Definition at line 128 of file raster/history.c.
References History::fields, HIST_NUM_FIELDS, History::lines, and History::nlines.
Referenced by Rast3d_write_history(), and Rast_write_history().
Write null data.
| flags | ? |
| row | row number |
| col | col number |
| fd | file descriptor of cell data file |
Definition at line 561 of file raster/put_row.c.
References _, R__::fileinfo, G_fatal_error(), AMI_STREAM< T >::name(), Rast__null_bitstream_size(), and write.
Definition at line 229 of file raster/format.c.
References R__::fileinfo, and fileinfo::null_fd.
Referenced by Rast__close_null(), and Rast__open_null_write().
Definition at line 221 of file raster/format.c.
References R__::fileinfo.
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 249 of file color_xform.c.
References MAX, max, MIN, min, Rast_add_d_color_rule(), Rast_get_d_color(), Rast_get_d_color_range(), Rast_get_default_color(), Rast_get_null_value_color(), Rast_init_colors(), Rast_set_default_color(), Rast_set_null_value_color(), and x.
| 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 76 of file color_rule.c.
References CELL_TYPE, Colors::cmax, Colors::cmin, Colors::fixed, and Colors::version.
Referenced by IL_output_2d(), IL_resample_output_2d(), Rast_histogram_eq_colors(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), and Rast_set_c_color().
| 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.
References Colors::cmax, Colors::cmin, Colors::fixed, and Colors::version.
| 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 38 of file color_rule.c.
References Colors::cmax, Colors::cmin, DCELL_TYPE, Colors::fixed, and Colors::version.
Referenced by IL_resample_output_2d(), Rast_abs_log_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), Rast_read_color_rules(), and Rast_set_d_color().
| 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 57 of file color_rule.c.
References Colors::cmax, Colors::cmin, FCELL_TYPE, Colors::fixed, and Colors::version.
Referenced by IL_output_2d(), and IL_resample_output_2d().
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 344 of file histogram.c.
References count, 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.
References CELL_TYPE, Colors::cmax, Colors::cmin, max, min, Colors::modular, and Colors::version.
Referenced by Rast_make_random_colors().
| 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.
References Colors::cmax, Colors::cmin, max, min, Colors::modular, and Colors::version.
| 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.
References Colors::cmax, Colors::cmin, DCELL_TYPE, max, min, Colors::modular, and Colors::version.
Referenced by IL_resample_output_2d().
| 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.
References Colors::cmax, Colors::cmin, FCELL_TYPE, max, min, Colors::modular, and Colors::version.
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 40 of file align_window.c.
References Cell_head::east, Cell_head::ew_res, G_adjust_Cell_head(), G_debug(), Cell_head::north, Cell_head::ns_res, Cell_head::proj, PROJECTION_LL, Cell_head::south, Cell_head::west, and Cell_head::zone.
| 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 53 of file alloc_cell.c.
References G_calloc, Rast_cell_size(), and Rast_window_cols().
Referenced by N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), and P_Aux_to_Raster().
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 80 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by create_raster(), Gs_get_cat_label(), I_compute_scatts(), IL_create_bitmask(), open_band_files(), and Rast_map_to_img_str().
Definition at line 160 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
Definition at line 185 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
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 106 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by Gs_get_cat_label(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), Rast_get_sample_nearest(), and Rast_map_to_img_str().
Definition at line 170 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
Definition at line 195 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
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 93 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by IL_output_2d(), and Rast_map_to_img_str().
Definition at line 165 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
Definition at line 190 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
Referenced by IL_resample_output_2d().
| void * Rast_allocate_input_buf | ( | RASTER_MAP_TYPE | data_type | ) |
Definition at line 155 of file alloc_cell.c.
References G_calloc, Rast_cell_size(), and Rast_input_window_cols().
Referenced by Rast_get_vrt_row().
Allocates memory for a null buffer.
Allocate an array of char based on the number of columns in the current region.
Definition at line 119 of file alloc_cell.c.
References G_calloc, and Rast_window_cols().
Referenced by I_compute_scatts(), and I_insert_patch_to_cat_rast().
Definition at line 175 of file alloc_cell.c.
References G_calloc, and Rast_input_window_cols().
Definition at line 200 of file alloc_cell.c.
References G_calloc, and Rast_output_window_cols().
| void * Rast_allocate_output_buf | ( | RASTER_MAP_TYPE | data_type | ) |
Definition at line 180 of file alloc_cell.c.
References G_calloc, Rast_cell_size(), and Rast_output_window_cols().
Append a formatted string to a History structure.
| hist | pointer to History structure which holds history info |
| fmt | a string of format characters |
| ... | the arguments associated with the format characters |
Definition at line 45 of file raster/history.c.
References G_realloc, G_vasprintf(), History::lines, and History::nlines.
Referenced by IL_output_2d(), and IL_resample_output_2d().
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 raster/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 37 of file alloc_cell.c.
References F2I.
Referenced by D_draw_raster_RGB(), f_median(), f_nmedian(), N_read_rast_to_array_2d(), P_Aux_to_Raster(), Rast__lookup_colors(), Rast__set_null_value(), Rast_allocate_buf(), Rast_allocate_input_buf(), Rast_allocate_output_buf(), Rast_get_row_colors(), Rast_get_vrt_row(), Rast_mark_cats(), 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 * | statf, |
| CELL | min1, | ||
| CELL | max1, | ||
| CELL | min2, | ||
| CELL | max2, | ||
| int | zero, | ||
| void(*)(CELL, CELL, CELL) | func | ||
| ) |
Definition at line 4 of file cellstats_eq.c.
References count, max1(), min1(), Rast_next_cell_stat(), Rast_rewind_cell_stats(), and x.
Definition at line 307 of file raster/history.c.
References G_free(), History::lines, History::nlines, and NULL.
Referenced by Rast_free_history().
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(), and OPEN_OLD.
Referenced by close_band_files(), create_raster(), Gs_get_cat_label(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), I_insert_patch_to_cat_rast(), IL_create_bitmask(), IL_output_2d(), IL_resample_output_2d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), Rast_map_to_img_str(), and Rast_suppress_masking().
Close existing GDAL link.
| gdal | pointer to GDAL_link to be closed |
Definition at line 380 of file gdal.c.
References GDAL_link::data, GDAL_link::filename, and G_free().
Close existing GDAL link and write out data.
| gdal | pointer to GDAL_link to be closed |
Definition at line 395 of file gdal.c.
References _, GDAL_link::data, FALSE, GDAL_link::filename, G_free(), G_strcasecmp(), G_warning(), NULL, and st.
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.
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.
References Cell_head::ew_res, and Cell_head::west.
Referenced by P_Read_Raster_Region_Map(), and P_Regular_Points().
Get both modular and fixed rules count.
| colors | pointer to color table structure |
Definition at line 24 of file color_rule_get.c.
References count, Colors::fixed, Colors::modular, and _Color_Rule_::next.
Referenced by Rast_print_colors(), and Rast_print_json_colors().
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 274 of file raster/history.c.
References G_free(), G_recreate_command(), History::nlines, and Rast_append_history().
Referenced by IL_output_2d().
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 raster/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 1247 of file raster/cats.c.
References Rast_get_ith_d_cat(), Rast_init_cats(), and Rast_set_d_cat().
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 227 of file gdal.c.
References _, GDAL_link::band, GDAL_link::band_num, CELL_TYPE, GDAL_link::data, DCELL_TYPE, FCELL_TYPE, GDAL_link::filename, G_calloc, G_create_key_value(), G_fatal_error(), G_fopen_new_misc(), G_free_key_value(), G_fwrite_key_value(), G_get_projepsg(), G_get_projinfo(), G_get_projunits(), G_initialize_done(), G_is_initialized(), G_message(), G_set_key_value(), G_store(), G_warning(), GPATH_MAX, GPJ_grass_to_wkt2(), GDAL_link::hflip, name, R__::nbytes, NULL, GDAL_link::null_val, Rast__init_window(), Rast_init_gdal(), Rast_set_d_null_value(), st, GDAL_link::type, GDAL_link::vflip, and R__::wr_window.
Disable OpenMP if raster mask is present.
This helper function can be removed when raster reading is made thread safe.
| nprocs | number of threads to use |
Definition at line 214 of file mask_info.c.
References _, G_verbose_message(), and Rast_mask_is_present().
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.
References Cell_head::ew_res, G_adjust_easting(), and Cell_head::west.
Referenced by Rast_get_sample_bilinear(), Rast_get_sample_cubic(), and Rast_get_sample_nearest().
Extends histogram struct to accommodate a new value.
| cat | category |
| count | |
| histogram | struct for histogram |
Definition at line 392 of file histogram.c.
References count, G_realloc, and LIST.
Referenced by Rast_add_histogram(), Rast_read_histogram(), and Rast_set_histogram().
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 188 of file cell_stats.c.
References count, Cell_stats::N, Cell_stats::node, Cell_stats::null_data_count, Rast_is_c_null_value, and SHIFT.
Definition at line 200 of file raster/history.c.
References History::fields, G_free(), and G_vasprintf().
Referenced by IL_output_2d(), IL_resample_output_2d(), and Rast_short_history().
| void Rast_fpreclass_add_rule | ( | struct FPReclass * | r, |
| DCELL | dLow, | ||
| DCELL | dHigh, | ||
| DCELL | rLow, | ||
| DCELL | rHigh | ||
| ) |
Definition at line 451 of file fpreclass.c.
References FPReclass_table::dHigh, FPReclass_table::dLow, r, FPReclass_table::rHigh, and FPReclass_table::rLow.
Definition at line 547 of file fpreclass.c.
References FPReclass_table::dHigh, FPReclass_table::dLow, NO_DEFAULT_RULE, NO_EXPLICIT_RULE, NO_FINITE_RULE, NO_LEFT_INFINITE_RULE, NO_RIGHT_INFINITE_RULE, r, Rast_set_d_null_value(), FPReclass_table::rHigh, and FPReclass_table::rLow.
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 * | r, |
| int | i, | ||
| DCELL * | dLow, | ||
| DCELL * | dHigh, | ||
| DCELL * | rLow, | ||
| DCELL * | rHigh | ||
| ) |
Definition at line 371 of file fpreclass.c.
References r.
| int Rast_fpreclass_get_limits | ( | const struct FPReclass * | r, |
| DCELL * | dMin, | ||
| DCELL * | dMax, | ||
| DCELL * | rMin, | ||
| DCELL * | rMax | ||
| ) |
Definition at line 332 of file fpreclass.c.
References DEFAULT_MAX, DEFAULT_MIN, NO_DEFAULT_RULE, NO_EXPLICIT_RULE, and r.
Definition at line 412 of file fpreclass.c.
References r.
Definition at line 437 of file fpreclass.c.
References r.
Definition at line 279 of file fpreclass.c.
References r, and Rast_fpreclass_reset().
Definition at line 364 of file fpreclass.c.
References r.
| void Rast_fpreclass_perform_dd | ( | const struct FPReclass * | r, |
| const DCELL * | dcell, | ||
| DCELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 605 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_d_null_value, and Rast_set_d_null_value().
| void Rast_fpreclass_perform_df | ( | const struct FPReclass * | r, |
| const DCELL * | dcell, | ||
| FCELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 591 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_d_null_value, and Rast_set_f_null_value().
| void Rast_fpreclass_perform_di | ( | const struct FPReclass * | r, |
| const DCELL * | dcell, | ||
| CELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 577 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_d_null_value, and Rast_set_c_null_value().
| void Rast_fpreclass_perform_fd | ( | const struct FPReclass * | r, |
| const FCELL * | fcell, | ||
| DCELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 647 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_f_null_value, and Rast_set_d_null_value().
| void Rast_fpreclass_perform_ff | ( | const struct FPReclass * | r, |
| const FCELL * | fcell, | ||
| FCELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 633 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_f_null_value, and Rast_set_f_null_value().
| void Rast_fpreclass_perform_fi | ( | const struct FPReclass * | r, |
| const FCELL * | fcell, | ||
| CELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 619 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_f_null_value, and Rast_set_c_null_value().
| void Rast_fpreclass_perform_id | ( | const struct FPReclass * | r, |
| const CELL * | icell, | ||
| DCELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 689 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_c_null_value, and Rast_set_d_null_value().
| void Rast_fpreclass_perform_if | ( | const struct FPReclass * | r, |
| const CELL * | icell, | ||
| FCELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 675 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_c_null_value, and Rast_set_f_null_value().
| void Rast_fpreclass_perform_ii | ( | const struct FPReclass * | r, |
| const CELL * | icell, | ||
| CELL * | cell, | ||
| int | n | ||
| ) |
Definition at line 661 of file fpreclass.c.
References r, Rast_fpreclass_get_cell_value(), Rast_is_c_null_value, and Rast_set_c_null_value().
Definition at line 267 of file fpreclass.c.
References G_free(), r, and Rast_fpreclass_clear().
Referenced by Rast_fpreclass_init().
Definition at line 482 of file fpreclass.c.
References FPReclass_table::dHigh, FPReclass_table::dLow, r, FPReclass_table::rHigh, and FPReclass_table::rLow.
Definition at line 287 of file fpreclass.c.
References r.
Definition at line 401 of file fpreclass.c.
References r.
Definition at line 426 of file fpreclass.c.
References r.
Definition at line 296 of file fpreclass.c.
References r.
| 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 1212 of file raster/cats.c.
References G_free(), NULL, and Rast_quant_free().
Referenced by Gs_get_cat_label(), gsd_put_legend(), and Rast_sort_cats().
| 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 382 of file cell_stats.c.
References G_free(), Cell_stats::N, and Cell_stats::node.
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.
References Rast__color_reset(), and Rast_init_colors().
Referenced by Gs_pack_colors(), Gs_pack_colors_float(), gsd_put_legend(), Gvl_unload_colors_data(), and Rast_map_to_img_str().
Frees memory allocated for the histogram.
frees the memory allocated for the histogram
| histogram | struct for histogram |
Definition at line 199 of file histogram.c.
Definition at line 321 of file raster/history.c.
References History::fields, G_free(), HIST_NUM_FIELDS, NULL, and Rast_clear_history().
Referenced by IL_output_2d(), and IL_resample_output_2d().
Free Reclass structure.
| reclass | pointer to Reclass structure |
Definition at line 199 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 321 of file raster/cats.c.
References CELL_TYPE, and Rast_get_cat().
Referenced by Gs_get_cat_label(), gsd_put_legend(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), and Rast_get_sample_nearest().
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 67 of file color_get.c.
References CELL_TYPE, and Rast_get_color().
Referenced by Gp_load_sites_thematic(), gsd_put_legend(), and Gv_load_vect_thematic().
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.
References Colors::cmax, Colors::cmin, Colors::is_float, max, and min.
Referenced by Gs_build_256lookup(), Rast_print_colors(), and Rast_print_json_colors().
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 792 of file raster/get_row.c.
References CELL_TYPE, and Rast_get_row().
Referenced by Gs_get_cat_label(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), I_compute_scatts(), IL_create_bitmask(), and Rast_get_null_value_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 692 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 200 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, Rast_is_null_value(), and Rast_set_c_null_value().
| 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 394 of file raster/cats.c.
References G_debug(), l, NULL, Rast_get_d_value(), Rast_is_c_null_value, Rast_is_null_value(), and Rast_quant_get_cell_value().
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 297 of file raster/cats.c.
Get cell value format.
| v | cell |
Definition at line 473 of file raster/open.c.
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 24 of file cell_title.c.
References G_fopen_old(), G_getl(), G_store(), G_strip(), and name.
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, name, and Rast_is_reclass().
Referenced by GS_load_att_map(), I_insert_patch_to_cat_rast(), Rast__check_for_auto_masking(), Rast__open_null_write(), 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.
References b, g, r, and Rast_lookup_colors().
Referenced by D_color_of_type(), Rast_get_c_color(), Rast_get_d_color(), and Rast_get_f_color().
| 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 369 of file raster/cats.c.
References DCELL_TYPE, and Rast_get_cat().
Referenced by Gs_get_cat_label(), and gsd_put_legend().
| 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 109 of file color_get.c.
References DCELL_TYPE, and Rast_get_color().
Referenced by gsd_put_legend(), Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), and Rast_log_colors().
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 86 of file color_range.c.
References Colors::cmax, Colors::cmin, max, and min.
Referenced by Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), and Rast_log_colors().
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 829 of file raster/get_row.c.
References DCELL_TYPE, and Rast_get_row().
Referenced by Gs_get_cat_label(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), and Rast_get_sample_nearest().
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 724 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 268 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, Rast_is_null_value(), and Rast_set_d_null_value().
Referenced by Rast__lookup_colors(), Rast_get_cat(), Rast_mark_cats(), and Rast_set_cat().
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 154 of file color_get.c.
References Colors::undef_blu, Colors::undef_grn, Colors::undef_red, and Colors::undef_set.
Referenced by Rast__lookup_colors(), Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), Rast_print_colors(), and Rast_print_json_colors().
| 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 345 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 88 of file color_get.c.
References FCELL_TYPE, and Rast_get_color().
Referenced by Gvl_get_color_for_value().
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 812 of file raster/get_row.c.
References FCELL_TYPE, and Rast_get_row().
Referenced by Gs_loadmap_as_float().
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 708 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 234 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.
References Colors::fixed, and Colors::modular.
Referenced by Rast_print_colors(), and Rast_print_json_colors().
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 785 of file raster/range.c.
References FPRange::first_time, FPRange::max, max, FPRange::min, min, Rast_is_d_null_value, and Rast_set_d_null_value().
Referenced by gsd_put_legend(), Rast3d_range_min_max(), Rast3d_read_colors(), Rast_quantize_fp_map(), Rast_read_colors(), and Rast_read_range().
Get GDAL link settings for given raster map.
| name | map name |
| mapset | name of mapset |
Definition at line 53 of file gdal.c.
References GDAL_link::band, GDAL_link::band_num, CELL_TYPE, GDAL_link::data, DCELL_TYPE, FCELL_TYPE, GDAL_link::filename, G_calloc, G_find_key_value(), G_find_raster2(), G_fopen_old_misc(), G_fread_key_value(), G_store(), G_strcasecmp(), GDAL_link::hflip, name, NULL, GDAL_link::null_val, Rast_init_gdal(), Rast_map_type(), Rast_set_d_null_value(), GDAL_link::type, and GDAL_link::vflip.
Referenced by Rast__open_old().
Returns cat for the nth element in the histogram.
Returns cat for the nth element in the histogram
| n | The nth element in the histogram to get the cat for |
| histogram | struct for histogram |
Definition at line 168 of file histogram.c.
Referenced by Rast_histogram_eq().
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 184 of file histogram.c.
Referenced by Rast_histogram_eq().
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 155 of file histogram.c.
Referenced by Rast_histogram_eq().
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 178 of file raster/history.c.
References History::fields.
Read the current input window.
| window | pointer to Cell_head |
Definition at line 43 of file raster/window.c.
References Rast__init_window(), and R__::rd_window.
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 1083 of file raster/cats.c.
References CELL_TYPE, Rast_get_ith_d_cat(), and Rast_set_d_value().
| 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 1111 of file raster/cats.c.
References Rast_get_ith_d_cat(), and Rast_set_d_value().
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 1028 of file raster/cats.c.
References Rast_quant_get_ith_rule(), and Rast_set_d_null_value().
Referenced by Rast3d_write_cats(), Rast_copy_cats(), Rast_get_ith_c_cat(), Rast_get_ith_cat(), Rast_get_ith_f_cat(), Rast_get_next_marked_d_cat(), Rast_set_d_cat(), and Rast_sort_cats().
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 1056 of file raster/cats.c.
References FCELL_TYPE, Rast_get_ith_d_cat(), and Rast_set_d_value().
| 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 921 of file raster/open.c.
References R__::fileinfo.
Referenced by Gs_get_cat_label(), I_compute_scatts(), N_read_rast_to_array_2d(), Rast_get_row_colors(), and Rast_map_to_img_str().
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, name, 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 639 of file raster/cats.c.
References CELL_TYPE, count, 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 672 of file raster/cats.c.
References count, 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 599 of file raster/cats.c.
References count, G_debug(), NULL, 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 655 of file raster/cats.c.
References count, FCELL_TYPE, and Rast_get_next_marked_cat().
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 126 of file color_get.c.
References Colors::null_blu, Colors::null_grn, Colors::null_red, Colors::null_set, Colors::undef_blu, Colors::undef_grn, Colors::undef_red, and Colors::undef_set.
Referenced by Rast__lookup_colors(), Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), Rast_print_colors(), and Rast_print_json_colors().
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 1085 of file raster/get_row.c.
References R__::fileinfo, G_free(), G_malloc, Rast_get_c_row(), Rast_is_c_null_value, and R__::rd_window.
Referenced by I_compute_scatts(), and I_insert_patch_to_cat_rast().
Read the current output window.
| window | pointer to Cell_head |
Definition at line 55 of file raster/window.c.
References Rast__init_window(), and R__::wr_window.
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 735 of file raster/range.c.
References Range::first_time, Range::max, max, Range::min, min, Rast_is_c_null_value, and Rast_set_c_null_value().
Referenced by Gs_numtype(), gsd_put_legend(), Rast_get_max_c_cat(), and Rast_read_colors().
Get reclass.
| name | map name | |
| mapset | mapset name | |
| [out] | reclass | pointer to Reclass structure |
Definition at line 140 of file reclass.c.
References _, G_free(), G_store(), G_warning(), GMAPSET_MAX, GNAME_MAX, Reclass::mapset, Reclass::name, name, NULL, RECLASS_TABLE, and Reclass::type.
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 768 of file raster/get_row.c.
Referenced by N_read_rast_to_array_2d(), Rast_get_c_row(), Rast_get_d_row(), Rast_get_f_row(), Rast_get_row_colors(), 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.
References G_free(), G_incr_void_ptr, G_malloc, Rast_cell_size(), Rast_get_map_type(), Rast_get_row(), Rast_is_null_value(), Rast_lookup_colors(), and Rast_window_cols().
| 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 676 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 |
Definition at line 49 of file sample.c.
References _, G_fatal_error(), INTERP_BICUBIC, INTERP_BILINEAR, INTERP_NEAREST, Rast_get_sample_bilinear(), Rast_get_sample_cubic(), and Rast_get_sample_nearest().
| 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 |
Definition at line 144 of file sample.c.
References G_free(), G_squeeze(), Rast_allocate_d_buf(), Rast_easting_to_col(), Rast_get_c_cat(), Rast_get_d_row(), Rast_interp_bilinear(), Rast_is_d_null_value, Rast_northing_to_row(), Rast_set_d_null_value(), Rast_window_cols(), and Rast_window_rows().
Referenced by Rast_get_sample().
| 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 |
Definition at line 232 of file sample.c.
References G_free(), G_squeeze(), Rast_allocate_d_buf(), Rast_easting_to_col(), Rast_get_c_cat(), Rast_get_d_row(), Rast_interp_bicubic(), Rast_is_d_null_value, Rast_northing_to_row(), Rast_set_d_null_value(), Rast_window_cols(), and Rast_window_rows().
Referenced by Rast_get_sample().
| 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 |
Definition at line 89 of file sample.c.
References G_free(), G_squeeze(), Rast_allocate_d_buf(), Rast_easting_to_col(), Rast_get_c_cat(), Rast_get_d_row(), Rast_is_d_null_value, Rast_northing_to_row(), Rast_set_d_null_value(), Rast_window_cols(), and Rast_window_rows().
Referenced by Rast_get_sample().
Get a raster map semantic label or fall back to its name.
Use this function if a semantic label is needed but not mandated.
| name | raster map name |
| mapset | mapset name |
Definition at line 111 of file raster_metadata.c.
References G_store(), name, and Rast_read_semantic_label().
Referenced by I_iclass_init_signatures(), I_sort_signatures_by_semantic_label(), and I_SortSigSetBySemanticLabel().
| 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 369 of file cell_stats.c.
References count, and Cell_stats::null_data_count.
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 | fd, |
| void * | buf, | ||
| int | row, | ||
| RASTER_MAP_TYPE | data_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, 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, R_vrt::tileinfo, and R_vrt::tlist.
Read the current window.
| window | pointer to Cell_head |
Definition at line 25 of file raster/window.c.
References _, G_fatal_error(), Rast__init_window(), R__::split_window, and R__::wr_window.
| void Rast_histogram_eq | ( | const struct Histogram * | histo, |
| unsigned char ** | map, | ||
| CELL * | min, | ||
| CELL * | max | ||
| ) |
Definition at line 14 of file histo_eq.c.
References count, G_malloc, max, min, Rast_get_histogram_cat(), Rast_get_histogram_count(), Rast_get_histogram_num(), and x.
| 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.
References count, max, min, Rast_add_c_color_rule(), Rast_get_d_color(), Rast_get_d_color_range(), Rast_get_default_color(), Rast_get_null_value_color(), Rast_init_colors(), Rast_next_cell_stat(), Rast_rewind_cell_stats(), Rast_set_default_color(), Rast_set_null_value_color(), and x.
| 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 107 of file color_xform.c.
References FP_stats::count, count, FP_stats::flip, FP_stats::geom_abs, FP_stats::geometric, FP_stats::max, max, FP_stats::min, min, Rast_add_d_color_rule(), Rast_get_d_color(), Rast_get_d_color_range(), Rast_get_default_color(), Rast_get_null_value_color(), Rast_init_colors(), Rast_set_default_color(), Rast_set_null_value_color(), FP_stats::stats, FP_stats::total, and x.
Definition at line 334 of file raster/history.c.
References History::nlines.
Definition at line 339 of file raster/history.c.
References History::lines, and History::nlines.
Initialize GRASS engine.
Initializes GIS engine and ensures a valid mapset is available.
Definition at line 42 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().
Definition at line 141 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 1144 of file raster/cats.c.
References NULL, Rast_quant_init(), and Rast_set_cats_title().
Referenced by Rast_copy_cats(), and Rast_sort_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.
References G_malloc, INCR, Cell_stats::N, Cell_stats::node, NODE, Cell_stats::null_data_count, and Cell_stats::tlen.
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.
References Colors::cmax, Colors::fixed, G_zero(), and Colors::modular.
Referenced by create_raster(), IL_output_2d(), IL_resample_output_2d(), Rast3d_read_colors(), Rast_abs_log_colors(), Rast_free_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), Rast_make_random_colors(), Rast_read_color_rules(), Rast_read_colors(), and Vect_read_colors().
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 763 of file raster/range.c.
References FPRange::first_time, FPRange::max, FPRange::min, Rast_set_d_null_value(), and FPRange::rstats.
Referenced by Rast3d_range_init(), Rast3d_read_range(), and Rast_read_fp_range().
Initialization.
Register all GDAL drivers.
Definition at line 33 of file gdal.c.
References G_initialize_done(), and G_is_initialized().
Referenced by Rast_create_gdal_link(), Rast_get_gdal_link(), and Rast_init_all().
initializes the histogram structure
initializes the histogram structure for calls to Rast_set_histogram() and Rast_add_histogram()
| histogram |
Definition at line 21 of file histogram.c.
References NULL.
Referenced by Rast_make_histogram_cs(), and Rast_read_histogram().
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 711 of file raster/range.c.
References Range::first_time, Range::max, Range::min, Rast_set_c_null_value(), and Range::rstats.
Referenced by Rast_read_range().
Number of columns in active input window.
This routine returns the number of columns in the active input window.
Definition at line 155 of file raster/window.c.
References 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().
Number of rows in active input window.
This routine returns the number of rows in the active input window.
Definition at line 141 of file raster/window.c.
References Rast__init_window(), and R__::rd_window.
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 292 of file null_val.c.
References CELL_TYPE.
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 319 of file null_val.c.
References DCELL_TYPE.
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 304 of file null_val.c.
References FCELL_TYPE.
| 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 276 of file null_val.c.
| DCELL Rast_interp_bicubic | ( | double | u, |
| double | v, | ||
| DCELL | c00, | ||
| DCELL | c01, | ||
| DCELL | c02, | ||
| DCELL | c03, | ||
| DCELL | c10, | ||
| DCELL | c11, | ||
| DCELL | c12, | ||
| DCELL | c13, | ||
| DCELL | c20, | ||
| DCELL | c21, | ||
| DCELL | c22, | ||
| DCELL | c23, | ||
| DCELL | c30, | ||
| DCELL | c31, | ||
| DCELL | c32, | ||
| DCELL | c33 | ||
| ) |
Definition at line 44 of file interp.c.
References Rast_interp_cubic().
Referenced by Rast_get_sample_cubic().
| DCELL Rast_interp_bicubic_bspline | ( | double | u, |
| double | v, | ||
| DCELL | c00, | ||
| DCELL | c01, | ||
| DCELL | c02, | ||
| DCELL | c03, | ||
| DCELL | c10, | ||
| DCELL | c11, | ||
| DCELL | c12, | ||
| DCELL | c13, | ||
| DCELL | c20, | ||
| DCELL | c21, | ||
| DCELL | c22, | ||
| DCELL | c23, | ||
| DCELL | c30, | ||
| DCELL | c31, | ||
| DCELL | c32, | ||
| DCELL | c33 | ||
| ) |
Definition at line 156 of file interp.c.
References Rast_interp_cubic_bspline().
Definition at line 26 of file interp.c.
References Rast_interp_linear().
Referenced by Rast_get_sample_bilinear().
Definition at line 35 of file interp.c.
Referenced by Rast_interp_bicubic().
Definition at line 146 of file interp.c.
Referenced by Rast_interp_bicubic_bspline().
Definition at line 21 of file interp.c.
Referenced by Rast_interp_bilinear().
Definition at line 17 of file color_invrt.c.
References Colors::invert.
| 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 176 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 D_draw_raster_RGB(), N_is_array_2d_value_null(), Rast__lookup_colors(), Rast_get_c_value(), Rast_get_cat(), Rast_get_d_value(), Rast_get_f_value(), Rast_get_row_colors(), Rast_get_vrt_row(), Rast_map_to_img_str(), Rast_raster_cmp(), and Rast_row_update_fp_range().
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 44 of file reclass.c.
Referenced by Rast__mask_info(), Rast_get_cellhd(), and Rast_mask_status().
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 80 of file reclass.c.
References G_fopen_old_misc(), G_malloc, G_realloc, l, name, and NULL.
Check for legal semantic label.
Legal semantic label must be a legal GRASS file name. Semantic labels are capped in length to GNAME_MAX.
This function will return false if provided semantic label is not considered to be valid. This function does not check if semantic label maps to any entry in metadata files of semantic labels as not all semantic labels have files with extra metadata.
The function prints a warning on error.
| semantic | label reference to check |
Definition at line 154 of file raster_metadata.c.
References _, G_legal_filename(), G_warning(), and GNAME_MAX.
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 293 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 310 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 180 of file color_xform.c.
References max, min, Rast_add_d_color_rule(), Rast_get_d_color(), Rast_get_d_color_range(), Rast_get_default_color(), Rast_get_null_value_color(), Rast_init_colors(), Rast_set_default_color(), Rast_set_null_value_color(), and x.
| 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.
References CELL_TYPE, G_zero(), Rast__lookup_colors(), and Rast__organize_colors().
Referenced by Gs_build_256lookup(), Gs_pack_colors(), Rast_print_colors(), and Rast_print_json_colors().
| 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.
References G_zero(), Rast__lookup_colors(), and Rast__organize_colors().
Referenced by D_draw_raster_RGB(), Rast_get_color(), Rast_get_row_colors(), and 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.
References DCELL_TYPE, G_zero(), Rast__lookup_colors(), and Rast__organize_colors().
| 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 112 of file color_look.c.
References FCELL_TYPE, G_zero(), Rast__lookup_colors(), and Rast__organize_colors().
Referenced by Gs_pack_colors_float().
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 298 of file color_compat.c.
References max, min, and Rast_make_colors().
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 312 of file color_compat.c.
References max, min, and Rast_make_fp_colors().
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 242 of file color_compat.c.
References max, min, and Rast_make_colors().
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 256 of file color_compat.c.
References max, min, and Rast_make_fp_colors().
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 270 of file color_compat.c.
References max, min, and Rast_make_colors().
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 284 of file color_compat.c.
References max, min, and Rast_make_fp_colors().
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 214 of file color_compat.c.
References max, min, and Rast_make_colors().
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 228 of file color_compat.c.
References max, min, and Rast_make_fp_colors().
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 335 of file raster/color_rules.c.
References max, min, and name.
Referenced by Rast_make_aspect_colors(), Rast_make_bgyr_colors(), Rast_make_byg_colors(), Rast_make_byr_colors(), Rast_make_grey_scale_colors(), Rast_make_gyr_colors(), Rast_make_rainbow_colors(), Rast_make_ramp_colors(), Rast_make_ryg_colors(), Rast_make_wave_colors(), and Rast_read_colors().
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 349 of file raster/color_rules.c.
References max, min, and name.
Referenced by Rast3d_read_colors(), Rast_make_aspect_fp_colors(), Rast_make_bgyr_fp_colors(), Rast_make_byg_fp_colors(), Rast_make_byr_fp_colors(), Rast_make_grey_scale_fp_colors(), Rast_make_gyr_fp_colors(), Rast_make_rainbow_fp_colors(), Rast_make_ramp_fp_colors(), Rast_make_ryg_fp_colors(), Rast_make_wave_fp_colors(), and Rast_read_colors().
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.
References max, min, and Rast_make_colors().
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.
References max, min, and Rast_make_fp_colors().
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.
References max, min, and Rast_make_colors().
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.
References max, min, and Rast_make_fp_colors().
| 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 132 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.
References count, DEFAULT_BG_COLOR, G_str_to_color(), Rast_add_c_color_rule(), Rast_init_colors(), Rast_next_cell_stat(), Rast_rewind_cell_stats(), Rast_set_null_value_color(), and x.
| 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.
References count, DEFAULT_BG_COLOR, G_str_to_color(), max, min, Rast_add_c_color_rule(), Rast_init_colors(), Rast_next_cell_stat(), Rast_rewind_cell_stats(), Rast_set_null_value_color(), and x.
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.
References max, min, and Rast_make_colors().
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.
References max, min, and Rast_make_fp_colors().
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.
References max, min, and Rast_make_colors().
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.
References max, min, and Rast_make_fp_colors().
make random colors
Generates random colors. Good as a first pass at a color table for nominal data.
| colors | |
| min | |
| max |
Definition at line 23 of file color_rand.c.
References _, count, DEVIATION, G_fatal_error(), G_lrand48(), G_srand48_auto(), max, MAX_COLORS, min, Rast_add_modular_c_color_rule(), Rast_init_colors(), and Rast_set_c_color_range().
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.
References max, min, and Rast_make_colors().
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.
References max, min, and Rast_make_fp_colors().
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.
References max, min, and Rast_make_colors().
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.
References max, min, and Rast_make_fp_colors().
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 850 of file raster/open.c.
References _, access, G_fatal_error(), G_file_name(), G_find_raster2(), G_fully_qualified_name(), GPATH_MAX, fileinfo::mapset, and name.
Referenced by Gs_numtype(), gsd_put_legend(), and Rast_read_colors().
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, name, 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 883 of file raster/open.c.
References _, access, CELL_TYPE, DCELL_TYPE, G_fatal_error(), G_file_name(), G_find_raster2(), GPATH_MAX, fileinfo::mapset, name, and Rast__check_fp_type().
Referenced by Rast__open_old(), Rast__quant_import(), Rast_get_gdal_link(), Rast_read_fp_range(), Rast_read_range(), Rast_write_quant(), and Rast_write_range().
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 492 of file raster/cats.c.
References CELL_TYPE, and Rast_mark_cats().
| 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 557 of file raster/cats.c.
References G_incr_void_ptr, Rast_cell_size(), Rast_get_d_value(), Rast_is_c_null_value, and Rast_quant_get_cell_value().
Referenced by Rast_mark_c_cats(), Rast_mark_d_cats(), and Rast_mark_f_cats().
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 393 of file raster/color_read.c.
References Colors::is_float.
Referenced by Rast3d_read_colors(), and Rast_read_colors().
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 533 of file raster/cats.c.
References DCELL_TYPE, and Rast_mark_cats().
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 512 of file raster/cats.c.
References FCELL_TYPE, and Rast_mark_cats().
Get a printable text with information about raster mask.
Determines if 2D raster mask is present and returns textual information about the mask suitable for end-user display. The resulting text is translated. Caller is responsible for freeing the memory of the returned string.
Definition at line 39 of file mask_info.c.
References _, G_store(), GMAPSET_MAX, GNAME_MAX, name, Rast__mask_info(), and strcpy.
Check presence of 2D raster mask.
Definition at line 198 of file mask_info.c.
References G_find_raster2(), name, NULL, and Rast_mask_name().
Referenced by Rast_disable_omp_on_mask().
Retrieves the name of the raster mask to use.
The returned raster map name is fully qualified, i.e., in the form "name@mapset". The mask name is returned whether the mask is present or not.
This function checks if an environment variable "GRASS_MASK" is set. If it is set, the value of the environment variable is returned as the mask name. If it is not set, the function will default to the mask name "MASK@<mapset>", where <mapset> is the current mapset.
The memory for the returned mask name is dynamically allocated using G_store(). It is the caller's responsibility to free the memory with G_free() when it is no longer needed.
Definition at line 77 of file mask_info.c.
References G_fully_qualified_name(), G_mapset(), and NULL.
Referenced by Rast__check_for_auto_masking(), and Rast_mask_is_present().
| bool Rast_mask_status | ( | char * | name, |
| char * | mapset, | ||
| bool * | is_mask_reclass, | ||
| char | reclass_name[256], | ||
| char | reclass_mapset[256] | ||
| ) |
Get raster mask status information.
is_mask_reclass is a pointer to a bool variable which will be set to true if mask raster is a reclass and false otherwise.
If you are not interested in the underlying reclassified raster map, pass NULL pointers for the three reclass parameters:
| [out] | name | Name of the raster map used as mask |
| [out] | mapset | Name of the mapset the raster is in |
| [out] | is_mask_reclass | Will be set to true if mask raster is a reclass |
| [out] | reclass_name | Name of the underlying reclassified raster map |
| [out] | reclass_mapset | Name of the mapset the reclassified raster is in |
Definition at line 138 of file mask_info.c.
References name, and Rast_is_reclass().
Test for raster mask presence and get file descriptor if present.
This function tests the mask presence and takes into account the state of auto-masking in the library, so mask is considered as not present when masking is suppressed regardless of the presence of the mask raster.
Definition at line 30 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 312 of file cell_stats.c.
References count, Cell_stats::curoffset, Cell_stats::curp, Cell_stats::N, Cell_stats::node, and SHIFT.
Referenced by Rast_cell_stats_histo_eq(), Rast_histogram_eq_colors(), Rast_make_histogram_cs(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), and Rast_write_histogram_cs().
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 203 of file raster/window.c.
References Cell_head::north, and Cell_head::ns_res.
Referenced by Rast_get_sample_bilinear(), Rast_get_sample_cubic(), and Rast_get_sample_nearest().
| int Rast_number_of_cats | ( | struct Categories * | pcats | ) |
Get number of raster categories.
| pcats | pointer to Categories structure |
Definition at line 1268 of file raster/cats.c.
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 411 of file raster/open.c.
References CELL_TYPE, name, and OPEN_NEW_COMPRESSED.
Referenced by create_raster().
Opens a new cell file in a database (uncompressed)
See also Rast_open_new().
| name | map name |
Definition at line 426 of file raster/open.c.
References CELL_TYPE, name, and OPEN_NEW_UNCOMPRESSED.
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 500 of file raster/open.c.
References R__::fp_type, name, and OPEN_NEW_COMPRESSED.
Referenced by IL_resample_output_2d().
Opens new fcell file in a database (uncompressed)
See Rast_open_fp_new() for details.
| name | map name |
Definition at line 514 of file raster/open.c.
References R__::fp_type, name, and OPEN_NEW_UNCOMPRESSED.
| 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 1002 of file raster/open.c.
References name, and OPEN_NEW_COMPRESSED.
Referenced by I_compute_scatts(), IL_output_2d(), and N_write_array_2d_to_rast().
| 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 1017 of file raster/open.c.
References name, and OPEN_NEW_UNCOMPRESSED.
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 111 of file raster/open.c.
References name, Rast__check_for_auto_masking(), and Rast__open_old().
Referenced by Gs_get_cat_label(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), I_compute_scatts(), I_insert_patch_to_cat_rast(), IL_create_bitmask(), N_read_rast_to_array_2d(), open_band_files(), and Rast_map_to_img_str().
Get interpolation method from the option.
Calls G_fatal_error() on unknown interpolation method.
Supported methods:
| option | pointer to interpolation option |
Definition at line 196 of file interp.c.
References _, G_fatal_error(), INTERP_BICUBIC, INTERP_BILINEAR, INTERP_NEAREST, and INTERP_UNKNOWN.
Number of columns in active output window.
This routine returns the number of columns in the active output window.
Definition at line 183 of file raster/window.c.
References 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().
Number of rows in active output window.
This routine returns the number of rows in the active output window.
Definition at line 169 of file raster/window.c.
References Rast__init_window(), 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 57 of file raster/color_rules.c.
References b, CR_ERROR_COLOR_SYNTAX, CR_ERROR_PERCENT, CR_ERROR_RULE_SYNTAX, CR_ERROR_VALUE, CR_OK, g, G_chop(), G_str_to_color(), G_strcasecmp(), max, min, r, and x.
Referenced by Rast_read_color_rule().
Parse color rule.
| code |
Definition at line 111 of file raster/color_rules.c.
References _, CR_ERROR_COLOR_SYNTAX, CR_ERROR_PERCENT, CR_ERROR_RULE_SYNTAX, CR_ERROR_VALUE, and CR_OK.
Referenced by Rast_read_color_rule().
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 42 of file color_out.c.
References b, count, g, max, min, r, Rast_colors_count(), Rast_get_c_color_range(), Rast_get_default_color(), Rast_get_fp_color_rule(), Rast_get_null_value_color(), Rast_lookup_c_colors(), and Colors::version.
| void Rast_print_json_colors | ( | struct Colors * | colors, |
| DCELL | min, | ||
| DCELL | max, | ||
| FILE * | fp, | ||
| int | perc, | ||
| ColorFormat | clr_frmt | ||
| ) |
Print color table in JSON format.
| 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 |
| clr_frmt | color format to be used (RBG, HEX, HSV, TRIPLET). |
Definition at line 97 of file json_color_out.c.
References _, b, COLOR_STRING_LENGTH, count, g, G_color_to_str(), G_fatal_error(), G_json_array(), G_json_free_serialized_string(), G_json_object(), G_json_object_set_string(), G_json_object_set_value(), G_json_serialize_to_string_pretty(), G_json_value_free(), G_json_value_init_array(), G_json_value_init_object(), json_string(), max, min, NULL, r, Rast_colors_count(), Rast_get_c_color_range(), Rast_get_default_color(), Rast_get_fp_color_rule(), Rast_get_null_value_color(), Rast_lookup_c_colors(), and Colors::version.
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().
Referenced by N_write_array_2d_to_rast().
Definition at line 15 of file put_title.c.
References _, G_fopen_new(), G_fopen_old(), G_free(), G_getl(), G_mapset(), G_strip(), G_tempfile(), G_warning(), name, and strcpy.
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(), G_fopen_new(), and name.
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().
Referenced by N_write_array_2d_to_rast(), and P_Aux_to_Raster().
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().
Referenced by IL_output_2d(), IL_resample_output_2d(), and N_write_array_2d_to_rast().
Put reclass.
| name | map name |
| reclass | pointer to Reclass structure |
Definition at line 317 of file reclass.c.
References _, G_fatal_error(), G_file_name_misc(), G_free(), G_fseek(), G_fully_qualified_name(), G_getl2(), G_mapset(), G_warning(), GMAPSET_MAX, GNAME_MAX, GPATH_MAX, Reclass::mapset, Reclass::max, max, Reclass::min, min, Reclass::name, name, NULL, Reclass::num, Rast_is_c_null_value, RECLASS_TABLE, strcpy, 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 create_raster(), 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 469 of file quant.c.
References Quant_table::cHigh, Quant_table::cLow, Quant_table::dHigh, Quant_table::dLow, Quant::fp_lookup, G_free(), Quant::nofRules, and Quant::table.
Referenced by Rast_quantize_fp_map_range(), Rast_set_d_cat(), and Rast_set_quant_rules().
Resets the number of defined rules and number of infinite rules to 0.
| q | pointer to Quant structure to be reset |
Definition at line 41 of file quant.c.
References Quant::infiniteLeftSet, Quant::infiniteRightSet, and Quant::nofRules.
Referenced by Rast_quant_free(), and Rast_quant_init().
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 55 of file quant.c.
References Quant::fp_lookup, G_free(), Quant::maxNofRules, Rast_quant_clear(), and Quant::table.
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 592 of file quant.c.
References Quant_table::cHigh, Quant_table::cLow, Quant_table::dHigh, Quant_table::dLow, Quant::fp_lookup, Quant::infiniteCLeft, Quant::infiniteCRight, NO_DATA, NO_EXPLICIT_RULE, NO_FINITE_RULE, NO_LEFT_INFINITE_RULE, NO_RIGHT_INFINITE_RULE, Rast__quant_get_rule_for_d_raster_val(), Rast__quant_organize_fp_lookup(), Rast_is_d_null_value, Quant::round_only, Quant::truncate_only, and USE_LOOKUP.
Referenced by Rast_get_cat(), Rast_mark_cats(), 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 327 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.
| q | 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 281 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 390 of file quant.c.
References Quant::infiniteCLeft, Quant::infiniteDLeft, and Quant::infiniteLeftSet.
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 438 of file quant.c.
References Quant::infiniteCRight, Quant::infiniteDRight, and Quant::infiniteRightSet.
Referenced by Rast_set_quant_rules().
Initialize the structure.
Initializes the q struct.
| quant | pointer to Quant structure to be initialized |
Definition at line 175 of file quant.c.
References 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().
Returns whether or not quant rules are set to round map.
| quant | pointer to Quant structure which holds quant rules info |
Definition at line 204 of file quant.c.
References Quant::round_only.
Referenced by Rast_read_range().
Returns whether or not quant rules are set to truncate map.
| quant | pointer to Quant structure which holds quant rules info |
Definition at line 192 of file quant.c.
References Quant::truncate_only.
Referenced by Rast_read_range().
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 309 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 715 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 735 of file quant.c.
References Rast_is_f_null_value, Rast_quant_get_cell_value(), and Rast_set_c_null_value().
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 513 of file quant.c.
References Quant_table::cHigh, Quant_table::cLow, Quant_table::dHigh, Quant_table::dLow, Quant::nofRules, and Quant::table.
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 230 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 364 of file quant.c.
References Quant::fp_lookup, Quant::infiniteCLeft, Quant::infiniteDLeft, and Quant::infiniteLeftSet.
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 412 of file quant.c.
References Quant::fp_lookup, Quant::infiniteCRight, Quant::infiniteDRight, and Quant::infiniteRightSet.
Referenced by Rast_set_quant_rules().
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 217 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 would want to have a quant rule: 0.0, 90.0 -> 0 , 90 no matter what the min and max slope of this map is.
| name | map name |
| mapset | mapset name |
| min | minimum value |
| max | maximum value |
Definition at line 81 of file quant_rw.c.
References _, G_fatal_error(), G_fully_qualified_name(), max, min, name, Rast_get_fp_range_min_max(), Rast_is_d_null_value, Rast_quantize_fp_map_range(), and Rast_read_fp_range().
| void Rast_quantize_fp_map_range | ( | const char * | name, |
| const char * | mapset, | ||
| DCELL | d_min, | ||
| DCELL | d_max, | ||
| CELL | min, | ||
| CELL | max | ||
| ) |
Write quant rules (f_quant) for floating-point raster map.
Writes the f_quant file for the raster map name with one rule. The rule is generated using the floating-point range [dmin,dmax] and the integer range [min,max]. This routine differs from the one above in that the application controls the floating-point range. For example, r.slope.aspect will use this routine to quantize the slope map from [0.0, 90.0] to [0, 90] even if the range of slopes is not 0-90. The aspect map would be quantized from [0.0, 360.0] to [0, 360].
Make a rule for map <name> that maps floating range (d_min, d_max) into integer range (min, max) This function is useful when the quant rule doesn't depend of the range of produced float data, for example the slope map would want to have a quant rule: 0.0, 90.0 -> 0 , 90 no matter what the min and max slope of this map is.
| name | map name |
| mapset | mapset name |
| d_min | minimum fp value |
| d_max | maximum fp value |
| min | minimum value |
| max | maximum value |
Definition at line 124 of file quant_rw.c.
References max, min, name, Rast_quant_add_rule(), Rast_quant_init(), and Rast_write_quant().
Referenced by IL_output_2d(), IL_resample_output_2d(), and Rast_quantize_fp_map().
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().
Referenced by Rast__lookup_colors().
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().
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.
References _, G_warning(), and name.
Referenced by Gs_get_cat_label(), and 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 147 of file raster/color_rules.c.
References _, b, g, G_debug(), G_fatal_error(), G_getl2(), G_strip(), max, min, r, Rast_parse_color_rule(), and Rast_parse_color_rule_error().
Referenced by Rast_read_color_rules().
| 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 191 of file raster/color_rules.c.
References _, b, g, G_fatal_error(), G_free(), G_realloc, max, min, NULL, r, Rast_add_d_color_rule(), Rast_init_colors(), Rast_read_color_rule(), Rast_set_d_color(), Rast_set_default_color(), and Rast_set_null_value_color().
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 54 of file raster/color_read.c.
References _, DEFAULT_COLOR_TABLE, err(), G_find_raster(), G_mapset(), G_warning(), GNAME_MAX, max, min, name, Rast__read_colors(), Rast_get_fp_range_min_max(), Rast_get_range_min_max(), Rast_init_colors(), Rast_is_c_null_value, Rast_is_d_null_value, Rast_make_colors(), Rast_make_fp_colors(), Rast_map_is_fp(), Rast_mark_colors_as_fp(), Rast_read_fp_range(), Rast_read_range(), and strcpy.
Referenced by Gs_build_256lookup(), Gs_pack_colors(), Gs_pack_colors_float(), gsd_put_legend(), IL_resample_output_2d(), and Rast_map_to_img_str().
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 raster/range.c.
References _, CELL_TYPE, close, Range::first_time, G_debug(), G_find_file2_misc(), G_free(), G_fully_qualified_name(), G_open_old_misc(), G_warning(), G_xdr_get_double(), Range::max, Range::min, name, Rast_init(), Rast_init_fp_range(), Rast_map_type(), Rast_read_range(), Rast_update_fp_range(), read, and XDR_DOUBLE_NBYTES.
Referenced by gsd_put_legend(), Rast_quantize_fp_map(), Rast_read_colors(), and Rast_read_range().
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 40 of file histogram.c.
References _, count, G_fatal_error(), G_find_file2_misc(), G_fopen_old_misc(), G_warning(), name, NULL, Rast_extend_histogram(), Rast_init_histogram(), and Rast_sort_histogram().
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 107 of file raster/history.c.
References _, G_fopen_old(), G_warning(), G_zero(), name, and Rast__read_history().
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 | |
| quant |
Definition at line 187 of file quant_rw.c.
References name, Rast__quant_import(), and Rast_quant_init().
Referenced by Rast__open_old(), and Rast_read_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 163 of file raster/range.c.
References _, CELL_TYPE, count, G_find_file2_misc(), G_fopen_old_misc(), G_free(), G_fully_qualified_name(), G_warning(), name, 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 Gs_numtype(), gsd_put_legend(), I_compute_scatts(), Rast_get_max_c_cat(), Rast_read_colors(), and Rast_read_fp_range().
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 287 of file raster/range.c.
References _, close, count, G_debug(), G_find_file2_misc(), G_free(), G_fully_qualified_name(), G_open_old_misc(), G_warning(), G_xdr_get_double(), name, Rast_init(), read, FPRange::rstats, and XDR_DOUBLE_NBYTES.
Get a raster map semantic label metadata string.
Read raster semantic label metadata file and put string in to str
| name | raster map name |
| mapset | mapset name |
Definition at line 96 of file raster_metadata.c.
References name.
Referenced by Rast_get_semantic_label_or_name().
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 38 of file raster_metadata.c.
References name.
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 67 of file raster_metadata.c.
References name.
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.
References _, G_warning(), and name.
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, GNAME_MAX, and name.
Removes the histogram.
Removes the histogram information associated with map layer "name"
| name | name of map |
Definition at line 329 of file histogram.c.
References G_remove_misc(), and name.
| 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 584 of file raster/cats.c.
| 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 248 of file cell_stats.c.
References Cell_stats::curoffset, Cell_stats::curp, Cell_stats::N, and Cell_stats::node.
Referenced by Rast_cell_stats_histo_eq(), Rast_histogram_eq_colors(), Rast_make_histogram_cs(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), and Rast_write_histogram_cs().
Writes the quant rules.
Writes the quant rules which indicate that all floating numbers should be rounded instead of applying any quant rules from floats to integers.
| name | map name |
| mapset | mapset name |
Definition at line 51 of file quant_rw.c.
References name, Rast_quant_init(), Rast_quant_round(), and Rast_write_quant().
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 131 of file raster/window_map.c.
References count, R__::fileinfo, and R__::rd_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.
References Cell_head::north, and Cell_head::ns_res.
Referenced by P_Read_Raster_Region_Map(), and P_Regular_Points().
| 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 652 of file raster/range.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, FPRange::first_time, G_incr_void_ptr, FPRange::max, FPRange::min, min, Rast_cell_size(), Rast_is_null_value(), and FPRange::rstats.
Referenced by Rast3d_range_update_from_tile().
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 592 of file raster/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 766 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.
References b, g, r, Rast_add_c_color_rule(), Rast_is_c_null_value, and Rast_set_null_value_color().
Referenced by create_raster().
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.
References Colors::cmax, Colors::cmin, max, and min.
Referenced by Rast_make_random_colors().
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(), N_put_array_2d_value_null(), Rast_fpreclass_perform_di(), Rast_fpreclass_perform_fi(), Rast_fpreclass_perform_ii(), Rast_get_c_value(), 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 95 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, Rast_is_c_null_value, and Rast_set_null_value().
| 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 915 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 1189 of file raster/cats.c.
References G_newlines_to_spaces(), G_store(), and G_strip().
| 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 1170 of file raster/cats.c.
References G_newlines_to_spaces(), G_store(), G_strip(), and NULL.
Referenced by Rast_init_cats().
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 456 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 804 of file raster/cats.c.
References G_free(), G_malloc, G_newlines_to_spaces(), G_realloc, G_store(), G_strip(), NULL, Rast_get_ith_d_cat(), Rast_is_d_null_value, and Rast_quant_add_rule().
Referenced by Rast_copy_cats(), Rast_set_cat(), and Rast_sort_cats().
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.
References b, g, r, Rast_add_d_color_rule(), Rast_is_d_null_value, and Rast_set_null_value_color().
Referenced by Rast_read_color_rules().
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.
References Colors::cmax, Colors::cmin, max, and min.
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 153 of file null_val.c.
Referenced by c_ave(), c_intr(), c_kurt(), c_max(), c_maxx(), c_median(), c_min(), c_minx(), c_mode(), c_quant(), c_range(), c_skew(), c_stddev(), c_sum(), c_thresh(), c_var(), IL_grid_calc_2d(), N_copy_array_2d(), N_put_array_2d_value_null(), P_Aux_to_Raster(), Rast3d_set_null_value(), Rast_create_gdal_link(), Rast_fpreclass_get_cell_value(), Rast_fpreclass_perform_dd(), Rast_fpreclass_perform_fd(), Rast_fpreclass_perform_id(), Rast_get_d_value(), Rast_get_fp_range_min_max(), Rast_get_gdal_link(), Rast_get_ith_d_cat(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), Rast_get_sample_nearest(), Rast_init_fp_range(), Rast_quant_get_limits(), Rast_set_null_value(), w_ave(), w_kurt(), w_max(), w_median(), w_min(), w_mode(), 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 161 of file raster/raster.c.
References CELL_TYPE, DCELL_TYPE, FCELL_TYPE, Rast_is_d_null_value, and Rast_set_null_value().
Referenced by P_Aux_to_Raster(), Rast_get_ith_c_cat(), Rast_get_ith_cat(), Rast_get_ith_f_cat(), and Rast_get_next_marked_cat().
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 99 of file color_set.c.
References Colors::undef_blu, Colors::undef_grn, Colors::undef_red, and Colors::undef_set.
Referenced by Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), and Rast_read_color_rules().
| 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 784 of file raster/cats.c.
References FCELL_TYPE, and Rast_set_cat().
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(), N_put_array_2d_value_null(), Rast3d_set_null_value(), 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 128 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 822 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 369 of file histogram.c.
References count, and Rast_extend_histogram().
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 193 of file raster/history.c.
References History::fields, G_free(), G_store(), and NULL.
Referenced by Rast_short_history().
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 97 of file raster/set_window.c.
References G_adjust_Cell_head(), Rast__init(), R__::rd_window, and R__::split_window.
| 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 N_gwflow_2d_calc_water_budget(), N_gwflow_3d_calc_water_budget(), Rast3d_gradient_double(), Rast__set_null_value(), Rast_get_vrt_row(), Rast_set_c_value(), Rast_set_d_value(), and Rast_set_f_value().
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.
References Colors::null_blu, Colors::null_grn, Colors::null_red, and Colors::null_set.
Referenced by Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), Rast_read_color_rules(), Rast_set_c_color(), and Rast_set_d_color().
Establishes 'window' as the current working window for output.
| window | window to become operative window |
Definition at line 76 of file raster/set_window.c.
References G_adjust_Cell_head(), G_set_window(), Rast__init(), R__::split_window, and R__::wr_window.
Referenced by IL_resample_output_2d().
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 1036 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, OPEN_OLD, 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.
Establishes 'window' as the current working window.
| window | window to become operative window |
Definition at line 43 of file raster/set_window.c.
References _, G_adjust_Cell_head(), G_warning(), Rast__init(), R__::rd_window, R__::split_window, and R__::wr_window.
Referenced by D_setup(), I_compute_scatts(), I_insert_patch_to_cat_rast(), IL_output_2d(), and N_init_geom_data_2d().
Definition at line 17 of file color_shift.c.
References Colors::shift.
Definition at line 22 of file color_shift.c.
References Colors::shift.
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 |
Definition at line 227 of file raster/history.c.
References _, G_date(), G_mapset(), G_program_name(), G_whoami(), G_zero(), HIST_CREATOR, HIST_DATSRC_1, HIST_DATSRC_2, HIST_KEYWRD, HIST_MAPID, HIST_MAPSET, HIST_MAPTYPE, HIST_TITLE, name, History::nlines, Rast_format_history(), and Rast_set_history().
Referenced by IL_output_2d(), and IL_resample_output_2d().
| int Rast_sort_cats | ( | struct Categories * | pcats | ) |
Sort categories.
| pcats | pointer to Categories structure |
Definition at line 1281 of file raster/cats.c.
References G_debug(), G_free(), G_malloc, Rast_copy_cats(), Rast_free_cats(), Rast_get_ith_d_cat(), Rast_init_cats(), and Rast_set_d_cat().
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 216 of file histogram.c.
Referenced by Rast_make_histogram_cs(), and Rast_read_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 275 of file histogram.c.
References LIST.
Suppresses masking.
Definition at line 87 of file auto_mask.c.
References R__::auto_mask, R__::mask_fd, Rast__init(), and Rast_close().
Writes the quant rules.
Writes the quant rules which indicate that all floating numbers should be truncated instead of applying any quant rules from floats to integers.
| name | map name |
| mapset | mapset name |
Definition at line 31 of file quant_rw.c.
References name, Rast_quant_init(), Rast_quant_truncate(), and Rast_write_quant().
| void Rast_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 469 of file raster/cats.c.
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(), and OPEN_OLD.
Referenced by Rast__check_for_auto_masking(), and Rast_get_vrt_row().
Unset current window.
Definition at line 64 of file raster/set_window.c.
References G_debug(), and R__::window_set.
Unsuppresses masking.
Definition at line 104 of file auto_mask.c.
References R__::auto_mask, R__::mask_fd, Rast__check_for_auto_masking(), and Rast__init().
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.
References G_realloc, INCR, Cell_stats::N, N, Cell_stats::node, NODE, Cell_stats::null_data_count, Rast_is_c_null_value, SHIFT, and Cell_stats::tlen.
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 565 of file raster/range.c.
References FPRange::first_time, FPRange::max, FPRange::min, 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 537 of file raster/range.c.
References Range::first_time, Range::max, Range::min, min, and Rast_is_c_null_value.
Referenced by Rast_construct_default_range(), and Rast_read_range().
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 439 of file raster/open.c.
References R__::want_histogram.
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 121 of file raster/window.c.
References _, G_fatal_error(), Rast__init_window(), R__::split_window, and R__::wr_window.
Referenced by create_raster(), P_Aux_to_Raster(), Rast_allocate_buf(), Rast_allocate_c_buf(), Rast_allocate_d_buf(), Rast_allocate_f_buf(), Rast_allocate_null_buf(), Rast_get_row_colors(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), Rast_get_sample_nearest(), Rast_map_to_img_str(), and Rast_zero_buf().
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 84 of file raster/window.c.
References _, G_fatal_error(), Rast__init_window(), R__::split_window, and R__::wr_window.
Referenced by create_raster(), I_compute_scatts(), P_Aux_to_Raster(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), Rast_get_sample_nearest(), and Rast_map_to_img_str().
| 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.
References name.
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 74 of file raster/color_write.c.
References _, G_fatal_error(), G_fopen_new(), G_mapset(), G_name_is_fully_qualified(), G_remove(), GMAPSET_MAX, GNAME_MAX, name, Rast__write_colors(), and strcpy.
Referenced by create_raster(), IL_output_2d(), and IL_resample_output_2d().
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 426 of file raster/range.c.
References _, close, FPRange::first_time, G_fatal_error(), G_open_new_misc(), G_remove_misc(), G_xdr_put_double(), FPRange::max, FPRange::min, name, Rast_init(), Rast_write_rstats(), FPRange::rstats, write, and XDR_DOUBLE_NBYTES.
Writes the histogram information.
Writes the histogram information associated with map layer "name"
| name | name of map |
| histogram | struct for histogram |
Definition at line 84 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 108 of file histogram.c.
References count, name, Rast_next_cell_stat(), and Rast_rewind_cell_stats().
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 raster/history.c.
References _, G_fatal_error(), G_fopen_new(), name, and Rast__write_history().
Referenced by IL_output_2d(), and IL_resample_output_2d().
Writes the quant rule table for the raster map.
Writes the f_quant file for the raster map name from q. if mapset==G_mapset() i.e. the map is in current mapset, then the original quant file in cell_misc/map/f_quant is written. Otherwise q is written into quant2/mapset/name (much like colr2 element). This results in map@mapset being read using quant rules stored in q from G_mapset(). See Rast_read_quant() for detailes.
| name | map name |
| mapset | mapset name |
| quant | pointer to Quant structure which hold quant rules info |
Definition at line 150 of file quant_rw.c.
References _, CELL_TYPE, G_fatal_error(), G_warning(), name, Rast__quant_export(), Rast_map_type(), and Rast_quant_get_limits().
Referenced by Rast_quantize_fp_map_range(), Rast_round_fp_map(), and Rast_truncate_fp_map().
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 390 of file raster/range.c.
References _, CELL_TYPE, Range::first_time, G_fatal_error(), G_fopen_new_misc(), G_mapset(), G_remove_misc(), Range::max, Range::min, name, Rast_map_type(), Rast_write_rstats(), and Range::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 468 of file raster/range.c.
References _, close, count, G_fatal_error(), G_open_new_misc(), G_remove_misc(), G_xdr_put_double(), name, Rast_init(), FPRange::rstats, write, and XDR_DOUBLE_NBYTES.
Referenced by Rast_write_fp_range(), and Rast_write_range().
Write a string into a rasters semantic label metadata file.
Raster map must exist in the current mapset.
It is up to the caller to validate semantic label string in advance with Rast_legal_semantic_label().
| name | raster map name |
| str | string containing data to be written |
Definition at line 130 of file raster_metadata.c.
References name.
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 51 of file raster_metadata.c.
References name.
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 80 of file raster_metadata.c.
References name.
| 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.
References name.
| 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().
Zero out histogram struct.
| histogram | struct for histogram |
Definition at line 407 of file histogram.c.
| void Rast_zero_input_buf | ( | void * | rast, |
| RASTER_MAP_TYPE | data_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 * | rast, |
| RASTER_MAP_TYPE | data_type | ||
| ) |
Definition at line 38 of file zero_cell.c.
References Rast_cell_size(), and Rast_output_window_cols().