Hi,
while hunting for more GBs on my local disk I found many raster maps
with a still uncompressed NULL files (no surprise since the optional
new NULL compression was introduced in 7.2.0).
As an example - EU DEM25m:
uncompressed NULL file:
6000000000 Apr 13 2016 ./eu_laea/PERMANENT/cell_misc/eu_dem25/null
compressed NULL file:
32108798 Jan 3 15:09 eu_laea/PERMANENT/cell_misc/eu_dem25/nullcmpr
Ratio:
32108798 / 6000000000
[1] 0.005351466
... quite an improvement
Having tons of raster maps here I thought of running r.null over all
raster maps. In general it is:
export GRASS_COMPRESS_NULLS=1
r.null -z myrastermap
Attached a patch which adds a second line of output to "r.compress -p
myrastermap" in order to check the actual compression state of a map:
r.compress -p eu_dem25
<eu_dem25> is compressed (method 2: ZLIB). Data type: FCELL
<eu_dem25> has an uncompressed NULL file
After compression it looks like this:
r.compress -p eu_dem25
<eu_dem25> is compressed (method 2: ZLIB). Data type: FCELL
<eu_dem25> has a compressed NULL file
Now, how to use that:
# all in one (check if NULL is compressed, if no, do it otherwise don't touch):
r.compress -p eu_dem25 2>&1 | grep uncompressed && r.null -z eu_dem25
Questions:
I believe that an additional -g flag for shell style printing would be
useful as well).
Maybe with a -g flag no need to use the stderr redirect?
Any better ideas here? (if yes, feel free to submit to SVN for testing)
################
Since r.null -z doesn't do anything useful if GRASS_COMPRESS_NULLS is
not set I have tried (!) to add a G_message() to tell the user if that
variable is set or not.
r.null -z eu_dem25
The GRASS_COMPRESS_NULLS environment variable is currently set
6%...
But it *always* tells that it is set, so my getenv() parsing is wrong.
Can anyone help please? Also attached...
thanks,
Markus
(attachments)
r_compress_r_null.diff (1.34 KB)