writeRAST fails to write empty raster

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

writeRAST fails to write empty raster

Anna Petrášová
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":


Is this intended behavior or a bug?

Thank you,

Anna

_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats
Reply | Threaded
Open this post in threaded view
|

Re: writeRAST fails to write empty raster

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


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

>
> 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: [hidden email]
_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats
Roger Bivand
NHH Norwegian School of Economics, Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: writeRAST fails to write empty raster

Anna Petrášová


On Thu, Jun 11, 2015 at 5:38 PM, Roger Bivand <[hidden email]> 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: <a href="tel:%2B47%2055%2095%2093%2055" value="+4755959355" target="_blank">+47 55 95 93 55; fax <a href="tel:%2B47%2055%2095%2091%2000" value="+4755959100" target="_blank">+47 55 95 91 00
e-mail: [hidden email]


_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats