[GRASS-user] open rasters at r.example
glynn at gclements.plus.com
Mon Jan 11 18:08:35 EST 2010
Luis Lisboa wrote:
> I want to develop a few functions that I probably will need in a few months.
> So I decided to learn with r.example.
> One of my first doubts is regarding functions name. For instance if I want
> to open a old file I use:
> But if I want to open a new file I use
> My question is why I use in one case "cell" and in the other case "raster"
> since they both refer to the same type of data (RASTER)? Because it exists
> a G_open_cell_new() and it's not being used.
When you open an existing map, GRASS knows what type the map is
(integer or FP). When you open a new map, you have to specify whether
you want integer or FP.
Originally, GRASS only supported integer (CELL) rasters, with zero
often used as a "null" value. When FP and null support was added,
G_open_cell_old() was extended to handle FP rasters and integer
rasters with a null bitmap, as well as the old integer format (with
zero as null). For creating new maps, G_open_raster_new() was added,
which allows you to choose integer or FP, while the old
G_open_cell_new() was retained.
The same issue applies to e.g. G_get_map_row() (integer only, zero is
null) versus G_get_raster_row() etc (integer or FP, with distinct null
> Another question is regarding the functions: open(path, 0), refered by lots
> of functions from gis/open.c (e.g. G__open). I cannot find this function and
> fdopen(return fdopen(fd, "w").
> Where can I find these functions?
open() and fdopen() are POSIX functions, provided by the OS's standard
C library (libc on Unix, MSVCRT on Windows).
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user