20 #include <grass/N_pde.h> 50 int x, y, cols, rows, type;
83 if (data->cols != cols)
85 (
"N_read_rast_to_array_2d: the data array size is different from the current region settings");
86 if (data->rows != rows)
88 (
"N_read_rast_to_array_2d: the data array size is different from the current region settings");
93 G_message(
_(
"Reading raster map <%s> into memory"), name);
95 for (y = 0; y <
rows; y++) {
100 for (x = 0, ptr = rast; x <
cols;
202 G_message(
_(
"Write 2d array to raster map <%s>"), name);
205 for (y = 0; y <
rows; y++) {
207 for (x = 0; x <
cols; x++) {
259 double d1 = 0, f1 = 0;
297 if (data->
cols != cols)
299 (
"N_read_rast_to_array_3d: the data array size is different from the current region settings");
300 if (data->
rows != rows)
302 (
"N_read_rast_to_array_3d: the data array size is different from the current region settings");
303 if (data->
depths != depths)
305 (
"N_read_rast_to_array_3d: the data array size is different from the current region settings");
309 G_message(
_(
"Read g3d map <%s> into the memory"), name);
322 for (z = 0; z <
depths; z++) {
324 for (y = 0; y <
rows; y++) {
325 for (x = 0; x <
cols; x++) {
390 double d1 = 0.0, f1 = 0.0;
403 if (data->
cols != cols)
405 (
"N_write_array_3d_to_rast3d: the data array size is different from the current region settings");
406 if (data->
rows != rows)
408 (
"N_write_array_3d_to_rast3d: the data array size is different from the current region settings");
409 if (data->
depths != depths)
411 (
"N_write_array_3d_to_rast3d: the data array size is different from the current region settings");
422 G_message(
_(
"Write 3d array to g3d map <%s>"), name);
436 for (z = 0; z <
depths; z++) {
438 for (y = 0; y <
rows; y++) {
439 for (x = 0; x <
cols; x++) {
#define RASTER3D_USE_CACHE_DEFAULT
int Rast3d_mask_file_exists(void)
Returns 1 if the 3d mask file exists.
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 void void void G_fatal_error(const char *,...) __attribute__((format(printf
void Rast_put_d_row(int, const DCELL *)
Writes the next row for dcell file (DCELL version)
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...
2D/3D raster map header (used also for region)
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.
#define Rast_is_d_null_value(dcellVal)
int Rast3d_put_float(RASTER3D_Map *, int, int, int, float)
Is equivalent to Rast3d_put_value (map, x, y, z, &value, FCELL_TYPE).
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.
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.
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.
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data structure.
#define RASTER3D_DEFAULT_WINDOW
int Rast3d_close(RASTER3D_Map *)
Close 3D raster map files.
#define G_incr_void_ptr(ptr, size)
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 Rast_is_f_null_value(fcellVal)
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.
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.
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_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.
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
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.
void G_message(const char *,...) __attribute__((format(printf
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...
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 * 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...
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.
void Rast_put_f_row(int, const FCELL *)
Writes the next row for fcell file (FCELL version)
void Rast_get_row(int, void *, int, RASTER_MAP_TYPE)
Get raster row.
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.
int Rast3d_put_double(RASTER3D_Map *, int, int, int, double)
Is equivalent to Rast3d_put_value (map, x, y, z, &value, DCELL_TYPE).
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
#define RASTER3D_USE_CACHE_XY
int Rast_open_old(const char *, const char *)
Open an existing integer raster map (cell)
int Rast3d_mask_is_on(RASTER3D_Map *)
Returns 1 if the mask for map is turned on. Returns 0 otherwise.
int depths
number of depths for 3D data
void G_percent(long, long, int)
Print percent complete messages.
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.
int cols
Number of columns for 2D data.
void Rast_put_c_row(int, const CELL *)
Writes the next row for cell file (CELL version)
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.
#define RASTER3D_TILE_SAME_AS_FILE
void * Rast_allocate_buf(RASTER_MAP_TYPE)
Allocate memory for a raster map of given type.
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_2d_to_rast(N_array_2d *array, char *name)
Write a N_array_2d struct to a raster map.
RASTER_MAP_TYPE Rast_get_map_type(int)
Determine raster type from descriptor.
int Rast3d_flush_all_tiles(RASTER3D_Map *)
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.
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_tile_type_map(RASTER3D_Map *)
Returns the type in which tiles of map are stored in memory.
int rows
Number of rows for 2D data.
#define Rast_is_c_null_value(cellVal)
void Rast_close(int)
Close a raster map.
void Rast3d_get_window(RASTER3D_Region *)
Stores the current default window in window.
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_is_off(RASTER3D_Map *)
Returns 1 if the mask for map is turned off. Returns 0 otherwise.