[GRASS-stats] writeRAST fails to write empty raster

Anna Petrášová kratochanna at gmail.com
Thu Jun 11 15:04:17 PDT 2015


On Thu, Jun 11, 2015 at 5:38 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:

> On Thu, 11 Jun 2015, Anna Petrášová wrote:
>
>  Hi,
>>
>> I am using R rgrass7 package and it seems that when writing a raster which
>> has only NA, it fails with "only numeric values may be exported":
>>
>>
>> https://github.com/cran/rgrass7/blob/386b11e5a2f3879ec63d299c0594f55cbd39c8e5/R/bin_link.R#L446
>>
>
> This site has nothing whatsoever to do with anything, and is certainly
> unauthorised. Please only refer to R-Forge:
>
>
> https://r-forge.r-project.org/scm/viewvc.php/pkg/rgrass7/R/bin_link.R?view=markup&revision=25&root=spgrass
>
> shows the full context, file name, but not line number.
>
> Are your NAs numeric?
>
>  is.numeric(NA)
>>
> [1] FALSE
>
>> is.numeric(as.numeric(NA))
>>
> [1] TRUE
>

The problem seems to be in line of my code:

I_oaks_rast_sp <- as(I_oaks_rast, 'SpatialGridDataFrame')

where I_oaks_rast is numeric but not the resulting I_oaks_rast_sp which is
then written with writeRAST and fails.


>> Is this intended behavior or a bug?
>>
>
> User misunderstanding. NAs are logical unless created in the context of an
> object with a different storage mode.
>

 Indeed, I'm not an experienced R user...

Thank you


>
>
>> Thank you,
>>
>> Anna
>>
>>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 91 00
> e-mail: Roger.Bivand at nhh.no
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20150611/95f49f18/attachment.html>


More information about the grass-stats mailing list