爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10723|回复: 1

NCL交叉谱

[复制链接]

新浪微博达人勋

发表于 2016-6-25 16:39:01 | 显示全部楼层 |阅读模式
1金钱
本帖最后由 rpf 于 2016-6-25 16:54 编辑
  1. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  2. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

  3. ymdStrt = 20080101
  4. ymdLast = 20101231

  5. begin

  6. filename = "/cygdrive/C/Users/Administrator/Desktop/Write_RMM.nc/MJO_PC_INDEX_BSISO_97-14.nc"
  7. f = addfile(filename, "r")
  8. time = f->time
  9. YMD = cd_calendar(time, -2)
  10. iStrt = ind(YMD .eq. ymdStrt)
  11. iLast = ind(YMD .eq. ymdLast)
  12. delete([/time,YMD/])
  13. PC1 = f->PC1(iStrt:iLast)
  14. PC2 = f->PC2(iStrt:iLast)
  15. time = f->time(iStrt:iLast)
  16. YMD = cd_calendar(time, 0)
  17. ;print(YMD)
  18. month = YMD(:,1)
  19. ;print(month)
  20. nt = ind(month .le. 10 .and. month .ge. 5)
  21. ;print(nt)
  22. ;printVarSummary(PC1)
  23. pc1 = PC1(time|nt)
  24. pc2 = PC2(time|nt)
  25. ;printVarSummary(pc1)
  26. delete([/nt,month,YMD,time,iStrt,iLast/])
  27. iopt = 0 ; remove least squares linear trends from each
  28. ; series prior to tapering and computing spectra.
  29. jave = 7 ; Average 7 periodogram estimates using modified Daniell
  30. pct = 0.1 ; taper 10% of the data
  31. dof = specxy_anal (pc1,pc2,iopt,jave,pct)
  32. x = dof@frq
  33. y1 = dof@coher
  34. y2 = dof@phase
  35. nt = ind(y2 .lt. 0.)
  36. y2(nt) = y2(nt)+360.

  37. wks = gsn_open_wks("png", "cs")
  38. res1 = True
  39. res1@gsnFrame = False
  40. res1@trXLog = True
  41. res1@vpOn = True
  42. res1@vpXF = 0.1
  43. res1@vpYF = 0.65
  44. res1@vpWidthF = 0.8
  45. res1@vpHeightF = 0.5
  46. res1@xyComputeXMin = True
  47. res1@tmXTOn = False

  48. plot1 = gsn_csm_xy(wks, x, y1, res1)

  49. polyres = True
  50. polyres@gsLineDashPattern = 1

  51. gsn_polyline(wks, plot1, (/1/10.,1/10./), (/0,1./), polyres)
  52. gsn_polyline(wks, plot1, (/1/20.,1/20./), (/0,1./), polyres)
  53. gsn_polyline(wks, plot1, (/1/30.,1/30./), (/0,1./), polyres)
  54. gsn_polyline(wks, plot1, (/1/80.,1/80./), (/0,1./), polyres)


  55. res1@vpYF = 0.9
  56. res1@vpHeightF = 0.25
  57. res1@tmXBOn = False
  58. res1@tmXTOn = True
  59. res1@tmXTLabelsOn = True
  60. res1@tmYLOn = False
  61. res1@tmYROn = True
  62. res1@tmYRLabelsOn = True

  63. res1@tmYLMode = "Explicit"
  64. res1@tmYLValues = (/0,90,180,270,360/)
  65. res1@tmYLLabels = (/"0","90","180","270","360"/)
  66. res1@trYMaxF = 360.

  67. res1@tmXBMode = "Explicit"
  68. res1@tmXBValues = (/1/10.,1/20.,1/30.,1/80./)
  69. res1@tmXBLabels = (/"10d","20d","30d","80d"/)

  70. res1@trYMaxF = 360.
  71. plot2 = gsn_csm_xy(wks, x, y2, res1)

  72. gsn_polyline(wks, plot2, (/1/10.,1/10./), (/0,360./), polyres)
  73. gsn_polyline(wks, plot2, (/1/20.,1/20./), (/0,360./), polyres)
  74. gsn_polyline(wks, plot2, (/1/30.,1/30./), (/0,360./), polyres)
  75. gsn_polyline(wks, plot2, (/1/80.,1/80./), (/0,360./), polyres)

  76. frame(wks)

  77. end
复制代码

今天尝试着用NCL绘制两时间序列的交叉谱图,遇到了一些比较奇怪的问题,请大神帮助解答附件图中上下两幅图中的虚线为什么不能对应起来?

cs.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-25 20:34:02 | 显示全部楼层
问题已自己解决,可惜了1现金{:shy:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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