rasterVis の levelplot 関数を使用して、結果をラスター時系列オブジェクト (rts) に表示したいと思います。
rts パッケージの短いコードを次に示します。
library(raster)
library(rasterVis)
library(rts)
path <- system.file("external", package="rts")
lst <- list.files(path=path,pattern='.asc$',full.names=TRUE)
r <- stack(lst)
d <- c("2000-02-01","2000-03-01","2000-04-01","2000-05-01") # corresponding dates to 4 rasters
d <- as.Date(d)
# creating a RasterStackTS object:
rt <- rts(r,d)
.rts からラスターに強制するには、次を使用しました。
r=rt@raster
proj=CRS("+proj=longlat +datum=NAD27 +no_defs +ellps=clrk66 +nadgrids=@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat")
proj4string(r) <- proj
wgs84.p4s <- CRS("+proj=longlat +datum=NAD83 +ellps=GRS80 +no_defs")
r
からの再投影UTM coordinates to latlong coordinates
rx <- projectRaster(from=r, crs=wgs84.p4s@projargs, method="ngb")
writeRaster(rt, file="myfile100.tif", format="GTiff", overwrite=TRUE)
ras = raster("myfile100.tif")
で 4 つのレイヤーすべてを読み取るにはどうすればよいmyfile100.tif
ですか?
ras = raster("myfile100.tif")
読み取り専用layer 1
proj4string(ras) <- proj
plot(ras)
levelplot(ras)
次のエラーが表示されます。
Error in projectExtent(from, projto) : cannot do this transformation
In addition: Warning message:
In rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[, :
146 projected point(s) not finite
どうすればこれを回避できますか? たぶん、これを行うためのより短くて合理的な方法さえあります。ご提案いただきありがとうございます。