[GRASS-stats] spgrass problem importing category 999 when plugin is FALSE

Markus Neteler neteler at osgeo.org
Fri Apr 3 03:25:42 EDT 2009


On Fri, Apr 3, 2009 at 9:07 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> On Fri, 3 Apr 2009, Jarek Jasiewicz wrote:
>
>> Hi
>>
>> I during batch processing of couple of maps I found strange behaviour of
>> readRAST6 when I import cell map with value 999.
>> Instead of 999 Na is imported (?? _
>>
>> It is for me completely strange, so I test it with folowing:
>
> OK. This is a consequence of trying to guess the NODATA value to pass to
> r.out.gdal,

The C version of r.out.gdal has a nodata parameter.

> and I don't see it in 0.5-19 (my local slightly changed from
> CRAN latest 0.5-18). For certain range values retrieved from r.info, NODATA
> is assigned the value 999 (R/bin_link.R, about line 113). Please try 0.5-18,
> I suspect that the condition was changed. Alternatively, set NODATA to a
> suitable value outside the range of the data. Note that I don't have a 6.5
> GRASS, and if r.info output has changed format, the parsing will be wrong,

It didn't change the format to my knowledge. BUT:
To get the range, use
r.info -r test_map
min=999
max=999

The parsing of plain r.info will fail in non-English locales (or enforce C
locale).

...
> I guess that there is a smarter way of getting the raster min/max too, isn't
> there?

Yes, please always use the script output flags which are not subject to locale
and way easier to parse. If missing in a module, we are happy to add it.
It also exists in GRASS 6.3:
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_3/raster/r.info/main.c#L74

Best
Markus


More information about the grass-stats mailing list