[GRASS-dev] [grass-code I][405] r.out.gdal sets NoData wrong

grass-codei at wald.intevation.org grass-codei at wald.intevation.org
Tue May 22 18:27:06 EDT 2007


code I item #405, was opened at 2007-05-23 00:27
Status: Open
Priority: 4
Submitted By: Maciej Sieczka (msieczka)
Assigned to: Nobody (None)
Summary: r.out.gdal sets NoData wrong 
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: raster
Operating system: all
Operating system version: 
GRASS CVS checkout date, if applies (YYMMDD): 070523


Initial Comment:
r.out.gdal sets NoData wrong. Example, in spearfish60:

$ r.mapcalc 'check=rand(0,256)'

$ r.info -rt check
min=0
max=255
datatype=CELL

$ r.out.gdal check out=check.tif type=Byte
$ r.in.gdal in=check.tif out=check_re
$ r.info -rt check_re
min=0
max=254
datatype=CELL

As you can see rasters "check" and "check_re" have different max values (255 vs 254) while those should be identical. The problem source is that r.out.gdal set 255 to null in "check.tif" by force:

$ gdalinfo -mm check.tif | grep 'NoData\|Min'
    Computed Min/Max=0.000,254.000
  NoData Value=255

As there is no null in original "check" raster, the above should rather read:

    Computed Min/Max=0.000,255.000

and no "NoData".



Note that r.out.gdal.sh is buggy too (or actually the gdal_translate, which it calls), though in a different way:

$ r.out.gdal.sh check out=check.tif type=Byte
$ gdalinfo -mm check.tif | grep 'NoData\|Min'
    Computed Min/Max=0.000,255.000
  NoData Value=256

There should be no NoData, as there is no null in the input GRASS raster. Value 256 is not present in input "check" at all. Moreover, 256 is beyond GDAL's "Byte" value range.


----------------------------------------------------------------------

You can respond by visiting: 
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=405&group_id=21




More information about the grass-dev mailing list