library(raster) library(data.table) data<-c("nishinoshima_20131204_2.5m.txt","nishinoshima_20131217_2.5m.txt", "nishinoshima_20140216_2.5m.txt","nishinoshima_20140322_2.5m.txt", "nishinoshima_20141204_2.5m.txt","nishinoshima_20150301_2.5m.txt", "nishinoshima_20150728_2.5m.txt","nishinoshima_20140704_1.0m_mm.txt") for (i in 1:8){ nishi<-fread(data[i]) ymd<-paste0(substr(data[i],14,17),"年",substr(data[i],18,19),"月",substr(data[i],20,21),"日") nishi[nishi$Z==-9999, Z:=NA] nishi<-nishi[,c(2,1,3),with=F] nishi_rt<-rasterFromXYZ(nishi) proj4string(nishi_rt) <- CRS("+init=epsg:2456") e <- extent(-111898, -109798,137438, 139528) nishi_rt<-extend(nishi_rt,e) slope <- terrain(nishi_rt,opt='slope') aspect <- terrain(nishi_rt,opt='aspect') hill <- hillShade(slope, aspect, 40, 270) png(paste0(substr(data[i],1,21),".png"),width=800,height=800) plot(hill, col=grey(0:100/100),legend=FALSE,axes=F,box=F) plot(nishi_rt, col=terrain.colors(25, alpha=0.6),add=TRUE,axes=F,box=F) title(paste0("西之島 ",ymd)) dev.off() }
|