NAME

r.lzw2z - Converts GRASS 5.0 floating point rasters (pre beta11) from LZW compression to Deflate (zlib) compression.

SYNOPSIS

r.lzw2z
r.lzw2z [-af] [rast=value[,value,...]]

DESCRIPTION

This program attempts to read and decode floating point rasters compressed by earlier versions of GRASS 5.0 (prior to beta 11) that used the patented LZW compression algorithm and rewrite these rasters using the unencumbered Deflate compression algorithm (as found in zlib). Integer rasters (CELL) use a different compression mechanism (run-length encoding) and are therefore not affected. Floating point raster files created by versions of GRASS 5.0 earlier than (beta 11) are not readable by later versions (and vice versa). This change was necessary to avoid any entanglements with UNISYS who have been enforcing their patent rights for the LZW algorithm.

Flags:

-a
Process all rasters in the current mapset
-f
Do not warn about this DANGEROUS OPERATION or prompt for user's comfirmation before proceeding.

Parameters:

rast=name[,name,...]
Name of an existing raster in the current mapset to be converted.
Multiple rasters can be specified by separating their names with a comma. If the -a flag is given, this option is ignored.
help
Print usage information to standard output.

This program may be run non-interactively from the command line by either giving the -a flag or specifying one or more names with the rast= argument. Alternatively the program may be run interactively by not specifying any arguments. You will be prompted for whether or not to enable the various flags and arguments using the familiar GRASS parser routines.

This program will fail if you attempt to run it on CELL (or integer) rasters, reclass rasters, any uncompressed raster, or floating point rasters that have been compressed using the deflate algorithm (GRASS 5.0 beta 11 or more recent). Also, only rasters in the current mapset can be processed. It is necessary to stop and restart GRASS for each mapset containing rasters that need to be translated.

NOTE

This program is only meant as a one-time utility to ease the data conversion for people who have used pre-release versions of GRASS 5.0 (prior to the beta 11 release). An alternate and possibly safer method exists by using the r.compress program with the -u (uncompress) option prior to upgrading to GRASS 5.0 beta 11 or later versions.

The program makes every attempt to ensure your data is not accidentally corrupted. Each raster that is processed, is read, decoded, recoded with zlib and written to a temporary file. This file is subsequently read and decoded to help insure the data is useable. However, the data from the original file is not compared to the data in the temporary file during this process. If the test read of the zlib compressed temporary file succeeds, the original file is overwritten with this new version.

As of this writing, there is no equivalent program for GRASS's 3d rasters (grid3 or g3d). However, these rasters did not use LZW compression by default and will only be a problem if you explicitly requested a g3d file use LZW or you recompiled the sources making LZW compression a default (on top of the variable precision and RLE encoding).

GRASS 5.0 does not include r.lzw2z precisely because it contains the very patented algorithm we had to remove. For the same reason, all of the code for this program is released into the public domain rather than the GNU General Public License. If you disagree with software patents, please contact your government representatives (this is especially true for our friends in the European Union).

AUTHOR

Eric G. Miller (2000-01-19)

SOURCE CODE

The source code for this program may be found here. To compile, you will need the GRASS 5.0 source code base already compiled. Then just run gmake5. The program does not install itself into the GRASS distribution tree or target directories. It is really a throw away script after all ;).