【发布时间】:2018-08-28 17:22:54
【问题描述】:
我是 R 和 NetCDF 文件的新手。我正在尝试打开来自here 的.nc 文件中的表面海温数据。我的代码如下:
rm(list=ls())
#install.packages(c("netcdf", "chron", "RColorBrewer", "lattice"))
library(chron)
library(RColorBrewer)
library(lattice)
library(ncdf4)
# set path and filename
ncpath <- "C:/Users/Mihir Sharma/Dropbox/data/"
ncname <- "20140101023458-NCEI-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.3_NOAA19_G_2014001_night-v02.0-fv01.0"
ncfname <- paste(ncpath, ncname, ".nc", sep="")
dname <- "tmp" # note: tmp means temperature (not temporary)
# open a NetCDF file
ncin <- nc_open(ncfname)
但我收到以下错误:
Error in nc_open(ncfname) :
Error in nc_open trying to open file C:/Users/Mihir Sharma/Dropbox/1 EPIC/MPA/data/20140101023458-NCEI-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.3_NOAA19_G_2014001_night-v02.0-fv01.0.nc
非常感谢, 米希尔
【问题讨论】:
-
检查该路径下的文件是否存在
-
更明确地说,
file.exists(ncfname)的输出是什么 -
路径有问题 - 很抱歉浪费您的时间,非常感谢您的快速回复!
-
欢迎您!很高兴你找到了。请参阅下面的我的答案:使用别人的代码时的路径问题。如果有帮助,请点赞并将其标记为答案。
标签: r geospatial netcdf netcdf4