GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
Raster library - Get raster row. More...
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <grass/config.h>
#include <grass/raster.h>
#include <grass/glocale.h>
#include "R.h"
Go to the source code of this file.
Macros | |
#define | check_null_bit(flags, bit_num) ((flags)[(bit_num)>>3] & ((unsigned char)0x80>>((bit_num)&7)) ? 1 : 0) |
Functions | |
void | Rast_get_row_nomask (int fd, void *buf, int row, RASTER_MAP_TYPE data_type) |
Read raster row without masking. More... | |
void | Rast_get_c_row_nomask (int fd, CELL *buf, int row) |
Read raster row without masking (CELL type) More... | |
void | Rast_get_f_row_nomask (int fd, FCELL *buf, int row) |
Read raster row without masking (FCELL type) More... | |
void | Rast_get_d_row_nomask (int fd, DCELL *buf, int row) |
Read raster row without masking (DCELL type) More... | |
void | Rast_get_row (int fd, void *buf, int row, RASTER_MAP_TYPE data_type) |
Get raster row. More... | |
void | Rast_get_c_row (int fd, CELL *buf, int row) |
Get raster row (CELL type) More... | |
void | Rast_get_f_row (int fd, FCELL *buf, int row) |
Get raster row (FCELL type) More... | |
void | Rast_get_d_row (int fd, DCELL *buf, int row) |
Get raster row (DCELL type) More... | |
int | Rast__read_null_bits (int fd, int row, unsigned char *flags) |
void | Rast_get_null_value_row (int fd, char *flags, int row) |
Read or simulate null value row. More... | |
Raster library - Get raster row.
(C) 2003-2009 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file raster/get_row.c.
#define check_null_bit | ( | flags, | |
bit_num | |||
) | ((flags)[(bit_num)>>3] & ((unsigned char)0x80>>((bit_num)&7)) ? 1 : 0) |
Definition at line 898 of file raster/get_row.c.
int Rast__read_null_bits | ( | int | fd, |
int | row, | ||
unsigned char * | flags | ||
) |
Definition at line 865 of file raster/get_row.c.
References fileinfo::cellhd, Cell_head::cols, R__::fileinfo, and fileinfo::null_fd.
void Rast_get_c_row | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Get raster row (CELL type)
Reads a row of raster data and leaves the NULL values intact. (As opposed to the deprecated function Rast_get_c_row() which converts NULL values to zero.)
NOTE. When the raster map is old and null file doesn't exist, it is assumed that all 0-cells are no-data. When map is floating point, uses quant rules set explicitly by Rast_set_quant_rules() or stored in map's quant file to convert floats to integers.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 783 of file raster/get_row.c.
References CELL_TYPE, and Rast_get_row().
Referenced by IL_create_bitmask().
void Rast_get_c_row_nomask | ( | int | fd, |
CELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (CELL type)
Same as Rast_get_c_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 682 of file raster/get_row.c.
References CELL_TYPE, and Rast_get_row_nomask().
Referenced by read_band_row().
void Rast_get_d_row | ( | int | fd, |
DCELL * | buf, | ||
int | row | ||
) |
Get raster row (DCELL type)
Same as Rast_get_f_row() except that the array dcell is double
.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 820 of file raster/get_row.c.
References DCELL_TYPE, and Rast_get_row().
void Rast_get_d_row_nomask | ( | int | fd, |
DCELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (DCELL type)
Same as Rast_get_d_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 714 of file raster/get_row.c.
References DCELL_TYPE, and Rast_get_row_nomask().
void Rast_get_f_row | ( | int | fd, |
FCELL * | buf, | ||
int | row | ||
) |
Get raster row (FCELL type)
Read a row from the raster map open on fd into the float
array fcell performing type conversions as necessary based on the actual storage type of the map. Masking, resampling into the current region. NULL-values are always embedded in fcell
(never converted to a value).
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 803 of file raster/get_row.c.
References FCELL_TYPE, and Rast_get_row().
void Rast_get_f_row_nomask | ( | int | fd, |
FCELL * | buf, | ||
int | row | ||
) |
Read raster row without masking (FCELL type)
Same as Rast_get_f_row() except no masking occurs.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
Definition at line 698 of file raster/get_row.c.
References FCELL_TYPE, and Rast_get_row_nomask().
void Rast_get_null_value_row | ( | int | fd, |
char * | flags, | ||
int | row | ||
) |
Read or simulate null value row.
Read or simulate null value row and set the cells corresponding to null value to 1. The masked out cells are set to null when the mask exists. (the MASK is taken care of by null values (if the null file doesn't exist for this map, then the null row is simulated by assuming that all zeros in raster map are nulls. Also all masked out cells become nulls.
fd | file descriptor for the opened map |
buf | buffer for the row to be placed into |
flags | |
row | data row desired |
Definition at line 1075 of file raster/get_row.c.
References R__::fileinfo, and fileinfo::reclass_flag.
void Rast_get_row | ( | int | fd, |
void * | buf, | ||
int | row, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Get raster row.
If data_type is
DCELL_TYPE, calls Rast_get_d_row()
Reads appropriate information into the buffer buf associated with the requested row row. buf is associated with the current window.
Note, that the type of the data in buf (say X) is independent of the type of the data in the file described by fd (say Y).
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 759 of file raster/get_row.c.
Referenced by Rast_get_c_row(), Rast_get_d_row(), Rast_get_f_row(), and Rast_map_to_img_str().
void Rast_get_row_nomask | ( | int | fd, |
void * | buf, | ||
int | row, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Read raster row without masking.
This routine reads the specified row from the raster map open on file descriptor fd into the buf buffer like Rast_get_c_row() does. The difference is that masking is suppressed. If the user has a mask set, Rast_get_c_row() will apply the mask but Rast_get_c_row_nomask() will ignore it. This routine prints a diagnostic message and returns -1 if there is an error reading the raster map. Otherwise a nonnegative value is returned.
Note. Ignoring the mask is not generally acceptable. Users expect the mask to be applied. However, in some cases ignoring the mask is justified. For example, the GRASS modules r.describe, which reads the raster map directly to report all data values in a raster map, and r.slope.aspect, which produces slope and aspect from elevation, ignore both the mask and the region. However, the number of GRASS modules which do this should be minimal. See Mask for more information about the mask.
fd | file descriptor for the opened raster map |
buf | buffer for the row to be placed into |
row | data row desired |
data_type | data type |
Definition at line 666 of file raster/get_row.c.
Referenced by Rast_get_c_row_nomask(), Rast_get_d_row_nomask(), Rast_get_f_row_nomask(), and Rast_get_vrt_row().