GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
Raster Library - Close raster file. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
#include "R.h"
Go to the source code of this file.
Macros | |
#define | FORMAT_FILE "f_format" |
#define | QUANT_FILE "f_quant" |
#define | NULL_FILE "null" |
#define | NULLC_FILE "nullcmpr" |
Functions | |
void | Rast_close (int fd) |
Close a raster map. More... | |
void | Rast_unopen (int fd) |
Unopen a raster map. More... | |
void | Rast__unopen_all (void) |
Unopen all raster maps. More... | |
void | Rast__close_null (int fd) |
Raster Library - Close raster file.
(C) 1999-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/close.c.
#define FORMAT_FILE "f_format" |
Definition at line 33 of file raster/close.c.
#define NULL_FILE "null" |
Definition at line 35 of file raster/close.c.
#define NULLC_FILE "nullcmpr" |
Definition at line 37 of file raster/close.c.
#define QUANT_FILE "f_quant" |
Definition at line 34 of file raster/close.c.
void Rast__close_null | ( | int | fd | ) |
Definition at line 527 of file raster/close.c.
References _, fileinfo::cellhd, R__::fileinfo, G__make_mapset_element_misc(), G_file_name_misc(), G_free(), G_mapset(), G_warning(), GPATH_MAX, fileinfo::mapset, fileinfo::name, fileinfo::null_bits, fileinfo::null_fd, NULL_FILE, fileinfo::null_row_ptr, fileinfo::null_temp_name, NULLC_FILE, fileinfo::open_mode, Rast__write_null_row_ptrs(), and Cell_head::rows.
void Rast__unopen_all | ( | void | ) |
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, fileinfo::open_mode, OPEN_NEW_COMPRESSED, and OPEN_NEW_UNCOMPRESSED.
Referenced by Rast__error_handler().
void Rast_close | ( | int | fd | ) |
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(), fileinfo::open_mode, and OPEN_OLD.
Referenced by close_band_files(), IL_create_bitmask(), and Rast_suppress_masking().
void Rast_unopen | ( | int | fd | ) |
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(), fileinfo::open_mode, and OPEN_OLD.
Referenced by Rast__check_for_auto_masking(), and Rast_get_vrt_row().