【发布时间】:2015-04-13 14:28:52
【问题描述】:
我有一个印度尼西亚水域盐度的 NetCDF 文件,具有 4 维(经度、纬度、深度和时间)。我想根据我的数据创建一张地图,但它的位置似乎与海岸线不完全匹配。 在此处下载数据:https://onedrive.live.com/redir?resid=6FFDD661570C7D0A%21177 此处输出地图:https://onedrive.live.com/redir?resid=6FFDD661570C7D0A%21176
# This is my script
library (ncdf)
library (raster)
library (sp)
setwd ('D:/work')
bio <- open.ncdf('data.nc')
print (bio)
sal.dat <- get.var.ncdf(bio,"salinity")
sal0 <- brick(sal.dat[,,1,])
extent(sal0) <- c(105,110,-5,0)
projection(sal0) <- CRS("+proj=longlat +datum=WGS84")
#plot image
image (sal0)
# load coastal lines of Indonesia:
con <- url("http://biogeo.ucdavis.edu/data/gadm2/R/IDN_adm0.RData")
load(file = con)
close(con)
# plot coastal lines:
plot(gadm, add = T)
【问题讨论】: