爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5203|回复: 1

[作图] 为啥经纬度显示有问题呢

[复制链接]

新浪微博达人勋

发表于 2019-4-22 10:17:42 | 显示全部楼层 |阅读模式

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

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

x
  1. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  2. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
  3. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
  4. begin

  5. ;;;;;;;;;;;;;;;500hPa合成分析;;;;;;;;;
  6. ;;;;;;;;;;;;;;;弱:1913—1926,强1930--1950;;;;;;;;
  7. f=addfile("/home/a2/hgt500.qihoutai.1920_1949.nc","r")
  8. hgt=f->sst
  9. f0=addfile("/home/a2/H.hgt500.1930_1950.nc","r")
  10. hgth=f0->sst
  11. f1=addfile("/home/a2/L.hgt500.1913_1926.nc","r")
  12. hgtl=f1->sst

  13. ;;;;;;;;合成;;;;;;
  14. avel=dim_avg_n_Wrap(hgtl,0)
  15. aveh=dim_avg_n_Wrap(hgth,0)
  16. cha=new((/91,180/),float)
  17. do j=0,179
  18. do i=0,90
  19. cha(i,j)=aveh(i,j)-avel(i,j)
  20. end do
  21. end do
  22. aveh!0="lat"
  23. aveh!1="lon"
  24. aveh&lat=fspan(-90,90,91)
  25. aveh&lon=fspan(0,358,180)
  26. avel!0="lat"
  27. avel!1="lon"
  28. avel&lat=fspan(-90,90,91)
  29. avel&lon=fspan(0,358,180)
  30. cha!0="lat"
  31. cha!1="lon"
  32. cha&lat=fspan(-90,90,91)
  33. cha&lon=fspan(0,358,180)
  34. hgt!0="lat"
  35. hgt!1="lon"
  36. hgt&lat=fspan(-90,90,91)
  37. hgt&lon=fspan(0,358,180)

  38. ;;;;;;;;;;合成分析显著性检验;;;;;;;
  39. ;;;;;0.05检验临界为2.035;;;;
  40. varh=dim_variance_n_Wrap(hgth,0)
  41. varl=dim_variance_n_Wrap(hgtl,0)
  42. vah=where(varh.eq.0,varh@_FillValue,varh)
  43. val=where(varl.eq.0,varl@_FillValue,varl)
  44. nl=14.
  45. nh=21.
  46. n=nl+nh-2.
  47. t=new((/91,180/),float)
  48. do j=0,179
  49. do i=0,90
  50. t(i,j)=(cha(i,j)/(sqrt(((nh-1)*vah(i,j)+(nl-1)*val(i,j))/n)))/(sqrt(1./nl+1./nh))
  51. end do
  52. end do
  53. t!0="lat"
  54. t!1="lon"
  55. t&lat=fspan(-90.,90.,91)
  56. t&lon=fspan(0.,358.,180)

  57. ;;;;;;;;;;;;;;;绘图;;;;;;;
  58. wks = gsn_open_wks("pdf","hgt500_hc")
  59. plot=new(4,graphic)
  60. gsn_define_colormap(wks,"BlueDarkRed18")
  61. res = True
  62. res@gsnDraw=False
  63. res@gsnFrame = False
  64. res@gsnAddCyclic = True
  65. res@cnFillOn = False
  66. res@pmTickMarkDisplayMode = "Always"
  67. res@gsnLeftString = ""
  68. res@gsnRightString = ""
  69. res@mpCenterLonF = 180
  70. res@mpFillOn= True
  71. res@cnLineLabelsOn = True
  72. res@cnLineLabelBackgroundColor = "-1"
  73. res@mpGridAndLimbOn = False
  74. ;res@mpGridSpacingF = 10
  75. ;res@mpGridLineThicknessF = 0.2
  76. res@gsnMaximize = True

  77. ;;;;;;;;;;;;气候态图;;;;
  78. res1 = res
  79. res1@cnLevelSelectionMode="ManualLevels"
  80. ;res1@cnLinesOn = False
  81. res1@cnMinLevelValF = 400
  82. res1@cnMaxLevelValF = 600
  83. res1@cnLevelSpacingF = 4
  84. ;res1@gsnSpreadColorStart = 4
  85. res1@gsnContourNegLineDashPattern = 2
  86. res1@gsnContourPosLineDashPattern = 0
  87. plot(0)=gsn_csm_contour_map(wks,hgt/10,res1)

  88. ;;;;;;;;;;;;高
  89. res2=res
  90. res2@cnLevelSelectionMode="ManualLevels"
  91. ;res2@cnLinesOn = False
  92. res2@cnMinLevelValF = -3
  93. res2@cnMaxLevelValF = 3
  94. res2@cnLevelSpacingF = .3
  95. ;res2@gsnSpreadColorStart = 4
  96. res2@gsnContourNegLineDashPattern = 2
  97. res2@gsnContourPosLineDashPattern = 0
  98. plot(1)=gsn_csm_contour_map(wks,aveh/10,res2)

  99. ;;;;;;;;;低;;;;;;;;;
  100. res3=res
  101. res3@cnLevelSelectionMode="ManualLevels"
  102. ;res3@cnLinesOn = False
  103. res3@cnMinLevelValF = -3
  104. res3@cnMaxLevelValF = 3
  105. res3@cnLevelSpacingF = .5
  106. ;res3@gsnSpreadColorStart = 4
  107. res3@gsnContourNegLineDashPattern = 2
  108. res3@gsnContourPosLineDashPattern = 0
  109. plot(2)=gsn_csm_contour_map(wks,avel/10,res3)

  110. ;;;;;;;;;;检验+差;;;;
  111. opt=True
  112. opt@gsnDraw=False
  113. opt@gsnFrame = False

  114. opt@gsnLeftString = ""
  115. opt@gsnRightString = ""
  116. opt@gsnMaximize = True

  117. iopt=opt
  118. opt@gsnAddCyclic = True
  119. opt@mpFillOn= True
  120. opt@mpCenterLonF = 180
  121. opt@pmTickMarkDisplayMode = "Always"
  122. opt@cnFillOn = False
  123. opt@cnLinesOn = False
  124. opt@cnLineLabelsOn=False
  125. opt@cnInfoLabelOn = False
  126. opt@cnLevelSelectionMode="ExplicitLevels"
  127. opt@cnLevels = (/2.035,2.0351,2.0352,2.4,2.5,2.6,3/)
  128. plot(3)=gsn_csm_contour_map(wks,t,opt) ;检验图
  129. op= True
  130. op@gsnShadeFillType = "pattern"
  131. op@gsnShadeHigh = 17
  132. plot(3)=gsn_contour_shade(plot(3),-999.,2.035,op) ;0.05
  133. cha1=new((/91,180/),float)
  134. do j=0,89
  135. do i=0,90
  136. cha1(i,j+90)=cha(i,j)
  137. end do
  138. end do
  139. do j=90,179
  140. do i=0,90
  141. cha1(i,j-90)=cha(i,j)
  142. end do
  143. end do
  144. cha1!0="lat"
  145. cha1!1="lon"
  146. cha1&lat=fspan(-90,90,91)
  147. cha1&lon=fspan(0.,358.,180)
  148. iopt@gsnAddCyclic = True
  149. iopt@gsnShape = True
  150. iopt@pmTickMarkDisplayMode = "Always"
  151. iopt@cnLevelSelectionMode="ManualLevels"
  152. iopt@cnMinLevelValF = -3
  153. iopt@cnMaxLevelValF = 3
  154. iopt@cnLevelSpacingF = 0.5
  155. iopt@gsnContourNegLineDashPattern = 2
  156. iopt@gsnContourPosLineDashPattern = 0
  157. iopt@cnFillOn = False
  158. iopt@cnLinesOn = True
  159. iopt@cnLineLabelsOn=True
  160. iopt@cnLineLabelBackgroundColor = "-1"
  161. iopt@tmYLMode = "Explicit"
  162. iopt@tmYLValues = (/-90,-45,0,45,90/)
  163. iopt@tmYLLabels = (/"90~S~o~N~S","45~S~o~N~S","0","45~S~o~N~N","90~S~o~N~N"/)
  164. iopt@tmXBMode = "Explicit"
  165. iopt@tmXBValues = (/0,90,180,270/)
  166. iopt@tmXBLabels = (/"0","90~S~o~N~E","180","90~S~o~N~W"/)
  167. plo=gsn_csm_contour(wks,cha1/10,iopt)
  168. wks6 = gsn_open_wks("pdf","hgtyy500_hc")
  169. p=gsn_csm_contour(wks6,cha1/10,iopt)
  170. draw(p)
  171. frame(wks6)
  172. overlay(plot(3),plo)
  173. draw(plot(3))
  174. frame(wks)


  175. ;;;;;;;;;;;组图
  176. resP= True
  177. resP@gsnPanelRowSpec = True
  178. resP@gsnPanelFigureStrings=(/"(a)","(b)","(c)","(d)"/)
  179. resP@gsnPanelFigureStringsBackgroundFillColor = "-1"
  180. resP@gsnPanelFigureStringsPerimOn = False
  181. resP@gsnPanelFigureStringsFontHeightF = 0.015
  182. resP@amJust = "BottomLeft"
  183. resP@gsnPanelXWhiteSpacePercent = 0.2
  184. resP@gsnPanelYWhiteSpacePercent = 0.2
  185. ; resP@gsnPanelLabelBar = True
  186. ; resP@pmLabelBarHeightF = 0.08
  187. ; resP@gsnSpreadColorStart =1
  188. gsn_panel(wks,plot,(/2,2/),resP)




  189. end
复制代码

捕获55555.JPG
捕获222.JPG
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-4-22 10:20:05 | 显示全部楼层
合成分析,为啥全球的数据只显示在0-90°N,0-180°E呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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