execGRASS(spgrass6)
execGRASS()所属R语言包:spgrass6
Run GRASS commands
运行GRASS命令
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The functions provide an interface to GRASS commands run through system, based on the values returned by the --interface description flag using XML parsing. If required parameters are omitted, and have declared defaults, the defaults will be used.
该功能提供了一个接口GRASS system,--interface description标志使用的XML解析返回的值的基础上,通过运行命令。如果需要的参数被省略,并宣布默认值,默认值将被使用。
用法----------Usage----------
execGRASS(cmd, flags = NULL, ..., parameters = NULL, intern = FALSE,
ignore.stderr = NULL, Sys_ignore.stdout=FALSE, Sys_wait=TRUE,
Sys_input=NULL, Sys_show.output.on.console=TRUE, Sys_minimized=FALSE,
Sys_invisible=TRUE, echoCmd=NULL)
doGRASS(cmd, flags = NULL, ..., parameters = NULL, echoCmd=NULL)
parseGRASS(cmd)
## S3 method for class 'GRASS_interface_desc'
print(x, ...)
getXMLencoding()
setXMLencoding(enc)
参数----------Arguments----------
参数:cmd
GRASS command name
GRASS命令名称
参数:flags
character vector of GRASS command flags
GRASS命令行标志的字符向量
参数:...
for execGRASS and doGRASS, GRASS module parameters given as R named arguments directly. For the print method, other arguments to print method
为execGRASS和doGRASS,GRASS模块参数为R命名的参数直接。对于print方法,其他参数打印方法
参数:parameters
list of GRASS command parameters, used if GRASS parameters are not given as R arguments directly; the two methods for passing GRASS parameters may not be mixed
通过GRASS参数列表GRASS命令的参数,使用,如果GRASS参数不直接为R的参数,这两个方法可能无法混合
参数:intern
a logical (not 'NA') which indicates whether to make the output of the command an R object. Not available unless 'popen' is supported on the platform
逻辑(未“NA”),其指示是否以使输出的命令的R对象。不提供支持的平台上除非“POPEN”
参数:ignore.stderr
default NULL, taking the value set by set.ignore.stderrOption, a logical indicating whether error messages written to 'stderr' should be ignored
默认NULL,采取set.ignore.stderrOption中设置的值,指示是否错误消息写入STDERR“逻辑应该被忽视
参数:Sys_ignore.stdout, Sys_wait, Sys_input
pass extra arguments to system
通过额外的参数system
参数:Sys_show.output.on.console, Sys_minimized, Sys_invisible
pass extra arguments to system on Windows systems only
传递额外的参数给system在Windows系统上的只
参数:echoCmd
default NULL, taking the logical value set by set.echoCmdOption, print GRASS command to be executed to console
默认NULL,逻辑值设置set.echoCmdOption,打印GRASS命令执行安慰
参数:x
object to be printed
反对要打印
参数:enc
character string to replace UTF-8 in header of XML data generated by GRASS module –interface-description output when the internationalised messages are not in UTF-8 (known to apply to French, which is in latin1)
字符串,以取代UTF-8头GRASS模块接口描述输出生成的XML数据时,国际化的信息是不以UTF-8(适用于法国,它是在latin1的)
Details
详细信息----------Details----------
parseGRASS checks to see whether the GRASS command has been parsed already and cached in this session; if not, it reads the interface description, parses it and caches it for future use. doGRASS assembles a proposed GRASS command with flags and parameters as a string, wrapping parseGRASS, and execGRASS is a wrapper for doGRASS, running the command through system (from 0.7-4, the ... argument is not used for passing extra arguments for system). The command string is termed proposed, because not all of the particular needs of commands are provided by the interface description, and no check is made for the existence of input objects. Support for multiple parameter values added with help from Patrick Caldon. Support for defaults and for direct use of GRASS parameters instead of a parameter list suggested by Rainer Krug.
parseGRASS进行检查,看GRASS命令是否已被解析已经缓存在本次会议中,如果没有,它读取的接口描述,解析它,并将其缓存,以备将来使用。 doGRASS组装建议GRASS命令的标志和参数作为一个字符串,包装parseGRASS,和execGRASS的包装doGRASS,运行命令,通过system (0.7-4 ...参数不使用额外的参数传递system)。被称为,因为不是所有的特殊需要的命令所提供的接口描述,并没有检查是否存在输入对象的命令字符串。支持多个参数值补充说:从帕特里克Caldon的帮助。对于默认值和莱纳库克提出的一个参数列表,而不是直接使用GRASS参数的支持。
值----------Value----------
parseGRASS returns a GRASS_interface_desc object, doGRASS returns a character string with a proposed GRASS command, and execGRASS returns what system returns, particularly depending on the intern argument.
parseGRASS返回一个GRASS_interface_desc对象,doGRASS返回一个字符串,建议GRASS命令,并execGRASS回报什么system回报,特别是根据intern参数。
注意----------Note----------
If any package command fails with a UTF-8 error from the XML package, try using setXMLencoding to work around the problem that GRASS modules declare –interface-description output as UTF-8 without ensuring that it is (French is of 6.4.0 RC5 latin1).
如果任何软件包命令失败,出现一个UTF-8错误的XML包,请尝试使用setXMLencoding来解决这个问题,GRASS模块的声明接口描述输出UTF-8,而确保它是(法国是6.4.0 RC5拉丁文)。
(作者)----------Author(s)----------
Roger S. Bivand, e-mail: <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>
参见----------See Also----------
system
system
实例----------Examples----------
if (nchar(Sys.getenv("GISRC")) > 0) {
oechoCmd <- get.echoCmdOption()
set.echoCmdOption(TRUE)
print(parseGRASS("r.slope.aspect"))
doGRASS("r.slope.aspect", flags=c("overwrite"),
elevation="elevation.dem", slope="slope", aspect="aspect")
pars <- list(elevation="elevation.dem", slope="slope", aspect="aspect")
doGRASS("r.slope.aspect", flags=c("overwrite"), parameters=pars)
print(parseGRASS("r.buffer"))
doGRASS("r.buffer", flags=c("overwrite"), input="bugsites", output="bmap",
distances=seq(1000,15000,1000))
pars <- list(input="bugsites", output="bmap", distances=seq(1000,15000,1000))
doGRASS("r.buffer", flags=c("overwrite"), parameters=pars)
set.echoCmdOption(oechoCmd)
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|