首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么ncl找不到netcdf文件?

为什么ncl找不到netcdf文件?
EN

Stack Overflow用户
提问于 2016-06-19 14:50:35
回答 2查看 800关注 0票数 1

我在Ubuntu 14.04下使用Trusty的ncl-ncarg 6.1.2-7。我创建了一个从usr/share/ncargusr/lib的软链接,并通过以下方式设置环境和路径:

代码语言:javascript
复制
export NCARG_ROOT="/usr"
export PATH=$NCARG_ROOT/bin:$PATH

我有一个从3个netCDF文件创建拼板图的simple_plot_pr.ncl。

代码语言:javascript
复制
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
   ;-- read data and set variable references
       f1 = addfile ("home/robert/Dokumenty/climatological monthly mean pr_1971-2000.nc","r")
       f2 = addfile ("home/robert/Dokumenty/climatological monthly mean pr_2021-2050.nc","r")
       f3 = addfile ("home/robert/Dokumenty/climatological monthly mean pr_2071-2100.nc","r")

       pr1 = f1->pr
       pr2 = f2->pr
       pr3 = f3->pr
;-- open a PNG file
    wks = gsn_open_wks("png","panel_plot")
;-- create plot array
    plot = new(3,graphic)
;-- set resources for contour plots
    res = True
    res@gsnMaximize = True
    res@cnFillOn = True
    res@tiMainString = "Climatological mean monthly precipitation amount"
    gsn_define_colormap(wks,"rainbow")
    plot(0) = gsn_csm_colormap(wks,pr1(:,:),res)
    res@tiMainString = ""
    plot(1) = gsn_csm_colormap(wks,pr2(:,:),res)
    res@tiMainString = ""
    plot(3) = gsn_csm_colormap(wks,pr3(:,:),res)
    ;-- create panel plot
    gsn_panel(wks,plot,(/3,1/),False)
end

当我运行此.ncl文件时,我收到以下错误消息:

代码语言:javascript
复制
Copyright (C) 1995-2013 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.1.2
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
fatal:["FileSupport.c":2761]:_NclFindFileExt: Requested file <home/Dokumenty/climatological monthly mean pr_1971-2000.nc> or <home/Dokumenty/climatological monthly mean pr_1971-2000> does not exist

fatal:["FileSupport.c":3106]:(home/Dokumenty/climatological monthly mean pr_1971-2000.nc) has no file extension, can't determine type of file to open
fatal:["FileSupport.c":2761]:_NclFindFileExt: Requested file <home/robert/Dokumenty/climatological monthly mean pr_2021-2050.nc> or <home/robert/Dokumenty/climatological monthly mean pr_2021-2050> does not exist

fatal:["FileSupport.c":3106]:(home/robert/Dokumenty/climatological monthly mean pr_2021-2050.nc) has no file extension, can't determine type of file to open
fatal:["FileSupport.c":2761]:_NclFindFileExt: Requested file <home/robert/Dokumenty/climatological monthly mean pr_2071-2100.nc> or <home/robert/Dokumenty/climatological monthly mean pr_2071-2100> does not exist

fatal:["FileSupport.c":3106]:(home/robert/Dokumenty/climatological monthly mean pr_2071-2100.nc) has no file extension, can't determine type of file to open
fatal:file (f1) isn't defined
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 11 in file simple_plot_pr.ncl

我检查了这些文件,它们确实存在。我不明白为什么ncl找不到他们?有人能给我一个解决这个问题的建议吗?

EN

回答 2

Stack Overflow用户

发布于 2016-12-01 10:00:45

错误肯定是由于文件名中的空格引起的。请重命名不带空格的文件名。

票数 0
EN

Stack Overflow用户

发布于 2017-03-09 15:12:10

您还可以在文件名中的空格前使用正斜杠。例如。您可以按以下格式编写文件名,而不是编写“气候学月平均值pr_1971-2000.nc”。“气候\月度\平均值\pr_1971-2000。pr”

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37904690

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档