[GRASS-stats] Raster maps from GRASS to R and back to GRASS?

Roger Bivand Roger.Bivand at nhh.no
Wed Apr 22 08:04:43 EDT 2009


On Wed, 22 Apr 2009, Nikos Alexandris wrote:

>
> Nikos:
>>>> But why is "NODATA=" set to 999? It's a bug, right?
>>> Hmmm... one last thing: I see that it works properly only if some
>>> out-of-range value is assigned to "NODATA=" (e.g. NODATA=-9999), right?
>>> Setting NODATA=NULL is nonsense I guess.
>
>
> Roger:
>> No, not nonsense. It is a default like any other. Working out what is in
>> range is not easy - it is based on r.info -r, but has to take edge cases
>> into account. The current "buglet" - the bug is the user not specifying
>> NODATA manually -
>
> :D
>
>> was that in using parseGRASS in very recent releases,
>> one further layer of string to numeric conversion was needed to avoid the
>> value being set to 999 when the min and max values from r.info -r were not
>> "seen" as numeric.
>
>> There have been several similar 999 problems before, all can be avoided by
>> setting the NODATA= argument manually. For these bands, setting it
>> negative will always be OK, and setting manually also saves time, because
>> the heuristic doesn't have to be used. In general, NODATA= will simply
>> handle the NULL values correctly - the problem with any non-null value
>> given is that it may actually occur in the data in the current region.
>
>> Check out the CVS source from sourceforge - project r-spatial, module
>> spgrass6, it will work with your data.
>
> Thanks for your efforts Roger. I think I have to postpone for now
> trying-out the latest source code (or maybe I'll try it out tonight).
>
> I would like to note that I skimmed several times through "Applied
> Spatial Data Analysis with R" [1] but I did not find any concrete
> comment about the "NODATA=" option. Maybe I wasn't careful enough...

Right, there isn't anything in the GRASS book either, where the interface 
is described in more detail. In fact, the use of rgdal is quite recent, so 
most of this implementation post-dates both sources.

Roger

>
> Kindest regards, Nikos
> ---
> [1] Applied Spatial Data Analysis with R, Series: Use R
> Bivand, Roger S., Pebesma, Edzer J., Gómez-Rubio, Virgilio
>
> 2008, XIV, 378 p., Softcover
> ISBN: 978-0-387-78170-9
>
>
>

-- 
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