我在Ubuntu 14.04下使用Trusty的ncl-ncarg 6.1.2-7。我创建了从usr/share/ncarg
到usr/lib
的软链接,并通过以下方式设置环境和路径:
export NCARG_ROOT="/usr"
export PATH=$NCARG_ROOT/bin:$PATH
我有一个simple_plot_pr.ncl,用于创建3个netCDF文件的面板图。
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文件时,我收到以下错误消息:
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找不到它们?有人可以给我一个解决这个问题的建议吗?
答案 0 :(得分:0)
由于文件名中的空格,肯定会出现错误。请重命名不带空格的文件名。
答案 1 :(得分:0)
您还可以在文件名中的空格前使用正斜杠。例如。而不是写气候月平均值pr_1971-2000.nc&#34 ;;您可以按以下格式编写文件名。 &#34;气候\月/ \均\ pr_1971-2000.nc&#34;