Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-26 Thread Johannes Radinger
I think I discovered the problem. This was a mistake on my side: The summary() function in R applied on a raster does subsample the data in case of very large raster maps. However, this seems to cause that summary information about NA gets lost and no NA are mentioned in the summary output

[GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Johannes Radinger
Hi, 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. Here some details about the raster: Type of Map: raster Number of Categories: 0 Data Type:FCELL Rows: 750

Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Paulo van Breugel
You probably have good reasons for your work flow, but just to make sure: is there a specific reason to export to geotiff first? It seems easier to import the raster layer directly from GRASS into R using the spgrass6 package (readRAST6)? You can subsequently convert the spatial raster to the

Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Thomas Adams
Johannes, 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: Within GRASS, at the GRASS terminal

Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Johannes Radinger
Hi all, of course it is possible to load the raster maps directly via spgrass6. However, we use this work flow also to exchange some of the maps between different users (e.g. via email) and to permanently store single files (geotiffs that contain the proj information within the file). So, I agree

Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Nuno Sá
Hello! Did you try this one? *r.out.gdal etc nodata*=*'NA'* On 4 September 2014 14:27, Johannes Radinger johannesradin...@gmail.com wrote: Hi all, of course it is possible to load the raster maps directly via spgrass6. However, we use this work flow also to exchange some of the maps

Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Johannes Radinger
On Thu, Sep 4, 2014 at 3:38 PM, Nuno Sá nunocesard...@gmail.com wrote: Hello! Did you try this one? *r.out.gdal etc nodata*=*'NA'* As mentioned in the manual of r.out.gdal, the no data parameter takes only float values and no strings like 'NA'. Without stating as specific value in GRASS,

Re: [GRASS-user] raster exchange between GRASS and R with nodata

2014-09-04 Thread Nuno Sá
Ok, didn't check that before since I didn't have the same problem before. Try exporting with a crazy value as NA such as in a 16bit unsigned r.out.gdal etc nodata=65535 Then on R use the mask function such as: mask(x, mask, filename=, inverse=FALSE, maskvalue=65535, updatevalue='NA', ...)