[GRASS-dev] Documentation glitch

Dear all,

I bumped over a glitch with the documentation for r.out.gdal. One of the examples is:

r.out.gdal in=elevation output=elevation.tif type=Float64 \ createopt=“COMPRESS=DEFLATE”

But compression is applied only if the double quotes are left out:

r.out.gdal in=elevation output=elevation.tif type=Float64 \ createopt=COMPRESS=DEFLATE

···

Regards.

Luís Moreira de Sousa

Email: luis.de.sousa@protonmail.ch

RingID: ring:7ca91d83f4f9dec82fec9f1144b8e5c1ef2a110c

URL: https://ldesousa.github.io

Sent with ProtonMail Secure Email.

Hi Luí­s,

Am Fr., 23. Nov. 2018, 16:32 hat Luí­s Moreira de Sousa <luis.de.sousa@protonmail.ch> geschrieben:

Dear all,

I bumped over a glitch with the documentation for r.out.gdal. One of the examples is:

r.out.gdal in=elevation output=elevation.tif type=Float64 \ createopt=“COMPRESS=DEFLATE”

But compression is applied only if the double quotes are left out:

r.out.gdal in=elevation output=elevation.tif type=Float64 \ createopt=COMPRESS=DEFLATE

Thanks but I cannot confirm this. The GRASS GIS parser takes the right side as a string, I always use it quoted on command line.

Anyone else who can comment here?

Best
Markus

Markus Neteler wrote

Hi Luí­s,

Am Fr., 23. Nov. 2018, 16:32 hat Luí­s Moreira de Sousa <

luis.de.sousa@

geschrieben:

Dear all,

I bumped over a glitch with the documentation for r.out.gdal. One of the
examples is:
r.out.gdal in=elevation output=elevation.tif type=Float64 \
createopt="COMPRESS=DEFLATE"

But compression is applied only if the double quotes are left out:
r.out.gdal in=elevation output=elevation.tif type=Float64 \
createopt=COMPRESS=DEFLATE

Thanks but I cannot confirm this. The GRASS GIS parser takes the right
side
as a string, I always use it quoted on command line.

Anyone else who can comment here?

tested here in winGRASS

#### with quotes

r.out.gdal input=elevation@PERMANENT output=D:\temp\testtt\test.tif
format=GTiff type=Float64 createopt=COMPRESS=DEFLATE
Checking GDAL data type and nodata value...
ERROR 6: SetColorTable() only supported for Byte or UInt16
bands in TIFF format.
Using GDAL data type <Float64>
Input raster map contains cells with NULL-value (no-data). The value -1.#IND
will be used to represent no-data values in the input map. You can specify a
nodata value with the nodata option.
Exporting raster data to GTiff format...
r.out.gdal complete. File <D:\temp\testtt\test.tif> created.

D:\temp\testtt>gdalinfo test.tif
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 527, 475
Coordinate System is:
PROJCS["NAD83(HARN) / North Carolina",
    GEOGCS["NAD83(HARN)",
        DATUM["NAD83_High_Accuracy_Reference_Network",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6152"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4152"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",36.16666666666666],
    PARAMETER["standard_parallel_2",34.33333333333334],
    PARAMETER["latitude_of_origin",33.75],
    PARAMETER["central_meridian",-79],
    PARAMETER["false_easting",609601.22],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    AUTHORITY["EPSG","3358"]]
Origin = (629992.500000000000000,228513.000000000000000)
Pixel Size = (28.500000000000000,-28.500000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_SOFTWARE=GRASS GIS 7.7.svn with GDAL 2.3.2
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 629992.500, 228513.000) ( 78d46'27.71"W, 35d48'35.02"N)
Lower Left ( 629992.500, 214975.500) ( 78d46'28.93"W, 35d41'15.74"N)
Upper Right ( 645012.000, 228513.000) ( 78d36'29.41"W, 35d48'33.50"N)
Lower Right ( 645012.000, 214975.500) ( 78d36'31.54"W, 35d41'14.23"N)
Center ( 637502.250, 221744.250) ( 78d41'29.40"W, 35d44'54.73"N)
Band 1 Block=527x1 Type=Float64, ColorInterp=Gray
  Description = elevation@PERMANENT
  NoData Value=nan
  Metadata:
    COLOR_TABLE_RULES_COUNT=5
    COLOR_TABLE_RULE_RGB_0=5.557879e+001 7.572901e+001 0 191 191 0 255 0
    COLOR_TABLE_RULE_RGB_1=7.572901e+001 9.587922e+001 0 255 0 255 255 0
    COLOR_TABLE_RULE_RGB_2=9.587922e+001 1.160294e+002 255 255 0 255 127 0
    COLOR_TABLE_RULE_RGB_3=1.160294e+002 1.361797e+002 255 127 0 191 127 63
    COLOR_TABLE_RULE_RGB_4=1.361797e+002 1.563299e+002 191 127 63 20 20 20

#### without quotes

C:\>r.out.gdal input=elevation@PERMANENT output=D:\temp\testtt\test3.tif
format=GTiff type=Float64 createopt="COMPRESS=DEFLATE"
Checking GDAL data type and nodata value...
100%
Using GDAL data type <Float64>
Input raster map contains cells with NULL-value (no-data). The value
-1.#IND will be used to represent no-data values in the input map. You can
specify a nodata value with the nodata option.
Exporting raster data to GTiff format...
ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF
format.
100%
r.out.gdal complete. File <D:\temp\testtt\test3.tif> created.

D:\temp\testtt>gdalinfo test3.tif
Driver: GTiff/GeoTIFF
Files: test3.tif
Size is 527, 475
Coordinate System is:
PROJCS["NAD83(HARN) / North Carolina",
    GEOGCS["NAD83(HARN)",
        DATUM["NAD83_High_Accuracy_Reference_Network",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6152"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4152"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",36.16666666666666],
    PARAMETER["standard_parallel_2",34.33333333333334],
    PARAMETER["latitude_of_origin",33.75],
    PARAMETER["central_meridian",-79],
    PARAMETER["false_easting",609601.22],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    AUTHORITY["EPSG","3358"]]
Origin = (629992.500000000000000,228513.000000000000000)
Pixel Size = (28.500000000000000,-28.500000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_SOFTWARE=GRASS GIS 7.7.svn with GDAL 2.3.2
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 629992.500, 228513.000) ( 78d46'27.71"W, 35d48'35.02"N)
Lower Left ( 629992.500, 214975.500) ( 78d46'28.93"W, 35d41'15.74"N)
Upper Right ( 645012.000, 228513.000) ( 78d36'29.41"W, 35d48'33.50"N)
Lower Right ( 645012.000, 214975.500) ( 78d36'31.54"W, 35d41'14.23"N)
Center ( 637502.250, 221744.250) ( 78d41'29.40"W, 35d44'54.73"N)
Band 1 Block=527x1 Type=Float64, ColorInterp=Gray
  Description = elevation@PERMANENT
  NoData Value=nan
  Metadata:
    COLOR_TABLE_RULES_COUNT=5
    COLOR_TABLE_RULE_RGB_0=5.557879e+001 7.572901e+001 0 191 191 0 255 0
    COLOR_TABLE_RULE_RGB_1=7.572901e+001 9.587922e+001 0 255 0 255 255 0
    COLOR_TABLE_RULE_RGB_2=9.587922e+001 1.160294e+002 255 255 0 255 127 0
    COLOR_TABLE_RULE_RGB_3=1.160294e+002 1.361797e+002 255 127 0 191 127 63
    COLOR_TABLE_RULE_RGB_4=1.361797e+002 1.563299e+002 191 127 63 20 20 20

it seems in both ways the tifs are compressed

-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html

On Fri, Nov 23, 2018 at 10:32 AM Luí­s Moreira de Sousa <luis.de.sousa@protonmail.ch> wrote:

I bumped over a glitch with the documentation for r.out.gdal. One of the examples is:

r.out.gdal in=elevation output=elevation.tif type=Float64 \ createopt=“COMPRESS=DEFLATE”

But compression is applied only if the double quotes are left out:

r.out.gdal in=elevation output=elevation.tif type=Float64 \ createopt=COMPRESS=DEFLATE

Just to follow up on this: Coming to Bash from other languages, this is little strange, but the quotes are really just for the command line interpreter. The underlying program does not get them at all which is actually pretty useful because all quoting is solved by the interpreter and the underlying program does not need to care about specifics of each command line. What the underlying programs gets are the parameters/arguments as they were presented on the command line according to the rules of that given command line. In Bash & comp. you can try it with putting echo in front of your command:

echo program “param1” "param2="value2 “param2”=value2 “param2=value2” param2=“value2”

gives

program param1 param2=value2 param2=value2 param2=value2 param2=value2

which what echo actually got.

Also, you have "\ " (backslash space) in your command. That does not have any meaning there. It is from the documentation where a command was too long to fit into one line nicely (~72 chars), so the author split it using line continuation which is a backslash at the end of the line (another Bash thing).

HTH,

Vaclav

PS: If I recall correctly, I learned about the quotes thing here at the grass-dev mailing list! :slight_smile: