[GRASS-stats] readRAST6() issue with NODATA

Roger Bivand Roger.Bivand at nhh.no
Sat Jul 10 13:47:46 EDT 2010


On Sat, 10 Jul 2010, Markus Neteler wrote:

> Dear Roger,
>
> On Sat, Jun 12, 2010 at 6:51 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>> On Sat, 12 Jun 2010, Markus Neteler wrote:

Thanks, new release submitted to CRAN.

Roger

>>
>>> 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.
>>
>> Dear Markus,
>>
>> The tricks were there for the time when r.out.gdal didn't find its own
>> value, and for the null parameter for r.out.bin. I've moved them down to the
>> r.out.bin branch only, and modified the execGRASS() call to r.out.gdal to
>> omit the nodata= argument by default when NODATA=NULL.
>>
>> Committed to sourceforge CVS, project r-spatial, module spgrass6. Could you
>> check this and let me know if the problem is resolved?
>
> Sorry for the delay, I was away.
>
> I have updated from CVS and run
>
> 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
> /home/neteler/grassdata/patUTM32/zanzara_satellite/.tmp/fep/italy_dem20_PHD_zone
> has GDAL driver GTiff
> and has 601 rows and 1011 columns
>
> No more errors, thanks!
>
> Best wishes,
> Markus
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the grass-stats mailing list