爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6947|回复: 6

[作图] NCL菜鸟者求助!!!

[复制链接]
发表于 2014-12-11 22:50:33 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 aa22556688 于 2014-12-12 12:50 编辑

同学传来脚本,在她的大型机上运行没有问题,但是传给我,放到大型机上运行就出现了如图1的那样的错误,我只改了路径。提示是100行有问题,但是我的脚本100行是end命令,有没有了解怎么回事,求大神指点,非常感谢!!!

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
fi1 = "/cvfs01/disk1/wangq316/zhangchao/data/drought/dry_days.txt"
fi2 = "/cvfs01/disk1/wangq316/zhangchao/data/drought/dry_light.txt"
fi3 = "/cvfs01/disk1/wangq316/zhangchao/data/drought/dry_mid.txt"
fi4 = "/cvfs01/disk1/wangq316/zhangchao/data/drought/dry_strong.txt"
print(22)
nrow1 = numAsciiRow(fi1)
ncol1 = numAsciiCol(fi1)
nrow2 = numAsciiRow(fi2)
ncol2 = numAsciiCol(fi2)
nrow3 = numAsciiRow(fi3)
ncol3 = numAsciiCol(fi3)
nrow4 = numAsciiRow(fi4)
ncol4 = numAsciiCol(fi4)
data1 = asciiread(fi1,(/nrow1,ncol1/),"float")
data2 = asciiread(fi2,(/nrow2,ncol2/),"float")
data3 = asciiread(fi3,(/nrow3,ncol3/),"float")
data4 = asciiread(fi4,(/nrow4,ncol4/),"float")
printVarSummary(data1)
y1 = new((/2,nrow1/),float)
y1(0,:)=data1(:,1)
y1(1,:)=data1(:,2)
x=ispan(1974,2012,1)
x2=data2(:,0)
x3=data3(:,0)
x4=data4(:,0)
y2 = new((/2,nrow2/),float)
;y2@_FillValue=999
printVarSummary(y2)
y2(0,:)=data2(:,1)
y2(1,:)=data2(:,2)
y3 = new((/2,nrow3/),float)
;y3@_FillValue=999
y3(0,:)=data3(:,1)
y3(1,:)=data3(:,2)
y4 = new((/2,nrow4/),float)
;y4@_FillValue=999
y4(0,:)=data4(:,1)
y4(1,:)=data4(:,2)
wks = gsn_open_wks("pdf","../picture/"+get_script_prefix_name())   
res = True
res@gsnMaximize      = False
res@gsnDraw          = False
res@gsnFrame         = False          ; Don't advance the frame
res@vpWidthF         = 0.8            ; Change the aspect ratio, but
res@vpHeightF        = 0.5            ; make plot as large as possible
;res@tiMainString     = "The ridge of WPSH"      ; add title
;res@tmYLMode    ="Explicit"
;res@tmYLValues  = ispan(1974,2012,1)
;res@tmYLLabels  = (/"1974","1978","1982","18N","19N","20N","21N","22N",\
;                   "23N","24N","25N","26N","27N","28N","29N","30N","31N","32N","33N"/)
;***************** resources for "left" variable
  resL                        = True
  resL = res
  resL@xyLineThicknesses      = 2.                  ; thicker line
  resL@trYMaxF           =   250.                    ; axis max
  resL@trYMinF           =    0.                    ; axis min
  resL@tiXAxisFont ="times-roman"
  resL@tiYAxisFont ="times-roman"
  resL@tmXBMode    = "Explicit"
  resL@tmXBValues  = ispan(1974,2012,2)
  resL@tmXBLabels  = (/"1974","","1978","","1982","","1986","","1990","","1994","","1998","","2002","","2006","","2010",""/)
  resL@tmXBLabelFont ="times-roman"
  resL@tmYLLabelFont ="times-roman"
  resL@xyLineColors      = (/"blue","red"/)                   ; line color
  resL@txFont            = "times-roman"
;******************* resources for "right" variable
  resR                        = True
  resR  =res
  resR@xyDashPatterns         = 1                   ; dashed line for 2nd
  resR@xyLineThicknesses      = 2                   ; thicker line
  resR@gsnRightString           ="~S~o~N~C"        ;
  resR@gsnLeftString     = "days"

  resR@trYMaxF           = 1.5                    ; axis max
  resR@trYMinF           = -0.5                    ; axis min
  resR@xyLineColors      = "red"                    ; line color
  resR@txFont            = "times-roman"
  resR@tmXBLabelFont     = "times-roman"
  resR@tmYLLabelFont     = "times-roman"
  resR@tiXAxisFont = "times-roman"
  resR@tiYAxisFont = "times-roman"
plot=new(4,graphic)
plot(0) = gsn_csm_xy2(wks,x,y1(0,:),y1(1,:),resL,resR)
  resL@trYMaxF           =   140.                    ; axis max
y2@_FillValue = 999
y3@_FillValue = 999
y4@_FillValue = 999
printMinMax(y2(1,:),True)
  resL@gsnLeftString     = "days"
plot(1) = gsn_csm_xy(wks,x2,y2,resL)
  resL@trYMaxF           =   80.                    ; axis max
plot(2) = gsn_csm_xy(wks,x3,y3,resL)
  resL@trYMaxF           =   70.                    ; axis max
plot(3) = gsn_csm_xy(wks,x4,y4,resL)
gsn_panel(wks,plot(:),(/2,2/),False)
end



1.jpg
2.jpg
密码修改失败请联系微信:mofangbao
发表于 2014-12-12 09:22:58 | 显示全部楼层
提示说的很明白了啊,undefined procedure!
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-12-12 10:17:57 | 显示全部楼层
风往北吹 发表于 2014-12-12 09:22
提示说的很明白了啊,undefined procedure!

第一次用ncl,能不能说的详细一点,这种问题是6.0.0版本的ncl里面没有相应的函数,还是我的函数弄错了。
密码修改失败请联系微信:mofangbao
发表于 2014-12-12 11:11:03 | 显示全部楼层
脚本的开头有没有下面这一句?
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
看到你ncl的版本是6.0.0,gsn_code.ncl必须要load进来,估计可能是这个原因。如果不是,最好能把完整代码发上来。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-12-12 12:51:09 | 显示全部楼层
longlivehj 发表于 2014-12-12 11:11
脚本的开头有没有下面这一句?
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
看到你ncl的 ...

非常感谢,问题已经解决了,缺少少了 load
密码修改失败请联系微信:mofangbao
发表于 2014-12-17 13:49:11 | 显示全部楼层
学习了!
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2014-12-17 20:37:13 | 显示全部楼层
恩恩,原来是这样的啊
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表