20 #include <grass/N_pde.h>
47 int x, y, cols, rows, type;
81 if (data->cols !=
cols)
82 G_fatal_error(
"N_read_rast_to_array_2d: the data array size is "
83 "different from the current region settings");
84 if (data->rows !=
rows)
85 G_fatal_error(
"N_read_rast_to_array_2d: the data array size is "
86 "different from the current region settings");
93 for (y = 0; y <
rows; y++) {
98 for (
x = 0, ptr = rast;
x <
cols;
203 for (y = 0; y <
rows; y++) {
258 double d1 = 0, f1 = 0;
296 G_fatal_error(
"N_read_rast_to_array_3d: the data array size is "
297 "different from the current region settings");
299 G_fatal_error(
"N_read_rast_to_array_3d: the data array size is "
300 "different from the current region settings");
302 G_fatal_error(
"N_read_rast_to_array_3d: the data array size is "
303 "different from the current region settings");
319 for (z = 0; z <
depths; z++) {
321 for (y = 0; y <
rows; y++) {
386 double d1 = 0.0, f1 = 0.0;
400 G_fatal_error(
"N_write_array_3d_to_rast3d: the data array size is "
401 "different from the current region settings");
403 G_fatal_error(
"N_write_array_3d_to_rast3d: the data array size is "
404 "different from the current region settings");
406 G_fatal_error(
"N_write_array_3d_to_rast3d: the data array size is "
407 "different from the current region settings");
433 for (z = 0; z <
depths; z++) {
435 for (y = 0; y <
rows; y++) {
void G_percent(long, long, int)
Print percent complete messages.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
const char * G_find_raster3d(const char *, const char *)
Search for a 3D raster map in current search path or in a specified mapset.
#define G_incr_void_ptr(ptr, size)
void G_message(const char *,...) __attribute__((format(printf
void Rast3d_get_value(RASTER3D_Map *, int, int, int, void *, int)
Returns in *value the resampled cell-value of the cell with window-coordinate (x, y,...
int Rast3d_flush_all_tiles(RASTER3D_Map *)
int Rast3d_mask_is_off(RASTER3D_Map *)
Returns 1 if the mask for map is turned off. Returns 0 otherwise.
int Rast3d_put_float(RASTER3D_Map *, int, int, int, float)
Is equivalent to Rast3d_put_value (map, x, y, z, &value, FCELL_TYPE).
int Rast3d_tile_type_map(RASTER3D_Map *)
Returns the type in which tiles of map are stored in memory.
void * Rast3d_open_cell_old(const char *, const char *, RASTER3D_Region *, int, int)
Opens existing g3d-file name in mapset. Tiles are stored in memory with type which must be any of FCE...
void Rast3d_mask_off(RASTER3D_Map *)
Turns off the mask for map. This is the default. Do not invoke this function after the first tile has...
int Rast3d_mask_file_exists(void)
Returns 1 if the 3d mask file exists.
void Rast3d_mask_on(RASTER3D_Map *)
Turns on the mask for map. Do not invoke this function after the first tile has been read since the r...
void * Rast3d_open_new_opt_tile_size(const char *, int, RASTER3D_Region *, int, int)
Opens new g3d-file with name in the current mapset. This method tries to compute optimal tile size ba...
int Rast3d_put_double(RASTER3D_Map *, int, int, int, double)
Is equivalent to Rast3d_put_value (map, x, y, z, &value, DCELL_TYPE).
void Rast3d_get_window(RASTER3D_Region *)
Stores the current default window in window.
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
int Rast3d_close(RASTER3D_Map *)
Close 3D raster map files.
int Rast3d_mask_is_on(RASTER3D_Map *)
Returns 1 if the mask for map is turned on. Returns 0 otherwise.
void * Rast_allocate_buf(RASTER_MAP_TYPE)
Allocate memory for a raster map of given type.
#define Rast_is_f_null_value(fcellVal)
void Rast_close(int)
Close a raster map.
int Rast_open_old(const char *, const char *)
Open an existing integer raster map (cell)
void Rast_put_f_row(int, const FCELL *)
Writes the next row for fcell file (FCELL version)
int Rast_open_new(const char *, RASTER_MAP_TYPE)
Opens a new raster map.
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
void Rast_put_d_row(int, const DCELL *)
Writes the next row for dcell file (DCELL version)
void Rast_put_c_row(int, const CELL *)
Writes the next row for cell file (CELL version)
#define Rast_is_d_null_value(dcellVal)
#define Rast_is_c_null_value(cellVal)
RASTER_MAP_TYPE Rast_get_map_type(int)
Determine raster type from descriptor.
void Rast_get_row(int, void *, int, RASTER_MAP_TYPE)
Get raster row.
FCELL N_get_array_2d_f_value(N_array_2d *data, int col, int row)
Returns the value of type FCELL at position col, row.
void N_put_array_3d_value_null(N_array_3d *data, int col, int row, int depth)
This function writes a null value to the N_array_3d data at position col, row, depth.
CELL N_get_array_2d_c_value(N_array_2d *data, int col, int row)
Returns the value of type CELL at position col, row.
void N_put_array_2d_f_value(N_array_2d *data, int col, int row, FCELL value)
Writes a FCELL value to the N_array_2d struct at position col, row.
float N_get_array_3d_f_value(N_array_3d *data, int col, int row, int depth)
This function returns the value of type float at position col, row, depth.
void N_put_array_3d_f_value(N_array_3d *data, int col, int row, int depth, float value)
This function writes a float value to the N_array_3d data at position col, row, depth.
DCELL N_get_array_2d_d_value(N_array_2d *data, int col, int row)
Returns the value of type DCELL at position col, row.
N_array_3d * N_alloc_array_3d(int cols, int rows, int depths, int offset, int type)
Allocate memory for a N_array_3d data structure.
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data structure.
void N_put_array_3d_d_value(N_array_3d *data, int col, int row, int depth, double value)
Writes a double value to the N_array_3d struct at position col, row, depth.
double N_get_array_3d_d_value(N_array_3d *data, int col, int row, int depth)
This function returns the value of type float at position col, row, depth.
void N_put_array_2d_value_null(N_array_2d *data, int col, int row)
Writes the null value to the N_array_2d struct at position col, row.
void N_put_array_2d_c_value(N_array_2d *data, int col, int row, CELL value)
Writes a CELL value to the N_array_2d struct at position col, row.
void N_put_array_2d_d_value(N_array_2d *data, int col, int row, DCELL value)
Writes a DCELL value to the N_array_2d struct at position col, row.
void N_write_array_3d_to_rast3d(N_array_3d *array, char *name, int mask)
Write a N_array_3d struct to a volume map.
N_array_3d * N_read_rast3d_to_array_3d(char *name, N_array_3d *array, int mask)
Read a volume map into a N_array_3d structure.
N_array_2d * N_read_rast_to_array_2d(char *name, N_array_2d *array)
Read a raster map into a N_array_2d structure.
void N_write_array_2d_to_rast(N_array_2d *array, char *name)
Write a N_array_2d struct to a raster map.
#define RASTER3D_DEFAULT_WINDOW
#define RASTER3D_USE_CACHE_DEFAULT
#define RASTER3D_TILE_SAME_AS_FILE
#define RASTER3D_USE_CACHE_XY
2D/3D raster map header (used also for region)
int depths
number of depths for 3D data
int rows
Number of rows for 2D data.
int cols
Number of columns for 2D data.