[GRASSLIST:5229] Re: Floating point data

Michael Ash mash at econs.umass.edu
Sat Dec 14 11:14:18 EST 2002


I think that it's for color coding.  A typical computer description of a color is three numbers (red blue green) that each range from 0 to 255, e.g.,

  0   0   0  black (all colors turned off)


255   0   0  red   (red turned on, blue and green off)


255 255 255  white (all colors turned on)


I may have the order and colors wrong but this is the gist of the 255 business.  As you note (255 = 2^8 - 1) so I think that the computing origins of this color coding are from representation of colors with one byte of data.

Best regards,
Michael

Quoting Miha STAUT <mihastaut at hotmail.com>:

> Hi,
> 
> I noticed that many of the commands reduce raster data to only 255 category 
> values, at least r.info says so (e.g. r.average). Is it because of the 
> floating point  (like the following mail) representation or is it something 
> else (e.g. like r.stats)?
> Miha Staut
> 
> 
> Ben Logan wrote:
> 
> >I have some DEMs with 30 meter resolution, and the elevation values
> >appear to be in feet instead of meters like the 10 meter res DEMs.  It
> >looked like I could convert the feet to meters with r.mapcalc, so I
> >ran it with
> >
> >elev=elev30/3.28
> >
> >as the expression.  It suceeded, but r.info says that my new map
> >(elev) only has 255 categories.  The original (elev30) had 2441.  It
> >seems to me that I should have the same number of categories...am I
> >missing something?
> 
> In the above case, r.mapcalc will produce a floating-point map.
> 
> Floating-point maps don't really have categories. The values can be
> coerced into categories using the map's quantisation rules, but only a
> few programs (e.g. r.stats) do this. Most programs just use the exact
> floating-point value.
> 
> The quantisation rules can be changed with r.quant.
> 
> Also, you can force r.mapcalc to generate an integer map using the
> "int(...)" operator, i.e.
> 
> 	r.mapcalc 'elev=int(elev30/3.28)'
> 
> I would expect that to have ~745 categories (one for each metre of the
> range, rather than one per foot).
> 
> --
> Glynn Clements <glynn.clements at virgin.net>
> 
> 
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
> http://join.msn.com/?page=features/featuredemail
> 
> 





More information about the grass-user mailing list