[GRASS5] 0 != no data

Eric G. Miller egm2 at jps.net
Wed Jun 27 23:00:47 EDT 2001


On Tue, Jun 26, 2001 at 06:17:16PM +0700, Justin Hickey wrote:
> Hi Michel
> 
> Michel Wurtz wrote:
> > 
> > Justin Hickey wrote:
> > >
> > > Interesting, but I think you may be thinking of instances where 
> > > Grass interprets CELL files as unsigned 1 byte values (ie all
> > > values are in the range of 0 to 255). However, Grass cannot change
> > > the size of type CELL, so CELL files can only be 1 byte data if all
> > > CELL values are 1 byte. In the file src/include/gis.h we have the
> > > following line:
> > >
> > > typedef int CELL;
> > >
> > 
> > Hmmm... Does this mean that the "format" field in the header file
> > is not used ? (Cf progmangrass50, section 5.3.1).
> 
> Quite possibly. I'm not sure if this section has been updated for
> floating point code (there are several sections that need to be
> updated), but I see no way of Grass being able to change the type of
> CELL data. CELL is defined as an int, thus all CELL data will be of type
> int.

No. We must distinguish between the file format and the memory
representation.  Most programs I've worked on never do anything
to check how many bytes should be used for a CELL when writing a new
file.  It can be specified, however, via the G_set_cell_format()
function. CELL's are always represented as an int in memory (unless
they're being read as an FCELL or DCELL, the contrary is also true).

The G_[set/get]_cell_format() functions apparently are not documented.

So, regards NULL's in CELL files with a decreased byte count, do you say
-128 is NULL for single byte, etc... ?  All integers must be treated as
signed, I think.  If you had an unsigned byte CELL, would 0 == NULL?
Sounds like what the whole NULL file concept was trying to avoid.

-- 
Eric G. Miller <egm2 at jps.net>



More information about the grass-dev mailing list