1

我在 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找不到他们?有人可以给我一个解决这个问题的建议吗?

4

2 回答 2

0

由于文件名中的空格,肯定会出现错误。请重命名不带空格的文件名。

于 2016-12-01T02:00:44.620 回答
0

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

于 2017-03-09T07:12:09.980 回答