找回密码
 注册
查看: 473|回复: 0

R语言 spgrass6包 readRAST6()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 15:06:54 | 显示全部楼层 |阅读模式
readRAST6(spgrass6)
readRAST6()所属R语言包:spgrass6

                                        Read and write GRASS 6+ raster files
                                         读取和写入GRASS 6 +光栅文件

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Read GRASS 6+ raster files from GRASS 6+ into R SpatialGridDataFrame objects, and write single columns of R SpatialGridDataFrame objects to GRASS 6+. readRAST6 and writeRAST6 use temporary binary files and r.out.bin and r.in.bin rather than the temporary ASCII files used in earlier implementations. The earlier versions may still be used in a transition period.
GRASS 6 +光栅文件从GRASS 6 +,到R SpatialGridDataFrame对象的读,写单个列的R SpatialGridDataFrame对象GRASS 6 +。 readRAST6和writeRAST6使用临时的二进制文件和r.out.bin的和r.in.bin的,而不是临时使用的ASCII文件在早期的实现。在过渡时期的早期版本中仍然可以使用。


用法----------Usage----------


readRAST6(vname, cat=NULL, ignore.stderr = NULL, NODATA=NULL, plugin=NULL, mapset=NULL, useGDAL=NULL, close_OK=TRUE, drivername="GTiff", driverFileExt=NULL, return_SGDF=TRUE)
writeRAST6(x, vname, zcol = 1, NODATA=NULL, ignore.stderr = NULL, useGDAL=NULL, overwrite=FALSE, flags=NULL, drivername="GTiff")



参数----------Arguments----------

参数:vname
A vector of GRASS 6.0 raster file names
GRASS 6.0光栅文件名的矢量


参数:cat
default NULL; if not NULL, must be a logical vector matching vname, stating which (CELL) rasters to return as factor
默认为空,如果不为NULL,必须是一个逻辑的矢量匹配vname,说明(CELL)栅格返回因素


参数:ignore.stderr
default NULL, taking the value set by set.ignore.stderrOption, can be set to TRUE to silence system() output to standard error; does not apply on Windows platforms
默认NULL,采取set.ignore.stderrOption中设置的值,可以设置为TRUE保持沉默system()输出到标准错误,并不适用于Windows平台


参数:plugin
default NULL does auto-detection, changes to FALSE if vname is longer than 1, and a sanity check will be run on raster and current region, and the function will revert to FALSE if mismatch is found; if TRUE, the plugin is available and the raster should be read in its original region and resolution; if the plugin is used, no further arguments other than mapset are respected
NULL默认不自动检测,改变为FALSE,如果vname时间比1,而将运行在栅格和当前区域进行仔细的检查,该函数将转换为false,如果发现不匹配,如果为true,插件是和光栅应阅读其原来的区域和分辨率,如果使用插件,没有进一步的论据以外图集得到尊重


参数:mapset
default NULL, if plugin is TRUE, the mapset of the file to be imported will be autodetected; if not NULL and if plugin is TRUE, a character string overriding the autodetected mapset, otherwise ignored
默认为空,如果是TRUE插件,图集要导入的文件将自动检测,如果不为NULL,如果插件是TRUE,字符串覆盖自动检测图集,否则忽略


参数:useGDAL
default NULL, taking the value set by set.useGDALOption; use r.out.gdal or plugin and readGDAL if autodetected or plugin=TRUE; or for writing writeGDAL, GTiff, and r.in.gdal, if FALSE using r.out.bin or r.in.bin
默认NULL,采取set.useGDALOption;使用r.out.gdal或插件,readGDAL,如果自动检测或插件= TRUE;或书面形式writeGDAL,GTiff的,并r.in的设置的值; 。GDAL,如果为FALSE r.out.bin或r.in.bin


参数:close_OK
default TRUE - clean up possible open connections used for reading metadata; may be set to FALSE to avoid the side-effect of other user-opened connections being broken
默认为true  - 清理可以打开的连接,用于读取元数据;可能被设置为FALSE,以避免其他用户打开的连接被破坏的副作用


参数:drivername
default "GTiff"; a valid GDAL writable driver name to define the file format for intermediate files
默认"GTiff";一个有效的GDAL可写驱动程序的名称来定义的文件格式的中间文件


参数:driverFileExt
default NULL; otherwise string value of required driver file name extension
默认为空,否则所需的驱动程序文件扩展名的字符串值


参数:return_SGDF
default TRUE returning a SpatialGridDataFrame object, if FALSE, return a list with a GridTopology object, a list of bands, and a proj4string; see example below
默认为true返回SpatialGridDataFrame对象,如果为FALSE,返回一个列表,,一个GridTopology对象,列表的乐队,和proj4string;见下面的例子


参数:x
A SpatialGridDataFrame object for export to GRASS as a raster layer
出口到GRASS的一个SpatialGridDataFrame对象为光栅层


参数:zcol
Attribute column number or name
属性列的编号或名称


参数:NODATA
by default NULL, in which case it is set to one less than floor()of the data values, otherwise an integer NODATA value (required to be integer by GRASS r.out.bin)
默认情况下,NULL,在这种情况下,设置为一个小于floor()的数据值,否则整数NODATA值(为整数GRASS r.out.bin)


参数:overwrite
default FALSE, if TRUE inserts "overwrite" into the value of the flags argument if not already there to allow existing GRASS rasters to be overwritten
默认是false,如果是TRUE插入"overwrite"到flags参数的值,如果不存在允许现有的GRASS栅格覆盖


参数:flags
default NULL, character vector, for example "overwrite"
默认为空,字符向量,例如"overwrite"的


值----------Value----------

readRAST6 returns a SpatialGridDataFrame objects with an data.frame in the data slots, and with the projection argument set. Note that the projection argument set is the the GRASS rendering of proj4, and will differ from the WKT/ESRI rendering returned by readVECT6 in form but not meaning. They are exchangeable but not textually identical, usually with the +ellps= term replaced by ellipsoid parameters verbatim. If return_SGDF is FALSE, a list with a GridTopology object, a list of bands, and a proj4string is returned, with an S3 class attribute of “gridList”.
readRAST6返回一个SpatialGridDataFrame的对象的数据时隙中的数据框,和与投影参数集。请注意,在投影参数集是GRASS渲染proj4的,和将不同的WKT / ESRI渲染的由readVECT6返回的形式,但不意味着。他们是可交换的,但没有文字上相同,通常用+ ellps =术语所取代椭球参数逐字。如果return_SGDF是FALSE,返回一个列表一个GridTopology对象的列表的乐队,和proj4string的是,,与S3类属性“gridList”。


(作者)----------Author(s)----------


Roger S. Bivand, e-mail: <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>



实例----------Examples----------


if (nchar(Sys.getenv("GISRC")) > 0) {
  require(rgdal)
  ois <- get.ignore.stderrOption()
  set.ignore.stderrOption(TRUE)
  get.useGDALOption()
  spear <- readRAST6(c("geology", "elevation.dem"), cat=c(TRUE, FALSE),
    useGDAL=FALSE)
  spear <- readRAST6(c("geology", "elevation.dem"), cat=c(TRUE, FALSE),
    useGDAL=TRUE)
  print(table(spear$geology))
  execGRASS("r.stats", flags=c("c", "l", "quiet"), input="geology")
  boxplot(spear$elevation.dem ~ spear$geology)
  spear$sqdem <- sqrt(spear$elevation.dem)
  if ("GRASS" %in% gdalDrivers()$name) {
    execGRASS("g.region", rast="elevation.dem")
    dem1 <- readRAST6("elevation.dem", plugin=TRUE, mapset="PERMANENT")
    print(summary(dem1))
    execGRASS("g.region", rast="elevation.dem")
  }
  writeRAST6(spear, "sqdemSP", zcol="sqdem")
  execGRASS("r.info", map="sqdemSP")
  execGRASS("g.remove", rast="sqdemSP")
  writeRAST6(spear, "sqdemSP", zcol="sqdem", useGDAL=TRUE)
  execGRASS("r.info", map="sqdemSP")
  print(system.time(sqdemSP <- readRAST6(c("sqdemSP", "elevation.dem"),
    useGDAL=TRUE, return_SGDF=FALSE)))
  print(system.time(sqdemSP <- readRAST6(c("sqdemSP", "elevation.dem"),
    useGDAL=TRUE, return_SGDF=TRUE)))
  print(system.time(sqdemSP <- readRAST6(c("sqdemSP", "elevation.dem"),
    useGDAL=FALSE, return_SGDF=TRUE)))
  print(system.time(sqdemSP <- readRAST6(c("sqdemSP", "elevation.dem"),
    useGDAL=FALSE, return_SGDF=FALSE)))
  str(sqdemSP)
  mat <- do.call("cbind", sqdemSP$dataList)
  str(mat)
  print(system.time(SGDF <- SpatialGridDataFrame(grid=sqdemSP$grid,
    proj4string=sqdemSP$proj4string, data=as.data.frame(sqdemSP$dataList))))
  summary(SGDF)
  execGRASS("g.remove", rast="sqdemSP")
  if (execGRASS("g.version", intern=TRUE) > "GRASS 7") {
    execGRASS("r.mapcalc", expression="quads0 = quads - 1")
  } else {
    execGRASS("r.mapcalculator", outfile="quads0",
      amap="quads", formula='A - 1')
  }
  execGRASS("r.stats", flags="c", input="quads0")
  quads0 <- readRAST6("quads0")
  print(table(quads0$quads0))
  quads0 <- readRAST6("quads0", plugin=FALSE)
  print(table(quads0$quads0))
  execGRASS("g.remove", rast="quads0")
  set.ignore.stderrOption(ois)
}

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-18 15:51 , Processed in 0.025548 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表