Re: [GRASS-user] help with batch exporting r.out.gdal

2014-09-04 Thread Rajat Nayak
Thank you Tom for the mail.
I'm still unable to get it working. Some smaller cliche I guess,
will try again.
Regards

Rajat Nayak


On Tue, Sep 2, 2014 at 6:50 PM, Thomas Adams tea...@gmail.com wrote:

 Rajat,

 I assume you are running this at the GRASS prompt? If not, you must do
 this. Also, if you don't provide the full path for 'NPPFILES', you should
 run the command from the directory where 'NPPFILES' is located.
 Additionally, you may want to change your code to this:

 for files in $(cat NPPFILES); do
 echo $files;

 r.out.gdal input=$NPPFILES output=$NPPFILES.tiff format=GTiff ; done

 You may want to include the line echo $files; to see if the individual
 map names are being read correctly

 Regards,
 Tom


 On Tue, Sep 2, 2014 at 8:57 AM, Rajat Nayak rajat27...@gmail.com wrote:

 Dear All,

 I just created a list of files (NPPFILES) using g,mlist command in
 grass7.
 Now I would like to export these files as .tiff files.
 I tried this command
 for files in $NPPFILES; do
 r.out.gdal input=$NPPFILES output=$NPPFILES.tiff format=GTiff ; done

 This is not working for me. I tried giving directory path, still no
 result.

 I will be grateful if anybody can help me with this.

 Thanking you,

 Regards

 Rajat Nayak

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user





___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] help with batch exporting r.out.gdal

2014-09-04 Thread Nikos Alexandris

Rajat Nayak rajat27...@gmail.com wrote:

  I just created a list of files (NPPFILES) using g,mlist command in
  grass7. Now I would like to export these files as .tiff files.
  I tried this command

  for files in $NPPFILES; do
  r.out.gdal input=$NPPFILES output=$NPPFILES.tiff format=GTiff ; done


Here, you ask the string files to get each of the whatsoever values
are stored inside the variable $NPPFILES.

1. is there an NPPFILES variable defined already?  Something like

NPPFILES=
file_1
file_2
flie_3

2. What you actually need to feed the input= parameter, is the files
term, not the $NPPFILES.


  This is not working for me. I tried giving directory path, still no
  result.


ok, assuming you are running this from inside a GRASSy session, you
should be, at the time of executing the for loop, inside the directory
where the list of files is also present.  I guess you created a file,
say nppfiles_list.

To be sure, just instruct

cat nppfiles_list

and expect to get the list of files you created.

If that's ok, then it should work, e.g.:

for File in `cat nppfiles_list`; do r.out.gdal input=${File}
output=${File}.tiff; done

Note, instead of File it could be any other string you like.

Hope this helps a bit.

Nikos
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] help with batch exporting r.out.gdal

2014-09-04 Thread Rajat Nayak
Thank you Nikos and Tom.
The command worked.
This is what I used,
 for files in `cat NPPFILES`; do r.out.gdal in=${files} out=${files}
format=GTiff; done

Regards

Rajat Nayak


On Thu, Sep 4, 2014 at 12:39 PM, Nikos Alexandris n...@nikosalexandris.net
wrote:


 Rajat Nayak rajat27...@gmail.com wrote:

   I just created a list of files (NPPFILES) using g,mlist command in
   grass7. Now I would like to export these files as .tiff files.
   I tried this command

   for files in $NPPFILES; do
   r.out.gdal input=$NPPFILES output=$NPPFILES.tiff format=GTiff ;
 done


 Here, you ask the string files to get each of the whatsoever values
 are stored inside the variable $NPPFILES.

 1. is there an NPPFILES variable defined already?  Something like

 NPPFILES=
 file_1
 file_2
 flie_3

 2. What you actually need to feed the input= parameter, is the files
 term, not the $NPPFILES.


   This is not working for me. I tried giving directory path, still no
   result.


 ok, assuming you are running this from inside a GRASSy session, you
 should be, at the time of executing the for loop, inside the directory
 where the list of files is also present.  I guess you created a file,
 say nppfiles_list.

 To be sure, just instruct

 cat nppfiles_list

 and expect to get the list of files you created.

 If that's ok, then it should work, e.g.:

 for File in `cat nppfiles_list`; do r.out.gdal input=${File}
 output=${File}.tiff; done

 Note, instead of File it could be any other string you like.

 Hope this helps a bit.

 Nikos

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

[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
Columns:  750
Total Cells:  562500
total null and non-null cells: 15105636
total null cells: 15105047

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.

When I subsequently try to import the geotiff into R (using the package
'Raster') the nodata values are not recognised as NA's:

a - raster(*.tif)
summary(a)
Min. 0.5294496
1st Qu.  0.7171210
Median   0.7871540
3rd Qu.  1.1581826
Max. 1.5494517
NA's 0.000

So I am wondering if I need to set any specific parameter during the export
(r.out.gdal) or import (raster()).

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.

Any suggestions or experiences of handling NA's during raster exchange
between GRASS and R?

/Johannes
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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




On Thu, Sep 4, 2014 at 11:32 AM, Johannes Radinger 
johannesradin...@gmail.com wrote:

 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
 Columns:  750
 Total Cells:  562500
 total null and non-null cells: 15105636
 total null cells: 15105047

 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.

 When I subsequently try to import the geotiff into R (using the package
 'Raster') the nodata values are not recognised as NA's:

 a - raster(*.tif)
 summary(a)
 Min. 0.5294496
 1st Qu.  0.7171210
 Median   0.7871540
 3rd Qu.  1.1581826
 Max. 1.5494517
 NA's 0.000

 So I am wondering if I need to set any specific parameter during the
 export (r.out.gdal) or import (raster()).

 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.

 Any suggestions or experiences of handling NA's during raster exchange
 between GRASS and R?

 /Johannes

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] help with r.series

2014-09-04 Thread Rajat Nayak
Dear All,

I have created a few list using g.mlist command in grass7. Each list has a
few raster layers. For example; FILE2000 has lists of all monthly layers
for the year 2000, FILE2001 has layers for 2001...so on.
Now I want to create one layer each  for each of these lists (each year). I
can use r.series command with method=average, to get a layer with
averaged values across all the months for a particular year. Now I have 14
such lists corresponding to 14 years and do not want to repeat the process
for each year. Is there a way to automate this process using grass prompt?
I don't want to move to R, would like to complete all the work in GRASS.

Thank you
Regards
Rajat Nayak
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

 library(spgrass6)
Loading required package: sp
Loading required package: XML
GRASS GIS interface loaded with GRASS version: GRASS 7.0.0beta3 (2014)
and location: ohrfc_mpe
 dat-readRAST6(xmrg0101200306z)
 image(dat)

This is far more efficient.

Tom


On Thu, Sep 4, 2014 at 5:32 AM, Johannes Radinger 
johannesradin...@gmail.com wrote:

 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
 Columns:  750
 Total Cells:  562500
 total null and non-null cells: 15105636
 total null cells: 15105047

 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.

 When I subsequently try to import the geotiff into R (using the package
 'Raster') the nodata values are not recognised as NA's:

 a - raster(*.tif)
 summary(a)
 Min. 0.5294496
 1st Qu.  0.7171210
 Median   0.7871540
 3rd Qu.  1.1581826
 Max. 1.5494517
 NA's 0.000

 So I am wondering if I need to set any specific parameter during the
 export (r.out.gdal) or import (raster()).

 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.

 Any suggestions or experiences of handling NA's during raster exchange
 between GRASS and R?

 /Johannes

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] help with r.series

2014-09-04 Thread Pietro
Hi Rajat,

On Thu, Sep 4, 2014 at 1:51 PM, Rajat Nayak rajat27...@gmail.com wrote:
 I have created a few list using g.mlist command in grass7. Each list has a
 few raster layers. For example; FILE2000 has lists of all monthly layers for
 the year 2000, FILE2001 has layers for 2001...so on.
 Now I want to create one layer each  for each of these lists (each year). I
 can use r.series command with method=average, to get a layer with
 averaged values across all the months for a particular year. Now I have 14
 such lists corresponding to 14 years and do not want to repeat the process
 for each year. Is there a way to automate this process using grass prompt? I
 don't want to move to R, would like to complete all the work in GRASS.

Yes you can do it, using BASH or python, personally I prefer/use python.
A possible solution for grass6/7 could be something like:

{{{

from grass import script

# define the pattern to select the maps that will be aggregate
PATTERNS = ('rast2001*', 'rast2002*', 'rast2003*') # etc.

# define the name of the output names
OUTPUTS = ('out2001', 'out2002', 'out2003')

# start a cycle for each pattern and for each output
for pattern, output in zip(PATTERNS, OUTPUTS):
# get the list of input maps
inputs = script.mlist_strings('rast', pattern=pattern)
# run your command
script.run_command('r.series', input=inputs, output=output,
method='average')

}}}
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

/Johannes


On Thu, Sep 4, 2014 at 2:31 PM, Thomas Adams tea...@gmail.com wrote:

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

  library(spgrass6)
 Loading required package: sp
 Loading required package: XML
 GRASS GIS interface loaded with GRASS version: GRASS 7.0.0beta3 (2014)
 and location: ohrfc_mpe
  dat-readRAST6(xmrg0101200306z)
  image(dat)

 This is far more efficient.

 Tom


 On Thu, Sep 4, 2014 at 5:32 AM, Johannes Radinger 
 johannesradin...@gmail.com wrote:

 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
 Columns:  750
 Total Cells:  562500
 total null and non-null cells: 15105636
 total null cells: 15105047

 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.

 When I subsequently try to import the geotiff into R (using the package
 'Raster') the nodata values are not recognised as NA's:

 a - raster(*.tif)
 summary(a)
 Min. 0.5294496
 1st Qu.  0.7171210
 Median   0.7871540
 3rd Qu.  1.1581826
 Max. 1.5494517
 NA's 0.000

 So I am wondering if I need to set any specific parameter during the
 export (r.out.gdal) or import (raster()).

 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.

 Any suggestions or experiences of handling NA's during raster exchange
 between GRASS and R?

 /Johannes

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user





___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

 /Johannes


 On Thu, Sep 4, 2014 at 2:31 PM, Thomas Adams tea...@gmail.com wrote:

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

  library(spgrass6)
 Loading required package: sp
 Loading required package: XML
 GRASS GIS interface loaded with GRASS version: GRASS 7.0.0beta3 (2014)
 and location: ohrfc_mpe
  dat-readRAST6(xmrg0101200306z)
  image(dat)

 This is far more efficient.

 Tom


  On Thu, Sep 4, 2014 at 5:32 AM, Johannes Radinger 
 johannesradin...@gmail.com wrote:

  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
 Columns:  750
 Total Cells:  562500
 total null and non-null cells: 15105636
 total null cells: 15105047

 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.

 When I subsequently try to import the geotiff into R (using the package
 'Raster') the nodata values are not recognised as NA's:

 a - raster(*.tif)
 summary(a)
 Min. 0.5294496
 1st Qu.  0.7171210
 Median   0.7871540
 3rd Qu.  1.1581826
 Max. 1.5494517
 NA's 0.000

 So I am wondering if I need to set any specific parameter during the
 export (r.out.gdal) or import (raster()).

 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.

 Any suggestions or experiences of handling NA's during raster exchange
 between GRASS and R?

 /Johannes

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user






 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user




-- 

Nuno César de Sá
+351 91 961 90 37
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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, this
nodata-value is
automatically set to e.g. 65535 for DCELL rasters if I remember correctly
and to 255
for BYTE rasters. However, this seems not to be recognized when imported
into R with
the package 'raster'.

/Johannes





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

 /Johannes


 On Thu, Sep 4, 2014 at 2:31 PM, Thomas Adams tea...@gmail.com wrote:

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

  library(spgrass6)
 Loading required package: sp
 Loading required package: XML
 GRASS GIS interface loaded with GRASS version: GRASS 7.0.0beta3 (2014)
 and location: ohrfc_mpe
  dat-readRAST6(xmrg0101200306z)
  image(dat)

 This is far more efficient.

 Tom


  On Thu, Sep 4, 2014 at 5:32 AM, Johannes Radinger 
 johannesradin...@gmail.com wrote:

  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
 Columns:  750
 Total Cells:  562500
 total null and non-null cells: 15105636
 total null cells: 15105047

 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.

 When I subsequently try to import the geotiff into R (using the package
 'Raster') the nodata values are not recognised as NA's:

 a - raster(*.tif)
 summary(a)
 Min. 0.5294496
 1st Qu.  0.7171210
 Median   0.7871540
 3rd Qu.  1.1581826
 Max. 1.5494517
 NA's 0.000

 So I am wondering if I need to set any specific parameter during the
 export (r.out.gdal) or import (raster()).

 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.

 Any suggestions or experiences of handling NA's during raster exchange
 between GRASS and R?

 /Johannes

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user






 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user




 --

 Nuno César de Sá
 +351 91 961 90 37


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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', ...)

might work but its very, you know, hurtful to see :P but I'm like you, I
prefer .tif.





On 4 September 2014 14:47, Johannes Radinger johannesradin...@gmail.com
wrote:




 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, this
 nodata-value is
 automatically set to e.g. 65535 for DCELL rasters if I remember correctly
 and to 255
 for BYTE rasters. However, this seems not to be recognized when imported
 into R with
 the package 'raster'.

 /Johannes





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

 /Johannes


 On Thu, Sep 4, 2014 at 2:31 PM, Thomas Adams tea...@gmail.com wrote:

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

  library(spgrass6)
 Loading required package: sp
 Loading required package: XML
 GRASS GIS interface loaded with GRASS version: GRASS 7.0.0beta3 (2014)
 and location: ohrfc_mpe
  dat-readRAST6(xmrg0101200306z)
  image(dat)

 This is far more efficient.

 Tom


  On Thu, Sep 4, 2014 at 5:32 AM, Johannes Radinger 
 johannesradin...@gmail.com wrote:

  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
 Columns:  750
 Total Cells:  562500
 total null and non-null cells: 15105636
 total null cells: 15105047

 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.

 When I subsequently try to import the geotiff into R (using the
 package 'Raster') the nodata values are not recognised as NA's:

 a - raster(*.tif)
 summary(a)
 Min. 0.5294496
 1st Qu.  0.7171210
 Median   0.7871540
 3rd Qu.  1.1581826
 Max. 1.5494517
 NA's 0.000

 So I am wondering if I need to set any specific parameter during the
 export (r.out.gdal) or import (raster()).

 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.

 Any suggestions or experiences of handling NA's during raster exchange
 between GRASS and R?

 /Johannes

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user






 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user




 --

 Nuno César de Sá
 +351 91 961 90 37





-- 

Nuno César de Sá
+351 91 961 90 37
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] r.clump2 for GRASS7

2014-09-04 Thread Markus Neteler
On Wed, Sep 3, 2014 at 11:17 AM, Johannes Radinger
johannesradin...@gmail.com wrote:
 Hi,

 I am just wondering if the add-on r.clump2 is still available for GRASS 7.
 I can find the add-on manual mentioned here:
 http://grass.osgeo.org/grass70/manuals/addons/r.clump2.html

ok, I have removed that page now because...

 However I could not find r.clump2 via g.extension.

... the functionality of r.clump2 and been merged into the standard
r.clump in GRASS 7.

 I seems that the list
 http://grass.osgeo.org/grass70/manuals/  is out of date (e.g. r.fidimo
 add-on is missing).

Good point. I'll speak to Martin Landa that we need to clean the
directory and update it via cronjob.

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] GRASS GIS code sprint @FOSS4G 2014 - Portland: Sept 13th, 2014

2014-09-04 Thread Markus Neteler
Join us at the upcoming GRASS GIS code sprint @FOSS4G 2014, Portland

http://grasswiki.osgeo.org/wiki/GRASS_Community_Sprint_Portland_2014

This Portland FOSS4G Code Sprint 2014 is a great occasion for folks to
support the development by actively contributing to the source code,
manuals or likewise. This code sprint is targeting members of OSGeo
software projects.
We will aim at getting close to the GRASS GIS 7.0.0 release,
especially discussing how to resolve the remaining blocking issues.

Please don't hesitate to add your suggestions here:
http://grasswiki.osgeo.org/wiki/GRASS_Community_Sprint_Portland_2014#Ideas
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] rasterize vector layer (string column)

2014-09-04 Thread christophe joey
hello


i would like to rasterize a vector layer i guess within: *v.to.rast*
but the type of the column to use in the rasterization is string not numeric
*.*
is it possible to do it in  grass 6.4 ?


*thank you*
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] rasterize vector layer (string column)

2014-09-04 Thread Markus Neteler
On Thu, Sep 4, 2014 at 4:56 PM, christophe joey
christophe0j...@gmail.com wrote:
 hello

 i would like to rasterize a vector layer i guess within: v.to.rast
 but the type of the column to use in the rasterization is string not
 numeric.

 is it possible to do it in  grass 6.4 ?

Yes.
- use v.db.addcol to add a new numeric column
- then cast the string numbers to numeric with v.db.update:
  http://grass.osgeo.org/grass64/manuals/v.db.update.html
  -- see last example (that's for the SQLite or other true SQL
drivers only, not the DBF backend)

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] help with r.series

2014-09-04 Thread Glynn Clements

Rajat Nayak wrote:

 I have created a few list using g.mlist command in grass7. Each list has a
 few raster layers. For example; FILE2000 has lists of all monthly layers
 for the year 2000, FILE2001 has layers for 2001...so on.
 Now I want to create one layer each  for each of these lists (each year). I
 can use r.series command with method=average, to get a layer with
 averaged values across all the months for a particular year. Now I have 14
 such lists corresponding to 14 years and do not want to repeat the process
 for each year. Is there a way to automate this process using grass prompt?
 I don't want to move to R, would like to complete all the work in GRASS.

bash:
for file in FILE20?? ; do
r.series file=$file output=output${file#file} method=average
done

Python:
import os
import grass.script as grass
for file in os.listdir('.'):
if not file.startswith('FILE20'):
continue
output = 'output' + file[4:]
grass.run_command('r.series', file=file, output=output,
  method='average')

-- 
Glynn Clements gl...@gclements.plus.com
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user