簡體   English   中英

在 R(ncdf4 包)中讀取 .nc4 文件時出錯

[英]Error reading a .nc4 file in R (ncdf4 package)

我正在嘗試使用從NASA下載的.nc4 files的數據集。

格式 NCDF4 由該來源確認。 我在 R 中使用下載 .file 來獲取數據庫,然后使用一個簡單的 nc_open(ncdf4 包)來測試該文件。 不幸的是,結果是“未知文件格式”錯誤。

這是我的復制文件和我的腳本:

download.file (url=http://hydro1.gesdisc.eosdis.nasa.gov/.../url, destfile=destination_folder/file.nc4)

到目前為止一切正常,但是在測試文件時:

library(ncdf4)
setwd('destination_folder')
data <- nc_open('file.nc4')
Error in R_nc4_open: NetCDF: Unknown file format
 Error in nc_open("file.nc4") : 
 Error in nc_open trying to open file file.nc4

我錯過了什么嗎?
謝謝。

我不知道是什么問題,但我可以添加問題存在於 ncdf4 包的 Windows 實現中的信息。 有以下聲明:

catlg<-nc_open("http://opendap.deltares.nl/thredds/dodsC/opendap/rijkswaterstaat/waterbase/concentration_of_suspended_matter_in_water/catalog.nc")

我有與問題中描述的相同的問題。 但是,它在 Linux 下的 R 中完美運行

文件服務器是嚴格遵循 netcdf 4 約定的 OpenDAP 服務器,但可能某些功能在 Windows 下的 ncdf4 包中沒有正確實現

出於某種原因,我在使用 [64 位] C:\\Program Files\\R\\R-3.4.2) 時遇到了同樣的錯誤,但是在使用 [64 位] C:\\Program Files\\R\\R-3.3.3 時ncdf4 包工作正常。

並不是說這解決了問題,而是暫時提供了一個簡單的解決方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM