- 积分
- 1029
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-2-3
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
各位大佬们能不能帮忙分析一下,我画站点降水和时间系数的相关图,所有的图都只显示一部分
附上程序:
begin
load "./shapefile_utils.ncl"
ntime=63
eof_ts = asciiread("100ts1.txt",(/ntime/),"float")
;读取梅雨数据
data = asciiread("time.txt", -1, "string")
year = tointeger(str_get_field(data,1,","))
into_month0 = tointeger(str_get_field(data,2,","))
into_day0 = tointeger(str_get_field(data,3,","))
out_month0 = tointeger(str_get_field(data,4,","))
out_day0 = tointeger(str_get_field(data,5,","))
f = addfile("P.nc", "r")
precip =f->precip
lon=f->lon
lat=f->lat
;按年份读取梅雨期数据
precip = where(precip.gt.30000,0.0,precip)
; 范围
time = ispan(1951,2013,1)
prenew = new((/dimsizes(time),430/),float)
do j=0,429
do i = 0,dimsizes(time)-1
idstart = ind(precip(j,:,0).eq.time(i).and.precip(j,:,1).eq.into_month0(time(i)-1951).and.precip(j,:,2).eq.into_day0(time(i)-1951))
idend = ind(precip(j,:,0).eq.time(i).and.precip(j,:,1).eq.out_month0(time(i)-1951).and.precip(j,:,2).eq.out_day0(time(i)-1951))
prenew@_FillValue=0
prenew(i,j) =sum(precip(j,idstart:idend,5))
end do
end do
prenew!0="time"
prenew!1="sta"
printVarSummary(prenew)
;precip = where(precip.eq.(32766.or.32700.or.31001.or.31007.or.31025),32766,precip)
ccr = escorc(eof_ts,prenew(sta|:,time|:))
Nr= 63
xzx=0.05
tt=rtest(ccr,Nr,0)
;-------------------------interpolrtion-----------------------
olon = new(150,"float");
olat = new(60,"float");
do i=0,149
olon(i) = 110 + 0.1*i
end do
do l=0,59
olat(l) = 28 + 0.1*l
end do
printVarSummary(lon)
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees-east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
rscan = (/5,2,1/)
eofnew = new((/60,150/),float)
sname = "bou1_4p.shp"
shp_filename = sname
eofnew1 = shapefile_mask_data(obj_anal_ic_Wrap(lon,lat,ccr(:),olon,olat,rscan, False),shp_filename,False)
printVarSummary(eofnew1)
;eofnew2 = shapefile_mask_data(obj_anal_ic_Wrap(lon,lat,tt(:),olon,olat,rscan, False),shp_filename,False)
eofnew1@_FillValue=32766
;*********************************************
; 画图(回归系数画填色图)
;*********************************************
res = True
res@mpMinLatF = min(eofnew1&lat)
res@mpMaxLatF = max(eofnew1&lat)
res@mpMinLonF = min(eofnew1&lon)
res@mpMaxLonF = max(eofnew1&lon)
wks = gsn_open_wks("png","sj1")
;gsn_define_colormap(wks,"10colors(2)") ;用调色板输出色标
gsn_define_colormap(wks,"rainbow");默认的彩虹
;-------------------底图填色(该设置一样要放在画图设置的最前面)----------------
res@gsnDraw = False ; do not draw the plot
res@gsnFrame = False ; do not advance the frame
res@mpFillOn = True
res@mpLandFillColor = "White"
res@cnMissingValFillColor = "White"
res@mpFillDrawOrder="PreDraw"
;-----------------------------------------------------------
res@mpOutlineOn = True ; turn the map outline on
;res@mpFillOn = True ;给底图填色,新版默认为灰色
;res@mpFillColor = "gray"
;res@cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour levels
;res@cnLevels =(/-3.6,-3.2,-2.8,-2.4,-2,-1.6,-1.2,-0.8,-0.4,0,0.4,0.6,0.8,1.2,1.6,2/)
res@cnFillPalette = "MPL_bwr"
; res@cnFillColors=(/45,49,53,57,61,65,69,73,77,81/)
res@cnLevelSelectionMode = "Manuallevels"
;res@cnMinLevelValF=-0.6
;res@cnMaxLevelValF=0.8
;res@cnLevelSpacingF=0.2
res@cnLineLabelsOn = False ; do not use line labels
res@cnFillOn = True ; color fill
res@cnLinesOn = False ; do not draw contour lines
;res@cnLevelSpacingF = 0.1
;res@cnFillPalette = "BlueDarkRed18"
res@mpCenterLonF = 180
res@tiMainString = "Correlation between SST and PC(40 years rain average)(test)" ; 设置主标题(test)
res@gsnLeftString = "" ; 设置左副标题
res@gsnRightString = "" ; 设置右副标题
plot1=gsn_csm_contour_map_ce(wks,eofnew1(:,:),res) ; create the temperature plot
;**********************************************
; 检验地区打点
;**********************************************
;0.05信度显著性检验
sres = True ; set up a second resource list
sres@gsnDraw = False ; do not draw the plot
sres@gsnFrame = False ; do not advance the frame
sres@cnLineLabelsOn = False ; do not use line labels
sres@cnLinesOn = False ; do not draw contour lines
sres@cnInfoLabelOn = False
sres@cnFillOn = False ; color fill
sres@lbLabelBarOn = False
sres@cnInfoLabelOn = False
sres@cnFillDotSizeF = 0.005
opt1=True
opt1@gsnShadeFillType = "pattern"
opt1@gsnShadeMid = 17
;ccr_test = where(eofnew2.le.xzx, eofnew1, eofnew1@_FillValue)
; print(ccr_test)
;copy_VarMeta(eofnew1(:,:), ccr_test(:,:))
; ccr_max = max(ccr_test)
; ccr_min = min(ccr_test)
;plot2 = gsn_csm_contour(wks,ccr_test(:,:),sres)
;plot2 = gsn_contour_shade(plot2,ccr_min,ccr_max,opt1) ;α=0.05 ;overlay(plot1,plot2)
draw(plot1)
frame(wks)
end |
|