![](/img/trans.png)
[英]no applicable method for 'summarise' applied to an object of class "c('double', 'numeric')"
[英]R: no applicable method for 'gaussiansmooth' applied to an object of class "c('matrix', 'array', 'double', 'numeric')" or "c('RasterLayer', 'Raster')
I am trying to use the function gaussiansmooth
but I am receiving an error: Error in UseMethod("gaussiansmooth"): no applicable method for 'gaussiansmooth' applied to an object of class "c('RasterLayer', 'Raster', 'BasicRaster')".
從文檔中可以看出,輸入應該是 memory 中的網格 object。 這是我的許多測試之一:
library(raster)
library(gridkernel)
library(gridprocess)
pan = raster("path/pan15.tif")
smoothed = gaussiansmooth(m,
sd = 0.5 * 920) # the multiplication is because I want my pixel size to become 460m.
在文檔的示例中,他們使用了matrix
,但發生了相同的錯誤: Error in UseMethod("gaussiansmooth"): no applicable method for 'gaussiansmooth' applied to an object of class "c('matrix', 'array', 'double', 'numeric')".
這是相同的代碼,但使用matrix
而不是衛星圖像。
pan = raster("path/pan15.tif")
m = as.matrix(pan)
smoothed = gaussiansmooth(m,
sd = 0.5 * 920)
這里的目標是通過應用Gaussian filter
將圖像的像素大小從 15m 更改為 460m。 這與“簡單”重采樣方法(例如,最近鄰)不同,因為我正在嘗試 model 點傳播 function。
從這里你可以下載我的圖像。
package 的作者在Github
上回答了我的問題,結果發現它非常簡單。 我只需要將raster
轉換為grid
object。
library(raster)
library(gridkernel)
library(gridprocess)
pan = raster("path/pan15.tif")
g = as.grid(pan)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.