pick.from.points(RSAGA)
pick.from.points()所属R语言包:RSAGA
Pick Variable from Spatial Dataset
从空间数据库中选择变量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions pick (i.e. interpolate without worrying too much about theory) values of a spatial variables from a data stored in a data.frame, a point shapefile, or an ASCII or SAGA grid, using nearest neighbor or kriging interpolation. pick.from.points and [internal.]pick.from.ascii.grid
这些功能选秀权(即插,而不必担心太多理论)从一个数据存储在一个数据框,一个点坐标,或的ASCII或SAGA电网,使用最近的邻居或克里金插值的空间变量的值。 pick.from.points和[internal.]pick.from.ascii.grid
用法----------Usage----------
pick.from.points(data, src, pick,
method = c("nearest.neighbour", "krige"),
set.na = FALSE, radius = 200, nmin = 0, nmax = 100,
sill = 1, range = radius, nugget = 0,
model = vgm(sill - nugget, "Sph", range = range, nugget = nugget),
log = rep(FALSE, length(pick)), X.name = "x", Y.name = "y", cbind = TRUE)
pick.from.shapefile(data, shapefile, X.name = "x", Y.name = "y", ...)
pick.from.ascii.grid(data, file, path = NULL, varname = NULL, prefix = NULL,
method = c("nearest.neighbour","krige"), cbind = TRUE,
parallel = FALSE, nsplit, quiet = TRUE, ...)
pick.from.saga.grid(data, filename, path, varname, prec = 7,
show.output.on.console = FALSE, env = rsaga.env(), ...)
pick.from.ascii.grids(data, file, path = NULL, varname = NULL, prefix = NULL,
cbind = TRUE, quiet = TRUE, ...)
internal.pick.from.ascii.grid(data, file, path = NULL, varname = NULL, prefix = NULL,
method = c("nearest.neighbour", "krige"), nodata.values = c(-9999, -99999),
at.once, quiet = TRUE, X.name = "x", Y.name = "y",
nlines = Inf, cbind = TRUE, range, radius, na.strings = "NA", ...)
参数----------Arguments----------
参数:data
data.frame giving the coordinates (in columns specified by X.name, Y.name) of point locations at which to interpolate the specified variables or grid values
在插入指定的变量或网格值数据框点位置的坐标(在指定的X.name, Y.name列)
参数:src, shapefile
data.frame or point shapefile
数据框或点坐标
参数:pick
variables to be picked (interpolated) from src; if missing, use all available variables, except those specified by X.name and Y.name
被拾起的变量(插值)从src;如果丢失,使用所有可用的变量,除外X.name和Y.name指定的
参数:method
interpolation method to be used; uses a partial match to the alternatives "nearest.neighbor" (currently the default) and "krige"
使用插值的方法,使用部分匹配的替代品"nearest.neighbor"(目前的缺省)和"krige"
参数:set.na
logical: if a column with a name specified in pick already exists in data, how should it be dealt with? set.na=FALSE (default) only overwrites existing data if the interpolator yields a non-NA result; set.na=TRUE passes NA values returned by the interpolator on to the results data.frame
逻辑:如果某列中指定的名称pick已经存在data,应如何被处理? set.na=FALSE(默认)只覆盖现有的数据,如果在插补器产生一个非NA的结果,“set.na=TRUE通过NA的返回值由内插的结果数据框
参数:radius
numeric value specifying the radius of the local neighborhood to be used for interpolation; defaults to 200 map units (presumably meters), or, in the functions for grid files, 2.5*cellsize.
数值指定的半径当地居委会用于插,默认为200个图单位(大概是米),或在格档的功能,2.5*cellsize。
参数:nmin, nmax
numeric, for method="krige" only: see krige function in package gstat
数字,method="krige"只有看到krige函数在包gstat
参数:sill
numeric, for method="krige" only: the overall sill parameter to be used for the variogram
数字,method="krige"只:整体窗台参数要用于变异图
参数:range
numeric, for method="krige" only: the variogram range
数字,method="krige"只有变异图范围
参数:nugget
numeric, for method="krige" only: the nugget effect
数字,method="krige"只有块金效应
参数:model
for method="krige" only: the variogram model to be used for interpolation; defaults to a spherical variogram with parameters specified by the range, sill, and nugget arguments; see vgm in package gstat for details
method="krige"只有:变差函数模型,以用于内插,默认为一个球形变异函数与range指定的参数,sill和nugget参数,请参阅vgm包gstat
参数:log
logical vector, specifying for each variable in pick if interpolation should take place on the logarithmic scale (default: FALSE)
逻辑向量,为每个变量指定pick应该发生在对数刻度(默认值:如果插FALSE)
参数:X.name, Y.name
names of the variables containing the x and y coordinates
含有的x和y坐标的变量的名称
参数:cbind
logical: shoud the new variables be added to the input data.frame (cbind=TRUE, the default), or should they be returned as a separate vector or data.frame? cbind=FALSE
逻辑:电视剧续集失误谈新的变量被添加到输入数据框(cbind=TRUE,默认值),还是应该作为一个独立的向量或数据框返回? cbind=FALSE
参数:file
file name (relative to path, default file extension .asc) of an ASCII grid from which to pick a variable, or an open connection to such a file
文件名(相对于path,默认文件扩展名.asc从中选择一个变量,或者一个打开的连接)的ASCII网格这样的文件
参数:path
optional path to file
可选的路径file
参数:varname
character string: a variable name for the variable interpolated from grid file file in pick.from.*.grid; if missing, variable name will be determined from filename by a call to create.variable.name
字符串的变量:变量名插值的网格文件file中pick.from.*.grid;通过调用file,如果缺失,变量名称将确定create.variable.name名
参数:prefix
an optional prefix to be added to the varname
一个可选的前缀添加到varname的
参数:nodata.values
numeric vector specifying grid values that should be converted to NA; in addition to the values specified here, the nodata value given in the input grid's header will be used
数字矢量应该被转换为NA;除了此处指定的值,在输入电网的头NoData值将被用来指定网格值
参数:at.once
logical: should the grid be read as a whole or line by line? at.once=FALSE is useful for processing large grids that do not fit into memory; the argument is currently by default FALSE for method="nearest.neighbour", and it currently MUST be TRUE for all other methods (in these cases, TRUE is the default value); piecewise processing with at.once=FALSE is always faster than processing the whole grid at.once
逻辑:电网作为一个整体或逐行读取? at.once=FALSE是有用的,不适合到内存中处理大电网的说法是目前默认情况下,FALSEmethod="nearest.neighbour",和它目前必须是TRUE的所有其他方法(在这种情况下,TRUE是默认值);分段处理与at.once=FALSE是总是快于处理整个网格at.once
参数:quiet
logical: provide information on the progress of grid processing on screen? (only relevant if at.once=FALSE and method="nearest.neighbour")
逻辑:提供的信息在屏幕上的网格处理的进展吗? (只如果at.once=FALSE和method="nearest.neighbour")
参数:nlines
numeric: stop after processing nlines lines of the input grid; useful for testing purposes
数字:停止处理后nlines行输入电网,对于测试
参数:filename
character: name of a SAGA grid file, default extension .sgrd
特点:名称的的SAGA电网文件,默认的扩展名.sgrd
参数:prec
numeric, specifying the number of digits to be used in converting a SAGA grid to an ASCII grid in pick.from.saga.grid
数字,指定要使用的,在转换SAGA网ASCII格在pick.from.saga.grid的数位
参数:na.strings
passed on to scan
通过scan
参数:env
list: RSAGA geoprocessing environment created by rsaga.env
列表:RSAGAGEO处理环境创建的rsaga.env
参数:show.output.on.console
a logical (default: FALSE), indicates whether to capture the output of the command and show it on the R console (see system, rsaga.geoprocessor).
逻辑(默认:FALSE),指示是否捕获命令的输出,并显示它的R控制台(见system,rsaga.geoprocessor)。
参数:nsplit
split the data.frame data in nsplit disjoint subsets in order to increase efficiency by using ddply in package plyr. The default seems to perform well in many situations.
分裂的数据框data中nsplit的不相交的子集,以提高效率,通过使用ddply的包plyr。在默认情况下似乎表现良好,在许多情况下。
参数:parallel
logical (default: FALSE): enable parallel processing; requires additional packages such as doSMP or doMC. See example below and ddply
逻辑(默认:FALSE):使并行处理,需要额外的软件包,如doSMP或doMC。见下面的例子和ddply
参数:...
arguments to be passed to pick.from.points, and to internal.pick.from.ascii.grid in the case of pick.from.ascii.grid
参数被传递给pick.from.points,internal.pick.from.ascii.gridpick.from.ascii.grid的情况下,
Details
详细信息----------Details----------
pick.from.points interpolates the variables defined by pick in the src data.frame to the locations provided by the data data.frame. Only nearest neighbour and ordinary kriging interpolation are currently available. This function is intended for 'data-rich' situations in which not much thought needs to be put into a geostatistical analysis of the spatial structure of a variable. In particular, this function is supposed to provide a simple, 'quick-and-dirty' interface for situations where the src data points are very densely distributed compared to the data locations.
pick.from.points内插中定义的变量picksrc数据框data数据框的位置。目前只有最近的邻居和普通克里金插值。此功能的目的是为“数据丰富的情况下,在没有想那么多需要投入地统计分析的变量的空间结构。特别是,这个功能应该是提供一个简单的,快速和肮脏的接口的情况下,src的数据点分布非常密集相比data位置。
pick.from.shapefile is a front-end of pick.from.points for point shapefiles.
pick.from.shapefile是pick.from.points点shape文件的前端。
pick.from.ascii.grid retrieves data values from an ASCII raster file using either nearest neighbour or ordinary kriging interpolation. The latter may not be possible for large raster data sets because the entire grid needs to be read into an R matrix. Split-apply-combine strategies are used to improve efficiency and allow for parallelization.
pick.from.ascii.grid检索数据值从ASCII光栅文件,可以使用最近的邻居或普通克里金插值。后者可能无法为大型栅格数据集,因为整个网格需要被读入的R矩阵。分割申请相结合的策略,以提高效率,并允许进行并行化。
The optional parallelization of pick.from.ascii.grid computation requires the use of a parallel backend package such as doSMP or doMC, and the parallel backend needs to be registered before calling this function with parallel=TRUE. The example section provides an example using doSMP on Windows. I have seen 25-40 in some examples that I ran on a dual core Windows computer.
可选的并行化pick.from.ascii.grid计算需要使用一个平行的后端封装,如doSMP或doMC,平行的后端需要注册,然后才能调用这个函数来parallel=TRUE 。 “示例”部分提供了一个例子,使用doSMP在Windows。我在一个双核心的Windows计算机上运行的一些例子,我所看到的25-40。
pick.from.ascii.grids performs multiple pick.from.ascii.grid calls. File path and prefix arguments may be specific to each file (i.e. each may be a character vector), but all interpolation settings will be the same for each file, limiting the flexibility a bit compared to individual pick.from.ascii.grid calls by the user. pick.from.ascii.grids currently processes the files sequentially (i.e. parallelization is limited to the pick.from.ascii.grid calls within this function).
pick.from.ascii.grids执行多个pick.from.ascii.grid调用。文件path和prefix参数可以具体到每个file(即每个人都可以是一个字符向量),但所有的插值设置将是相同的,限制每一个file的灵活性由用户个别pick.from.ascii.grid呼叫相比有点。 pick.from.ascii.grids当前处理的文件按顺序(即并行化限于pick.from.ascii.grid调用此函数内)。
pick.from.saga.grid is the equivalent to pick.from.ascii.grid for SAGA grid files. It simply converts the SAGA grid file to a (temporary) ASCII raster file and applies pick.from.ascii.grid.
pick.from.saga.grid是等价于pick.from.ascii.gridSAGA网格文件。它只是简单地把的SAGA电网file(临时)ASCII光栅文件和适用于pick.from.ascii.grid。
internal.pick.from.ascii.grid is an internal 'workhorse' function that by itself would be very inefficient for large data sets data. This function is called by pick.from.ascii.grid, which uses a split-apply-combine strategy implemented in the plyr package.
internal.pick.from.ascii.grid是一个内部的“主力”功能,本身将是非常低效的大型数据集的data。这个函数被调用pick.from.ascii.grid,它采用了分体式应用相结合的战略实施中的plyr包。
值----------Value----------
If cbind=TRUE, columns with the new, interpolated variables are added to the input data.frame data.
如果cbind=TRUE,列与新的内插变量添加到输入数据框data。
If cbind=FALSE, a data.frame only containing the new variables is returned (possibly coerced to a vector if only one variable is processed).
如果cbind=FALSE,只包含新的变量,则返回一个数据框(可能被迫如果只有一个变量被处理为矢量)。
注意----------Note----------
method="krige" requires the gstat package.
method="krige"需要gstat包。
pick.from.shapefile requires the shapefiles package.
pick.from.shapefile需要shapefiles包。
The nearest neighbour interpolation currently randomly breaks ties if pick.from.points is used, and in a deterministic fashion (rounding towards greater grid indices, i.e. toward south and east) in the grid functions.
最近邻插值目前pick.from.points如果使用随机打破关系,在确定方式(四舍五入向提高电网指数,即对东部和南部)的网格功能。
(作者)----------Author(s)----------
Alexander Brenning
参考文献----------References----------
The example of landslide susceptibility analysis with generalized additive models. In: J. Boehner, T. Blaschke, L. Montanarella (eds.), SAGA - Seconds Out (= Hamburger Beitraege zur Physischen Geographie und Landschaftsoekologie, 19), 23-32. http://www.environment.uwaterloo.ca/u/brenning/Brenning-2008-RSAGA.pdf
参见----------See Also----------
grid.to.xyz,
grid.to.xyz,
实例----------Examples----------
## Not run: [#不运行:]
# assume that 'dem' is an ASCII grid and d a data.frame with variables x and y[认为DEM是一个ASCII网格和DA数据框的变量x和y]
pick.from.ascii.grid(d, "dem")
# parallel processing on Windows using the doSMP package:[并行处理在Windows使用doSMP包:]
require(doSMP)
workers = startWorkers(workerCount = 2) # DualCore processor[DualCore处理器]
registerDoSMP(workers)
pick.from.ascii.grid(d, "dem")
# produces two warning messages when using doSMP[在时使用doSMP产生两个警告消息]
# typically 25-40[通常25-40]
stopWorkers(workers)
## End(Not run)[#(不执行)]
# use the meuse data for some tests:[使用默兹一些测试数据:]
require(gstat)
data(meuse)
data(meuse.grid)
meuse.nn = pick.from.points(data=meuse.grid, src=meuse,
pick=c("cadmium","copper","elev"), method="nearest.neighbour")
meuse.kr = pick.from.points(data=meuse.grid, src=meuse,
pick=c("cadmium","copper","elev"), method="krige", radius=100)
# it does make a difference:[不一样的结果:]
plot(meuse.kr$cadmium,meuse.nn$cadmium)
plot(meuse.kr$copper,meuse.nn$copper)
plot(meuse.kr$elev,meuse.nn$elev)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|