What Integer Data Type Does GRASS Use?
Malcolm Williamson
malcolm at cast.uark.edu
Mon Sep 13 11:49:13 EDT 1993
Dave,
Per the GRASS4.1 Programmer's Manual (a recommended reference!!):
"Each grid cell is stored in the file as one to four 8-bit bytes of data."
"When the data values in the raster file require more than one byte, they are
stored in *big-endian* format, which is to say as a base 256 number with the
most significant digit first."
"Negative values are stored as a signed quantity, i.e., with the highest bit set
to 1:"
To summarize, GRASS supports integer values from -2E+32 to 2E+32. Beware of the
handling of floating point numbers within GRASS programs!
--
Malcolm D. Williamson - Research Assistant E-mail: malcolm at cast.uark.edu
Center for Advanced Spatial Technologies Telephone: (501) 575-6159
Ozark Rm. 12 Fax: (501) 575-3846
University of Arkansas
Fayetteville, AR 72701
>
> I have Landsat TM data, Band 5 and 7. I refer to the r.mpacalc
> tutorial manual that came with the 4.1(beta?) release. Following the
> tutorial I use r.mapcalc to scale the two bands. The tutorial states
> that the raster image is stored as an integer file. What is the data
> format of the resulting new raster image ? Is it signed or unsigned 8
> bit, 16 bit, 32 bit integers?
>
> EG: mapcalc> img1 = ((2.95*tmb.5) + (4.2*tmb.7)) - float(30)
>
> I am concerned because somewhere I thought I read that GRASS stores
> raster images as unsigned 8 bit words (0-255), and it's quite possible
> that the equation above could generate negative numbers which would be
> then probably clipped to 0.
>
> If this is the case is there an alternative data type I can select?
>
> dave
>
> bever at erim.org
>
>
More information about the grass-dev
mailing list