- 积分
- 4059
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-4-4
- 最后登录
- 1970-1-1
|
1金钱
本帖最后由 rpf 于 2016-6-25 16:54 编辑
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
- ymdStrt = 20080101
- ymdLast = 20101231
- begin
- filename = "/cygdrive/C/Users/Administrator/Desktop/Write_RMM.nc/MJO_PC_INDEX_BSISO_97-14.nc"
- f = addfile(filename, "r")
- time = f->time
- YMD = cd_calendar(time, -2)
- iStrt = ind(YMD .eq. ymdStrt)
- iLast = ind(YMD .eq. ymdLast)
- delete([/time,YMD/])
- PC1 = f->PC1(iStrt:iLast)
- PC2 = f->PC2(iStrt:iLast)
- time = f->time(iStrt:iLast)
- YMD = cd_calendar(time, 0)
- ;print(YMD)
- month = YMD(:,1)
- ;print(month)
- nt = ind(month .le. 10 .and. month .ge. 5)
- ;print(nt)
- ;printVarSummary(PC1)
- pc1 = PC1(time|nt)
- pc2 = PC2(time|nt)
- ;printVarSummary(pc1)
- delete([/nt,month,YMD,time,iStrt,iLast/])
- iopt = 0 ; remove least squares linear trends from each
- ; series prior to tapering and computing spectra.
- jave = 7 ; Average 7 periodogram estimates using modified Daniell
- pct = 0.1 ; taper 10% of the data
- dof = specxy_anal (pc1,pc2,iopt,jave,pct)
- x = dof@frq
- y1 = dof@coher
- y2 = dof@phase
- nt = ind(y2 .lt. 0.)
- y2(nt) = y2(nt)+360.
- wks = gsn_open_wks("png", "cs")
- res1 = True
- res1@gsnFrame = False
- res1@trXLog = True
- res1@vpOn = True
- res1@vpXF = 0.1
- res1@vpYF = 0.65
- res1@vpWidthF = 0.8
- res1@vpHeightF = 0.5
- res1@xyComputeXMin = True
- res1@tmXTOn = False
- plot1 = gsn_csm_xy(wks, x, y1, res1)
- polyres = True
- polyres@gsLineDashPattern = 1
- gsn_polyline(wks, plot1, (/1/10.,1/10./), (/0,1./), polyres)
- gsn_polyline(wks, plot1, (/1/20.,1/20./), (/0,1./), polyres)
- gsn_polyline(wks, plot1, (/1/30.,1/30./), (/0,1./), polyres)
- gsn_polyline(wks, plot1, (/1/80.,1/80./), (/0,1./), polyres)
- res1@vpYF = 0.9
- res1@vpHeightF = 0.25
- res1@tmXBOn = False
- res1@tmXTOn = True
- res1@tmXTLabelsOn = True
- res1@tmYLOn = False
- res1@tmYROn = True
- res1@tmYRLabelsOn = True
- res1@tmYLMode = "Explicit"
- res1@tmYLValues = (/0,90,180,270,360/)
- res1@tmYLLabels = (/"0","90","180","270","360"/)
- res1@trYMaxF = 360.
- res1@tmXBMode = "Explicit"
- res1@tmXBValues = (/1/10.,1/20.,1/30.,1/80./)
- res1@tmXBLabels = (/"10d","20d","30d","80d"/)
- res1@trYMaxF = 360.
- plot2 = gsn_csm_xy(wks, x, y2, res1)
- gsn_polyline(wks, plot2, (/1/10.,1/10./), (/0,360./), polyres)
- gsn_polyline(wks, plot2, (/1/20.,1/20./), (/0,360./), polyres)
- gsn_polyline(wks, plot2, (/1/30.,1/30./), (/0,360./), polyres)
- gsn_polyline(wks, plot2, (/1/80.,1/80./), (/0,360./), polyres)
- frame(wks)
- end
复制代码
今天尝试着用NCL绘制两时间序列的交叉谱图,遇到了一些比较奇怪的问题,请大神帮助解答附件图中上下两幅图中的虚线为什么不能对应起来? |
-
|