change 4-bytes-per-cell to 1-byte-per-cell?

Leslie Apollon la at las.com
Fri Feb 28 17:35:01 EST 1997


At 01:35 PM 2/28/97 -0500, you wrote:
>
>If I have a 4-bytes-per-cell GRASS raster map that now only contains values
>less than 255, is there some GRASS tool that will change it to be only
>1-byte-per-cell to save disk space?
>
>r.resample does not appear to do it, and I don't believe that r.compress or
>r.mapcalc will figure this out either.
>
>I'd appreciate it if someone had advice about this ...
>
>                                         Bill H.
>---------------------------------------------------------------------------
-----
>     ____                             Oak Ridge National Laboratory
>      /  )      /  /      /  /        Computational Physics and Engineering
Div.
>     /--<   o  /  /      /--/         P.O. Box 2008, M.S. 6274
>    /___/__<__/__/_     /  / _        Oak Ridge, TN  37830-6274
>   William W. Hargrove                (423) 241-2748
>   hnw at mtqgrass.esd.ornl.gov          (423) 574-4634 (fax)
>---------------------------------------------------------------------------
-----
>
>

the storage length of the pixel values is line dependant, and reflects the
largest pixel value in a row, so in the same image, you may have some rows
using 1 byte/pixel, some using 2 bytes, etc.

The image format (header information) will reflect the largest format find
in the file. so if you have 1 pixel at 20000 in an ocean of 0, that one line
will be in 4 bytes/pixel, so the image will be marked as a 4 byte file ( but
will actually take less space)
 
Grass will automatically select the smallest format each time it physically
writes a file, so reclass doesn't count...

On top of that, the raster files are compressed in RLE...

for more info, see the Grass programmer's manual, ch 5-6

Hope it helps
------------------------------------
Leslie Apollon
Conseiller SIG - Support Technique

LAS Inc.                       tel. : (514) 858-1104
1570, rue Chabanel Ouest       fax  : (514) 389-9373
Montreal, Quebec, Canada       email: la at las.com
H4N 1H4

Grassland home-page : http://www.las.com/grassland



More information about the grass-user mailing list