28#define FORMAT_FILE "f_format"
29#define NULL_FILE "null"
31#define NULLC_FILE "nullcmpr"
33static int new_fileinfo(
void)
83static int open_raster_new(
const char *
name,
int open_mode,
181 switch (reclass_flag) {
191 _(
"Unable to open raster map <%s@%s> since it is a reclass "
192 "of raster map <%s@%s> which does not exist"),
196 G_fatal_error(
_(
"Error reading reclass file for raster map <%s>"),
216 _(
"Raster map <%s@%s>: format field in header file invalid"),
235 G_fatal_error(
_(
"Compression with %s is not supported in this GRASS "
242 _(
"Raster map <%s> is in different projection than current region. "
243 "Found <%s>, should be <%s>."),
250 "current region (%d)"),
256 G_fatal_error(
_(
"Raster map <%s>: bytes per cell (%d) too large"),
297 fcb->cellhd = cellhd;
301 fcb->null_cur_row = -1;
315 if ((
fcb->reclass_flag = reclass_flag))
316 fcb->reclass = reclass;
346 if (
fcb->reclass_flag)
364 if (
fcb->null_fd < 0) {
367 if (
fcb->null_fd >= 0) {
378 fcb->null_file_exists =
fcb->null_fd >= 0;
478 for (i = 0; i <
sizeof(
CELL); i++)
481 return sizeof(
CELL) - 1;
519static int open_raster_new_gdal(
char *map,
char *mapset,
538 fcb->cellhd.compressed = 0;
551 fcb->null_cur_row = 0;
611 G_fatal_error(
_(
"Raster map <%s> is not in the current mapset (%s)"),
684 fcb->cellhd.compressed = 0;
691 fcb->cellhd.compressed == 1) {
693 fcb->cellhd.compressed = 2;
707 if (
fcb->null_fd < 0) {
728 fcb->null_cur_row = 0;
765 _(
"Raster map <%s> does not exist in the current mapset (%s)"),
769 G_fatal_error(
_(
"Raster map <%s> is not in the current mapset (%s)"),
787 if (
fcb->null_fd < 0) {
833 "FCELL_TYPE or DCELL_TYPE"));
925 return fcb->map_type;
941 const char *str, *
str1;
958 if (
strcmp(str,
"double") == 0)
960 else if (
strcmp(str,
"float") == 0)
1045 "raster maps opened for reading"));
#define OPEN_NEW_COMPRESSED
#define OPEN_NEW_UNCOMPRESSED
#define XDR_DOUBLE_NBYTES
AMI_err name(char **stream_name)
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
int G_unqualified_name(const char *, const char *, char *, char *)
Returns unqualified map name (without @ mapset)
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
char * G_compressor_name(int)
const char * G_projection_name(int)
Get projection name.
int G_legal_filename(const char *)
Check for legal database file name.
char * G_file_name_misc(char *, const char *, const char *, const char *, const char *)
Builds full path names to GIS misc data files.
int G_open_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
int G_make_mapset_object_group(const char *)
Create directory for group of elements of a given type.
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)
int G_open_old(const char *, const char *, const char *)
Open a database file for reading.
void G_free_key_value(struct Key_Value *)
Free allocated Key_Value structure.
char * G_tempfile(void)
Returns a temporary file name.
char * G_fully_qualified_name(const char *, const char *)
Get fully qualified element name.
struct Key_Value * G_read_key_value_file(const char *)
Read key/values pairs from file.
int G_check_compressor(int)
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)
char * G_store(const char *)
Copy string to allocated memory.
const char * G_find_raster2(const char *, const char *)
Find a raster map (look but don't touch)
const char * G_mapset(void)
Get current mapset name.
int Rast__read_null_row_ptrs(int, int)
int Rast_quant_get_neg_infinite_rule(const struct Quant *, DCELL *, CELL *)
Returns in "dLeft" and "c" the rule values.
int Rast__check_for_auto_masking(void)
Checks for auto masking.
unsigned char * Rast__allocate_null_bits(int)
Allocates memory for null bits.
int Rast_get_reclass(const char *, const char *, struct Reclass *)
Get reclass.
int Rast__check_format(int)
void Rast_quant_set_pos_infinite_rule(struct Quant *, DCELL, CELL)
Defines a rule for values "dRight" and larger.
int Rast_read_quant(const char *, const char *, struct Quant *)
Reads quantization rules for name in mapset and stores them in the quantization structure....
void Rast_quant_set_neg_infinite_rule(struct Quant *, DCELL, CELL)
Defines a rule for values "dLeft" and smaller.
struct GDAL_link * Rast_create_gdal_link(const char *, RASTER_MAP_TYPE)
Create GDAL settings for given raster map.
int Rast__write_row_ptrs(int)
int Rast__write_null_row_ptrs(int, int)
void Rast_quant_add_rule(struct Quant *, DCELL, DCELL, CELL, CELL)
Adds a new rule to the set of quantization rules.
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
void Rast_init_range(struct Range *)
Initialize range structure.
int Rast_quant_get_pos_infinite_rule(const struct Quant *, DCELL *, CELL *)
Returns in "dRight" and "c" the rule values.
void Rast_get_cellhd(const char *, const char *, struct Cell_head *)
Read the raster header.
void Rast_quant_init(struct Quant *)
Initialize the structure.
void Rast_init_fp_range(struct FPRange *)
Initialize fp range.
void Rast_quant_truncate(struct Quant *)
Sets the quant rules to perform simple truncation on floats.
void Rast_init_cell_stats(struct Cell_stats *)
Initialize cell stats.
struct R_vrt * Rast_get_vrt(const char *, const char *)
struct GDAL_link * Rast_get_gdal_link(const char *, const char *)
Get GDAL link settings for given raster map.
void Rast__create_window_mapping(int)
Create window mapping.
Header file for msvc/fcntl.c.
int Rast__open_old(const char *name, const char *mapset)
Lower level function, open cell files, supercell files, and the mask file.
void Rast_set_fp_type(RASTER_MAP_TYPE map_type)
Set raster map floating-point data format.
int Rast__open_null_write(const char *name)
int Rast_get_cell_format(CELL v)
Get cell value format.
int Rast_open_new(const char *name, RASTER_MAP_TYPE wr_type)
Opens a new raster map.
void Rast_set_quant_rules(int fd, struct Quant *q)
Sets quant translation rules for raster map opened for reading.
void Rast_want_histogram(int flag)
Save histogram for newly create raster map (cell)
RASTER_MAP_TYPE Rast_get_map_type(int fd)
Determine raster type from descriptor.
void Rast_set_cell_format(int n)
Sets the format for subsequent opens on new integer cell files (uncompressed and random only).
int Rast_open_c_new_uncompressed(const char *name)
Opens a new cell file in a database (uncompressed)
int Rast_open_fp_new_uncompressed(const char *name)
Opens new fcell file in a database (uncompressed)
int Rast_open_old(const char *name, const char *mapset)
Open an existing integer raster map (cell)
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.
int Rast_open_fp_new(const char *name)
Opens new fcell file in a database.
int Rast_open_c_new(const char *name)
Opens a new cell file in a database (compressed)
int Rast_open_new_uncompressed(const char *name, RASTER_MAP_TYPE wr_type)
Opens a new raster map (uncompressed)
int Rast_map_is_fp(const char *name, const char *mapset)
Check if raster map is floating-point.
RASTER_MAP_TYPE Rast_map_type(const char *name, const char *mapset)
Determine raster data type.
2D/3D raster map header (used also for region)
int compressed
Compression mode (raster header only)
int format
Max number of bytes per raster data value minus 1 (raster header only)
int zone
Projection zone (UTM)
int cols
Number of columns for 2D data.
struct Quant_table * table
struct fileinfo * fileinfo
struct Cell_head wr_window
struct Cell_head rd_window
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)