- 积分
- 2514
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-1-24
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2018-7-11 15:06:03
|
显示全部楼层
本帖最后由 板板板板转 于 2018-7-11 15:10 编辑
贴上部分程序如下
pre1 = new((/16,80,360/), float)
do i = 2001,2016
pre1(i-2001,:,:) = (pre(5+(i-2001)*12,:,:)+pre(6+(i-2001)*12,:,:)+pre(7+(i-2001)*12,:,:)+pre(8+(i-2001)*12,:,:))/4.0
end do
copy_VarMeta(pre(0,:,:),pre1(0,:,:))
pre1!0 = "year"
pre1&year = ispan(2001, 2016, 1)
comp1 = dim_avg_n_Wrap(pre1(:,:,:), 0)
pre2 = new((/22,80,360/), float)
do i = 1979,2000
pre2(i-1979,:,:) = (pre3(5+(i-1979)*12,:,:)+pre3(6+(i-1979)*12,:,:)+pre3(7+(i-1979)*12,:,:)+pre3(8+(i-1979)*12,:,:))/4.0
end do
copy_VarMeta(pre3(0,:,:),pre2(0,:,:))
pre2!0 = "year"
pre2&year = ispan(1979, 2000, 1)
comp2 = dim_avg_n_Wrap(pre2(:,:,:), 0)
comp = comp1 - comp2
copy_VarMeta(comp1, comp)
comp!0 = "lat"
comp&lat = pre3&latitude
comp!1 = "lon"
comp&lon = pre3&longitude
;输出为nc文件
;fout = addfile("comp.nc", "c")
;comp@units = "mm"
;fout->COMP = comp
;exit()
varX = dim_variance_n_Wrap(pre1(:,:,:), 0)
varY = dim_variance_n_Wrap(pre2(:,:,:), 0)
iflag = False
tval_opt = False
prob = ttest(comp1, varX, 15, comp2, varY, 21, iflag, tval_opt)
copy_VarMeta(pre3(0,:,:), prob(:,:))
wks = gsn_open_wks("png", "sstpart2")
gsn_define_colormap(wks,"BlueRed")
res = True
res@gsnAddCyclic = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnLeftString = ""
res@gsnRightString = ""
resc = res
;地图
res@mpFillOn = False
res@mpCenterLonF = 180
res@mpDataBaseVersion = "MediumRes" ; Medium resolution database
res@mpOutlineOn = True ; Turn on map outlines
res@mpProjection = "CylindricalEquidistant"
res@mpGeophysicalLineThicknessF = 0.75
res@pmTickMarkDisplayMode = "Always"
res@mpGridAndLimbOn = True
res@mpMaxLatF = 60
res@mpMaxLonF = 240
res@mpMinLatF = -20
res@mpMinLonF = 0
res@mpGridLatSpacingF = 15
res@mpGridLonSpacingF = 15
res@mpGridLineDashPattern = 2
res@mpGridLineThicknessF = 0.
res@gsnCenterString = "2001-2017 and 1979-2000 sst difference"
;显著性水平检验
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/0,0.1/)
;res@cnFillColors = (/"white","gray","white"/)
res@cnInfoLabelOn = False
res@lbLabelBarOn = False
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@cnFillDrawOrder="postDraw"
res@cnMonoFillPattern = False ; want multiple patterns
res@cnFillPatterns = (/-1,17,-1/) ; the patterns
res@cnMonoFillScale = False ; want different densities
res@cnFillScales = (/1,1,1/) ; change densities
res@cnMonoFillColor =True
res@cnFillDotSizeF = 0.00007
base = gsn_csm_contour_map(wks, prob, res)
;等值线
resc@cnLevelSelectionMode = "ExplicitLevels"
resc@cnLevels = (/-0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 /)
;resc@cnMinLevelValF = -8
resc@cnLinesOn = False
resc@cnFillOn = True
resc@cnLineThicknessF = 2 ;等值线粗细
resc@gsnContourZeroLineThicknessF = 3 ;不画0值线
resc@cnLineLabelsOn = False ;关闭等值线数值标签
;resc@cnLevelSpacingF = 10
;resc@cnLineDashPattern = 1
resc@cnInfoLabelOrthogonalPosF = 0.025 ;移动等值线信息标签的位置
resc@cnSmoothingOn = True
;resc@cnFillOpacityF = 0.7
resc@lbLabelBarOn = True
resc@lbOrientation = "Horizontal" ; vertical label bars
resc@lbLabelStride = 1 ; plot every other colar bar label
resc@pmLabelBarOrthogonalPosF = 0.2 ;调整色标垂直方向位置
plot = gsn_csm_contour(wks, comp, resc)
overlay(base, plot)
draw(base)
frame(wks)
end
|
|