[GRASS-dev] Re: [GRASS GIS] #788: r.out.gdal and nodata

GRASS GIS trac at osgeo.org
Mon Dec 21 09:44:49 EST 2009


#788: r.out.gdal and nodata
----------------------+-----------------------------------------------------
  Reporter:  frankie  |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect   |      Status:  new                      
  Priority:  normal   |   Milestone:  6.4.0                    
 Component:  Raster   |     Version:  6.4.0 RCs                
Resolution:           |    Keywords:  r.in.gdal, nodata        
  Platform:  Linux    |         Cpu:  Unspecified              
----------------------+-----------------------------------------------------
Comment (by hamish):

 This is in part a duplicate of bug #73, or at least a continuation of it.
 Please read through that for background. As that bug is long and things
 have evolved from then I don't mind starting afresh.

 Frankie:
 > The new version of r.out.gdal shows a regression in exporting
 > to float type. In 6.2 its default for nodata value was NaN, now
 > it is an explicit _valid_ floating point (min float?). This is
 > not acceptable for instance in ENVI output format, where the
 > correct value is NaN, to avoid trashing lookups and statistics
 > in external programs.

 Using 6.5svn with elevation.10m DCELL map from the Spearfish dataset the
 default nodata value is nan (type defaults to Float64), and also I can set
 nodata=nan on the command line and it works. fwiw nodata=inf does not
 work.

 in 6.4 it defaults to -1e+37 but setting nodata=nan explicitly on the
 command line works as expected. (I'm using gdalinfo on the output geotiff
 to confirm).


 so this one is already "fixed", but waiting-for-backport from the 6.5
 branch.

 as we should try to not change default behaviour during a stable branch
 maybe we should aim to get this change into the 6.4 branch before 6.4.0
 ... ?

 one thing before that happens:

 ----
 I notice another problem. (latest 6.5svn)
 If I export a palleted raster (with cats 0-7 + NULL) as type=Byte

 {{{
 G65> r.out.gdal in=map out=map_LL_WGS84.tif type=Byte
 creat="COMPRESS=DEFLATE,INTERLEAVE=BAND"

 Exporting to GDAL data type: Byte
  100%
 Input raster map contains cells with NULL-value (no-data). The value 0 was
 used to represent no-data values in the input map. You can specify a
 nodata
 value with the nodata option.
 WARNING: The default nodata value is present in rasterband <map> and would
          lead to data loss. Please specify a different nodata value with
          the nodata parameter.
 ERROR: Raster export aborted.
 }}}

 that's all fine, but it has left an incomplete map in the filesystem. The
 data is there (or at least some of it) but the georef & metadata is not.
 Just before that "ERROR: Raster export aborted." it should unlink() the
 output file. It doesn't know until after it starts to write if the default
 nodata value will also be present in the map, so aborting and deleting the
 file has to come after the fact. I assume any createopt="TFW=YES" files
 etc get written after, so we don't have to worry about deleting them too.
 (??)


 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/788#comment:2>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list