<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 4, 2014 at 3:38 PM, Nuno Sá <span dir="ltr"><<a href="mailto:nunocesardesa@gmail.com" target="_blank">nunocesardesa@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello!<div><br></div><div>Did you try this one?</div><div><br></div><div><dt style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:medium">
<b>r.out.gdal etc nodata</b>=<i>'NA'</i></dt></div></div></blockquote><div> </div><div>As mentioned in the manual of r.out.gdal, the no data parameter takes only float values</div><div>and no strings like 'NA'. Without stating as specific value in GRASS, this nodata-value is </div>
<div>automatically set to e.g. 65535 for DCELL rasters if I remember correctly and to 255 </div><div>for BYTE rasters. However, this seems not to be recognized when imported into R with </div><div>the package 'raster'.</div>
<div><br></div><div>/Johannes</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><dd style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:medium">
<br></dd></div><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On 4 September 2014 14:27, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>of course it is possible to load the raster maps directly via spgrass6. However, we use this work</div>
<div>flow also to exchange some of the maps between different users (e.g. via email) and to permanently</div>
<div>store single files (geotiffs that contain the proj information within the file). So, I agree that using spgrass6 would be much more efficient, but I'll stick to exporting to geotiffs and so I need to solve the issues with NA's.</div>
<span><font color="#888888">
<div><br></div><div>/Johannes</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 4, 2014 at 2:31 PM, Thomas Adams <span dir="ltr"><<a href="mailto:tea3rd@gmail.com" target="_blank">tea3rd@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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">
<div><div>
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></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div>
<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. <a href="tel:0.5294496" value="+495294496" target="_blank">0.5294496</a><br>1st Qu. <a href="tel:0.7171210" value="+497171210" target="_blank">0.7171210</a><br>Median <a href="tel:0.7871540" value="+497871540" target="_blank">0.7871540</a><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><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>/Johannes<br>
</div></font></span></div>
<br></div></div><div>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">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></div></blockquote></div><br><br clear="all"><br></div></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">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"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>
<div dir="ltr"><br>Nuno César de Sá<br>
<a href="tel:%2B351%2091%20961%2090%2037" value="+351919619037" target="_blank">+351 91 961 90 37</a><br><br></div>
</font></span></div>
</blockquote></div><br></div></div>