爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3194|回复: 0

ncl对olr进行回归分析后图像参数设置问题

[复制链接]

新浪微博达人勋

发表于 2022-4-25 10:55:12 | 显示全部楼层 |阅读模式
6金钱
用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


7.png
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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