<div dir="ltr"><div><div>Johannes,<br><br></div>If you want to read your file into R, there is no need to export your map from GRASS to do this. Simply install and use the R contributed package 'spgrass6' (spgrass6 has R dependencies that need to be installed first); it works wonderfully:<br>
<br></div><div>Within GRASS, at the GRASS terminal prompt...<br></div><div><br>> library(spgrass6)<br>Loading required package: sp<br>Loading required package: XML<br>GRASS GIS interface loaded with GRASS version: GRASS 7.0.0beta3 (2014)<br>
and location: ohrfc_mpe<br>> dat<-readRAST6("xmrg0101200306z")<br>> image(dat)<br><br></div><div>This is far more efficient.<br></div><div><br></div>Tom<br><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Sep 4, 2014 at 5:32 AM, Johannes Radinger <span dir="ltr"><<a href="mailto:johannesradinger@gmail.com" target="_blank">johannesradinger@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi,<div><br></div><div>I want to export a raster map (FCELL) from GRASS70 to the geotiff format using r.out.gdal and to import it later on in R. The map contains many no data values.<br><br></div><div>Here some details about the raster:<br>

Type of Map:  raster               Number of Categories: 0<br>Data Type:    FCELL<br>Rows:         750  <br>Columns:      750 <br>Total Cells:  562500     <br>total null and non-null cells: 15105636<br>total null cells: 15105047<br>

<br></div><div>So when I export the map, r.out.gdal reports: "Input raster map contains cells with NULL-value (no-data). The value -nan will be used to represent no-data values in the input map. You can specify a nodata value with the nodata option."<br>

<br></div><div>When I subsequently try to import the geotiff into R (using the package 'Raster') the nodata values are not recognised as NA's:<br><br>a <- raster("*.tif")<br></div><div>summary(a)<br>

Min.     0.5294496<br>1st Qu.  0.7171210<br>Median   0.7871540<br>3rd Qu.  1.1581826<br>Max.     1.5494517<br>NA's     0.0000000<br><br></div><div>So I am wondering if I need to set any specific parameter during the export (r.out.gdal) or import (raster()).<br>

<br></div><div>As I am not only exporting FCELL (Float32) raster but also multiple (N=500) other rasters to R I would be interested in a solution also for DCELL (Float64). Of course I can export all of as Float64 as the file size should not be a problem.<br>

<br></div><div>Any suggestions or experiences of handling NA's during raster exchange between GRASS and R?<span class=""><font color="#888888"><br><br></font></span></div><span class=""><font color="#888888"><div>/Johannes<br>
</div></font></span></div>
<br>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></div><br><br clear="all"><br></div></div>