- 积分
- 576
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2022-1-21
- 最后登录
- 1970-1-1
|
3金钱
请教各位大神!利用NCL官网滤波程序例子3:[size=13.3333px]filters_3.ncl: Band pass filters via filwgts_lanczos对一个范围的风场进行带通滤波,提示维度不匹配,应该怎么解决呢?程序如下:
[size=13.3333px]; ****************************** ; filters_3.ncl ; ************************************ ;
[size=13.3333px]; These files are loaded by default in NCL V6.2.0 and newer ;
[size=13.3333px]load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ;
[size=13.3333px]load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;
[size=13.3333px]load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
[size=13.3333px]begin
[size=13.3333px]
[size=13.3333px] vName = "uwnd" ; name of variable on the file
[size=13.3333px]fili = "/home/u/uwnd.850.1979-2020.nc"
[size=13.3333px]f = addfile(fili, "r")
[size=13.3333px]x = f->uwnd(:,{850},{0:65},{100:180})
[size=13.3333px]; ******************** ; create the filter weights and apply ; *************************
[size=13.3333px]ihp = 2 ; band pass
[size=13.3333px]sigma = 1.0 ; Lanczos sigma
[size=13.3333px]nWgt = 21 ; loose 100 each end
[size=13.3333px]fca = 1./60. ; start freq
[size=13.3333px]fcb = 1./30. ; last freq
[size=13.3333px]wgt = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )
[size=13.3333px]printVarSummary(wgt)
[size=13.3333px]xBPF = wgt_runave_n ( x, wgt, 0, 0 ) ; 30-60 day
[size=13.3333px]printVarSummary(xBPF)
[size=13.3333px]; ******************* ; create new date array for use on the plot ; *********************
[size=13.3333px]date = cd_calendar(x&time,-2) ; yyyymmdd
[size=13.3333px]yrfrac = yyyymmdd_to_yyyyfrac (date, 0)
[size=13.3333px]delete(yrfrac@long_name)
[size=13.3333px]delete(x@long_name)
[size=13.3333px]pStrt = 19790101 ; 4 years: winter 96-97 MJO gold standard
[size=13.3333px]pLast = 20201231
[size=13.3333px]iStrt = ind(date.eq.pStrt) ; user specified dates
[size=13.3333px]iLast = ind(date.eq.pLast)
[size=13.3333px]delete(date)
[size=13.3333px]pltType = "png" ; send graphics to PNG file
[size=13.3333px]pltName = "filters"
[size=13.3333px]plot = new ( 2, "graphic")
[size=13.3333px]wks = gsn_open_wks (pltType,pltName)
[size=13.3333px]res = True ; plot mods desired
[size=13.3333px]res@gsnDraw = False ; don't draw
[size=13.3333px]res@gsnFrame = False ; don't advance frame yet
[size=13.3333px]res@vpHeightF = 0.4 ; change aspect ratio of plot
[size=13.3333px]res@vpWidthF = 0.8
[size=13.3333px]res@vpXF = 0.1 ; start plot at x ndc coord
[size=13.3333px]res@gsnYRefLine = 0.0 ; create a reference line
[size=13.3333px]res@gsnCenterString = "Anomaly U [0:65 100:180]"
[size=13.3333px]res@tmXBFormat = "f"
[size=13.3333px]
[size=13.3333px]plot(0) = gsn_csm_xy (wks,yrfrac(iStrt:iLast),x(iStrt:iLast),res)
[size=13.3333px]res@gsnCenterString = "Band Pass Filtered: 30-60 day"
[size=13.3333px]plot(1) = gsn_csm_xy (wks,yrfrac(iStrt:iLast),xBPF(iStrt:iLast),res)
[size=13.3333px]resP = True
[size=13.3333px]resP@gsnMaximize = True
[size=13.3333px]gsn_panel(wks,plot,(/2,1/),resP) ; Create XY plot of frequency versus response
[size=13.3333px]xyres = True
[size=13.3333px]xyres@gsnMaximize = True
[size=13.3333px]xyres@gsnFrame = False
[size=13.3333px]xyres@tiMainString = "Band Pass: 30-60 srate=1: sigma = " + sigma
[size=13.3333px]xyres@tiXAxisString = "frequency"
[size=13.3333px]xyres@tiYAxisString = "response"
[size=13.3333px]xyres@gsnLeftString = "fca=" + fca + "; fcb=" + fcb
[size=13.3333px]xyres@gsnRightString = nWgt
[size=13.3333px]xyres@trXMaxF = 0.1
[size=13.3333px]xyres@trYMaxF = 1.1
[size=13.3333px]xyres@trYMinF = -0.1
[size=13.3333px]plot = gsn_csm_xy(wks, wgt@freq, wgt@resp, xyres)
[size=13.3333px]X = (/0.0, fca, fca, fcb, fcb, 0.1/) ; ideal filter
[size=13.3333px]Y = (/0.0, 0.0, 1.0, 1.0, 0.0, 0.0 /)
[size=13.3333px]resGs = True
[size=13.3333px]resGs@gsLineThicknessF = 1.0
[size=13.3333px]gsn_polyline(wks,plot,X,Y,resGs)
[size=13.3333px]frame(wks)
[size=13.3333px]end
|
-
报错
-
报错位置
|