问题描述
我正在尝试为冰川制作坡度图,但坡度值高得不切实际。我正在使用 terrain
包的 raster
。这是使用该文件的谷歌驱动器的链接
https://drive.google.com/file/d/1uxd945IJRM4YbhmolXCHEQFKtRaA0GVE/view?usp=sharing
library(ggplot2)
library(tidyverse)
library(Metrics)
library(raster)
library(rgdal)
library(depmixS4)
library(plotly)
ice_14.15990 <- read.table("/Users/sayantanmandal/THESIS/Codes/bed/ice_14.15990")
colnames(ice_14.15990)[1] <- "Longitude"
colnames(ice_14.15990)[2] <- "Latitude"
colnames(ice_14.15990)[3] <- "surface_thickness"
ICE <- subset(ice_14.15990,surface_thickness!=0)
obs_ice <- rasterFromXYZ(ICE)
crs(obs_ice)<- CRS('+init=epsg:32643')
writeraster(obs_ice,'/Users/sayantanmandal/THESIS/Codes/obs_ice.tif',overwrite = TRUE)
obs_ice_slope <- terrain(x = obs_ice,opt = 'slope',unit = 'degrees',neighbors = 8,is.na = TRUE)
obs_ice_slope_df <- as.data.frame(rasterToPoints(obs_ice_slope))
colnames(obs_ice_slope_df)[1] <- "Longitude"
colnames(obs_ice_slope_df)[2] <- "Latitude"
colnames(obs_ice_slope_df)[3] <- "Slope_deg"
obs_ice_slope_df <- subset(obs_ice_slope_df,Slope_deg !=0 )
obs_ice_slope_df$Slope_val <- tan((obs_ice_slope_df$Slope_deg *pi)/180)
obs_ice_slope_cont <- ggplot(obs_ice_slope_df,aes(x = Longitude,y = Latitude,z = Slope_deg)) +
geom_raster(aes(fill = Slope_deg)) +
scale_fill_distiller(palette = "Spectral",direction = -1) +
xlab("Longitude (epsg: 32643)") +
ylab("Latitude (epsg: 32643)") +
ggtitle("observed ice slope in deg.") +
theme(
panel.border = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),panel.background = element_blank())+
stat_contour()
print(obs_ice_slope_cont)
[
。我似乎无法弄清楚我哪里出错了。可能是数据开始不流畅?解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)