[GRASS-stats] readRAST6() issue with NODATA

Markus Neteler neteler at osgeo.org
Fri Jun 11 18:42:59 EDT 2010


Dear Roger,

hope all is well.

I came across an issue with readRAST6():

> library(spgrass6)
Loading required package: sp
Loading required package: rgdal
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.5.2, released 2008/05/29
Path to GDAL shared files: /home/neteler/binaries/share/gdal
Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
Path to PROJ.4 shared files: (autodetected)
Loading required package: XML
GRASS GIS interface loaded with GRASS version: 6.4.0svn
and location: patUTM32
> mydata_raw <-readRAST6(c("thresh_annual_over_11_celsius_2001_2008_avg", "italy_dem20_PHD_zone"), cat=c(FALSE, FALSE))
/home/neteler/grassdata/patUTM32/zanzara_satellite/.tmp/fep/thresh_annual_over_11_celsius_2001_2008_avg
has GDAL driver GTiff
and has 601 rows and 1011 columns
WARNING: The given nodata value is present in rasterband
         <italy_dem20_PHD_zone> and would lead to data loss. Please specify
         a different nodata value with the nodata parameter.
ERROR: Raster export aborted.

Debugging r.out.gdal, I found that the value 10 was used.


GRASS 6.4.0svn (patUTM32): > r.info -r italy_dem20_PHD_zone
min=0
max=3890
GRASS 6.4.0svn (patUTM32): > r.info -t italy_dem20_PHD_zone
datatype=CELL

I hacked in -99999 as NODATA value in the r.out.gdal calls
(spgrass6/R/bin_link.R).

I have no idea why 10 was used but from GRASS 6.4 onwards the r.out.gdal
module has an intelligent NODATA selection thanks to Markus Metz. I can
imagine what you don't want to clutter the code with conditions, but here it
would be great to let the NODATA selection job to r.out.gdal rather than
using the current r.info tricks.

What do you think?

Best,
Markus

PS: off for 2 weeks now


More information about the grass-stats mailing list