Dear Alex, Thanks a lot for your quick and efficient answer. I did
not think about "double double-quoting" the path '""', as "simple"
double-quoting "" usually works in R for paths containing spaces.
Now, it works perfectly well and I was able to process my grids from
within R in the same way as I processed them in SAGA: >
rsaga.geoprocessor("io_grid", 4, list(GRID="199710.sgrd",
FILE_DATA='"C:/Documents and Settings/lescroel/Mes
documents/pub/DATASETS/seaice/polar-stereo/nasateam/final-gsfc/south/monthly/nt_199710_f13_v01_s.bin"',
NX=316, NY=332, DXY=25, XMIN=-3950, YMIN=-3950, DATA_OFFSET=300,
TOPDOWN=1)) > rsaga.geoprocessor("grid_calculus", 1,
list(INPUT="199710.sgrd", RESULT="SIC_DATA_OCT_97.sgrd",
FORMUL="a*0.4")) > rsaga.geoprocessor("grid_tools", 15,
list(INPUT="SIC_DATA_OCT_97.sgrd", RESULT="SIC_OCT97_wo_Land.sgrd",
METHOD=1, MIN=101, MAX=101.6, RNEW=-99999, ROPERATOR=0)) >
rsaga.geoprocessor("grid_calculus", 1,
list(INPUT="SIC_OCT98_wo_Land.sgrd;Crozier_lat.sgrd;Crozier_lon.sgrd",
RESULT="FORAGING_AREA_OCT97.sgrd", FORMUL="a*b*c")) I'm encountering
a new problem though: now, I would like to work with the last
obtained grid "FORAGING_AREA_OCT97.sgrd" in R for performing basic
statistics (like obtaining the mean value of all cells). I was not
able to find a way to transform or read the .sgrd file into a R
object (matrix or data frame) that I could easily manipulate. I tried
the following: > oct97 <- read.sgrd("C:/Documents and
Settings/lescroel/Bureau/FORAGING_AREA_OCT97.sgrd") Erreur dans
read.sgrd("C:/Documents and
Settings/lescroel/Bureau/FORAGING_AREA_OCT97.sgrd") : error
converting the SAGA sgrd file to a temporary ASCII grid file > oct97
<- read.Rd.grid("C:/Documents and
Settings/lescroel/Bureau/FORAGING_AREA_OCT97.sdat") Erreur : mauvais
numéro magique de restauration de fichier (le fichier est peut être
corrompu) -- aucune donnée chargée ## Translation of the error
message "Error: wrong file restoring magic number (the file may be
corrupted) - no data loaded" De plus : Warning message: file
'FORAGING_AREA_OCT97.sdat' has magic number '€OÃÇ€' Use of save
versions prior to 2 is deprecated Could you or someone else help me
again? Many thanks, Amélie PS: I'm posting this message to the
R-sig-geo list this time! Message: 140 Date: Tue, 12 Aug 2008
03:02:03 -0400 From: Alexander Brenning
<[EMAIL PROTECTED]> Subject: Re: [R] Unexpected parameter
problem using rsaga.geoprocessor() {RSAGA} To: Am?lie Lescro?l
<[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Message-ID:
<[EMAIL PROTECTED]> Content-Type: text/plain;
charset=windows-1252; format=flowed Dear Amelie, > Le service Beep
n'est pas lanc?. this can be fixed by passing an additional argument
beep.off = FALSE to the rsaga.geoprocessor function; the most recent
RSAGA release on CRAN does not cause this problem any more, I
recommend you to update the package in your installation. The
beep.off thing was an attempt to stop SAGA from beeping each time a
module has been executed.
Unexpected parameter 'and' If a file path or file name contains
spaces as in "Documents and Settings", you would have to double quote
it, e.g., '"My Folder"' rather than "My Folder" This will make sure
that SAGA knows that the space does not separate different arguments.
After all, RSAGA uses the SAGA command line interface. However, it is
always a good idea to use the setwd() function to change the working
directory. This will keep the path short. I hope this helps. Alex
P.S.: You might wish to consider the R-sig-geo list for questions
regarding spatial/GIS support in R. Am?lie Lescro?l wrote:
Hello, I discovered SAGA, an interesting free GIS, a few days ago
and now,
I > would like to use it from within R 2.6.2 using the RSAGA
package. I read > the documentation for this package and thought
that I understood it > correctly for trying to call some of the
SAGA modules. For getting the > information on the usage of and
arguments required by the SAGA command > line "Import Binary Raw
Data" module, I used:
rsaga.get.usage("io_grid", 4)
SAGA CMD 2.0.3 library path: C:/Progra~1/saga_vc/modules library
name: io_grid module name : Import Binary Raw Data Usage: 4
[-GRID <str>] [-FILE_DATA <str>] [-NX <num>] [-NY <num>]
[-DXY > <str>] [-XMIN <str>] [-YMIN <str>] [-UNIT <str>] [-ZFACTOR
<str>] > [-NODATA <str>] [-DATA_OFFSET <num>] [-LINE_OFFSET <num>]
[-LINE_ENDSET > <num>] [-DATA_TYPE <num>] [-BYTEORDER_BIG <num>]
[-TOPDOWN <num>]
-GRID:<str> Grid Data Object (optional output) -FILE_DATA:<str>
Raw Data File File path -NX:<num> Cell Count (X) Integer -NY:<num>
Cell Count (Y) Integer -DXY:<str> Cell Size Floating
point -XMIN:<str> Left Border (X) Floating point -YMIN:<str>
Lower Border (Y) Floating point -UNIT:<str> Unit Name Text
-ZFACTOR:<str> Z Multiplier Floating point -NODATA:<str> No Data
Value Floating point -DATA_OFFSET:<num> Data Offset (Bytes) Integer
-LINE_OFFSET:<num> Line Offset (Bytes) Integer -LINE_ENDSET:<num>
Line Endset (Bytes) Integer -DATA_TYPE:<num>
Data Type Choice Available Choices: [0] 1 Byte Integer (unsigned)
[1] 1 Byte Integer (signed) [2] 2 Byte Integer (unsigned) [3] 2
Byte Integer (signed) [4] 4 Byte Integer (unsigned) [5] 4 Byte
Integer (signed) [6] 4 Byte Floating Point [7] 8 Byte Floating
Point -BYTEORDER_BIG:<num> Byte Order Choice Available Choices: [0]
Little Endian (Intel) [1] Big Endian (Motorola) -TOPDOWN:<num> Line
Order Choice Available Choices: [0] Bottom to
Top [1] Top to Bottom
Then, I wrote the following command for importing a grid of
binary
raw > data while specifying the parameters I usually enter under
SAGA:
rsaga.geoprocessor("io_grid", 4, list(GRID="199710.sgrd", >
FILE_DATA="C:/Documents and Settings/lescroel/Mes >
documents/pub/DATASETS/seaice/polar-stereo/nasateam/final-gsfc/south/monthly/nt_199710_f13_v01_s.bin",
NX=316, NY=332, DXY=25, XMIN=-3950, DATA_OFFSET=300, TOPDOWN=1))
and I got: Le service Beep n'est pas lanc?. Vous obtiendrez une
aide suppl?mentaire en entrant NET HELPMSG 3521.
C:\Documents and >
Settings\lescroel\Bureau>C:\Progra~1\saga_vc\saga_cmd.exe io_grid 4
> -silent -GRID 199710.sgrd -FILE_DATA C:\Documents and >
Settings\lescroel\Mes >
documents\pub\DATASETS\seaice\polar-stereo\nasateam\final-gsfc\south\monthly\nt_199710_f13_v01_s.bin
-NX 316 -NY 332 -DXY 25 -XMIN -3950 -DATA_OFFSET 300 -TOPDOWN 1
SAGA CMD 2.0.3
library path: C:/Progra~1/saga_vc/modules library name: io_grid
module name : Import Binary Raw Data author : (c) 2003 by
O.Conrad
error: executing module [Import Binary Raw Data]
Usage: -silent [-GRID <str>] [-FILE_DATA <str>] [-NX <num>] [-NY
<num>] > [-DXY <str>] [-XMIN <str>] [-YMIN <str>] [-UNIT <str>]
[-ZFACTOR <str>] > [-NODATA <str>] [-DATA_OFFSET <num>]
[-LINE_OFFSET <num>] [-LINE_ENDSET > <num>] [-DATA_TYPE <num>]
[-BYTEORDER_BIG <num>] [-TOPDOWN <num>]
-GRID:<str> Grid Data Object (optional output) -FILE_DATA:<str>
Raw Data File File path -NX:<num> Cell Count (X) Integer -NY:<num>
Cell Count (Y) Integer -DXY:<str> Cell Size Floating
point -XMIN:<str> Left Border (X) Floating point -YMIN:<str>
Lower Border (Y) Floating point -UNIT:<str> Unit Name Text
-ZFACTOR:<str> Z Multiplier Floating point -NODATA:<str> No Data
Value Floating point -DATA_OFFSET:<num> Data Offset (Bytes) Integer
-LINE_OFFSET:<num> Line Offset (Bytes) Integer -LINE_ENDSET:<num>
Line Endset (Bytes) Integer -DATA_TYPE:<num>
Data Type Choice Available Choices: [0] 1 Byte Integer (unsigned)
[1] 1 Byte Integer (signed) [2] 2 Byte Integer (unsigned) [3] 2
Byte Integer (signed) [4] 4 Byte Integer (unsigned) [5] 4 Byte
Integer (signed) [6] 4 Byte Floating Point [7] 8 Byte Floating
Point -BYTEORDER_BIG:<num> Byte Order Choice Available Choices: [0]
Little Endian (Intel) [1] Big Endian (Motorola) -TOPDOWN:<num> Line
Order Choice Available Choices: [0] Bottom to
Top [1] Top to Bottom Unexpected parameter 'and'
Could someone already using the RSAGA package provide some help
in
telling me what I did wrong? Thanks for your help,
Am?lie
-- Alexander Brenning
Department of Geography and Environmental Management University
of Waterloo 200 University Ave. W - Waterloo, ON - Canada N2L 3G1
http://www.fes.uwaterloo.ca/geography/faculty/brenning/