用ncl自带的回归函数regCoef_n计算之后设置了图像的res@cnLevels和res@cnFillColors,但总是提示维度不匹配“Dimension size of attribute and right-hand side of assignment do not match”,这是什么原因呢?向各位大佬请教,感激不尽!
程序如下:
begin
f1 = addfile("/home/mars/Liubs/10-20olrAvg10-11.nc","r")
x = f1->olr
;print(x)
f2 = addfile("/home/mars/Liubs/lunwen/processing data/10-20olr.nc","r")
time = (f2->time)
time@units = "hours since 1800-01-01 00:00:0.0"
; Convert to UTC time.
time_ut = cd_calendar(time,0)
; Store return information into more meaningful variables.
;year = time_ut(:,0) ; Convert to integer for
month = time_ut(:,1) ; Convert to integer for
; print(year)
indtime = ind((month.ge.10).and.(month.le.11))
y = f2->olr(indtime,:,:)
rc = regCoef_n(x, y, 0, 0) ; rc(nlat,mlon)
;print(rc)
rc!0 = "lat" ; name dimensions
rc!1 = "lon"
rc&lat = y&lat ; assign coordinate values to named dimensions
rc&lon = y&lon
tval = onedtond(rc@tval , dimsizes(rc))
tval@FillValue= -9.96921e+36
tval!0 = "lat" ; name dimensions
tval!1 = "lon"
tval&lat = y&lat
tval&lon = y&lon
tval = onedtond(rc@tval , dimsizes(rc)) ;t-statistic
df = onedtond(rc@nptxy, dimsizes(rc)) - 2 ;自由度
b = tval ; b must be same size as tval (and df)
b = 0.5 ; b must be same size as tval (and df)
prob = betainc(df/(df+tval^2),df/2.0,b)
prob!0 = "lat" ; name dimensions
prob!1 = "lon"
prob&lat = y&lat
prob&lon = y&lon ; assign coordinate values to named dimensions
;print (prob)
rc@long_name = "regression coefficient"
prob@long_name = "probability"
wks = gsn_open_wks ("png", " regression olr10-20Oct-Nov-1")
res = True
res@gsnAddCyclic = False
res@gsnLeftString = "olr10-20-rc"
res@gsnRightString = ""
res@tiYAxisString = ""
res@tiMainString = "Oct-Nov"
res@cnFillOn = True
;res@cnFillMode = "AreaFill"
res@cnFillPalette = "CBR_wet"
res@cnFillColors = True
res@cnMonoFillColor = False
res@cnLinesOn = False
;res@cnLineThicknessF = 2
res@cnLineLabelsOn = False
res@mpMinLatF = 0
res@mpMaxLatF = 50
res@mpMinLonF = 100
res@mpMaxLonF = 180
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/0.01,0.05,0.1,0.3,0.5,0.7,0.9/) ;; set to significance level
res@cnFillColors = (/2,4,6,7,8,9,10,12/)
plot = gsn_csm_contour_map(wks,prob, res)
end