爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5770|回复: 2

求助:NCL运行滤波脚本出错

[复制链接]
发表于 2014-5-2 14:17:14 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图:
问题概况: 我现在要对olr资料滤波,olr资料用的是日平均的olr.day.mean.nc,学姐给了我一个滤波的脚本,我在windows系统上操作,运行出来一直显示第10有错误,请求各位大大帮我看一下问题出在哪里了,十分感谢。
我看过提问的智慧: 看过
自己思考时长(天): 3

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

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

x
本帖最后由 xiaocaoqiqiao 于 2014-5-2 14:24 编辑

滤波脚本如下:
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
  diri    = "/cygdrive/D/MJO/"
  vName   = "olr"        ; name of variable on the file
  fili    = "olr.day.mean.nc"
  f       = addfile(diri+fili, "r")
  x       =short2flt( f->$vName$(:,:,:));直接利用所给资料滤波,始末时间未变
printVarSummary(x)
;nlat=f->olr&lat
;nlon=f->olr&lon
;ntime=f->olr&time
;anom = x ;(lat|:,lon|:,time|:)                 ; trick to copy cv's and atts
;   anom = dim_rmvmean(x(lat|:,lon|:,time|:))
;printVarSummary(anom)
; ***********************************************
; create the filter weights and apply
; ***********************************************
  ihp     = 2                             ; band pass
  sigma   = 1.0                           ; Lanczos sigma
  nWgt    = 201                          ; loose 100 each end                           
  fca     = 1./80.                       ; start freq
  fcb     = 1./20.                        ; last  freq
  wgt     = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )


  xBPF =wgt_runave ( x(lat|:,lon|:,time|:), wgt, 0 )  ; 20-80 day
xBPF!0="lat"
xBPF!1="lon"
  xBPF!2="time"
xBPF&lat=x&lat
xBPF&lon=x&lon
xBPF&time=x&time
; ***********************************************
; create new date array for use on the plot
; ***********************************************
  date    = cd_calendar(x&time,-2)        ; yyyymmdd
  yrfrac  = yyyymmdd_to_yyyyfrac (date, 0)
  delete(yrfrac@long_name)
  delete(x@long_name)
  pStrt = 19800101      ; 画图所用4 years: winter 96-97 MJO gold standard
  pLast = 19811231
  iStrt = ind(date.eq.pStrt)        ; user specified dates
  iLast = ind(date.eq.pLast)
  delete(date)

  pltType = "ps"
  pltName = "filters"
  plot    = new ( 2, "graphic")
  wks     = gsn_open_wks (pltType,pltName)
  res              =True            ; plot mods desired
  res@gsnDraw      = False           ; don't draw
  res@gsnFrame     = False           ; don't advance frame yet      
  res@vpHeightF    = 0.4             ; change aspect ratio of plot
  res@vpWidthF     = 0.8                  
  res@vpXF         = 0.1             ; start plot at x ndc coord
  res@gsnYRefLine  = 0.0             ; create a reference line   
  
  res@gsnCenterString = "Anomaly olr [0, 120E]"
plot(0) = gsn_csm_xy (wks,yrfrac(iStrt:iLast),x(iStrt:iLast,{0},{120}),res)      
  
  res@gsnCenterString  = "Band Pass Filtered: 20-80 day"     
plot(1) = gsn_csm_xy (wks,yrfrac(iStrt:iLast),xBPF({0},{120},iStrt:iLast),res)     
  
  resP                 = True   
  resP@gsnMaximize     = True
  gsn_panel(wks,plot,(/2,1/),resP)
fout=addfile("filolr.nc","c")
filedimdef(fout,"time",-1,True)
fout->olrfil=xBPF(time|: ,lat|:,lon|:)
end

密码修改失败请联系微信:mofangbao
发表于 2014-5-4 10:41:06 | 显示全部楼层

回帖奖励 +1 金钱

NclMalloc Failed,很有可能是数据太大了,电脑内存不够用。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-5-4 11:32:38 | 显示全部楼层
hzwjy 发表于 2014-5-4 10:41
NclMalloc Failed,很有可能是数据太大了,电脑内存不够用。

的确是的  谢谢
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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