爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
楼主: 天玖Y

[作图] 回归分析

[复制链接]

新浪微博达人勋

发表于 2016-1-20 19:01:48 | 显示全部楼层
这种回归场的图中等值线是回归系数吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-1-21 09:17:23 | 显示全部楼层
Pai 发表于 2016-1-20 19:01
这种回归场的图中等值线是回归系数吗?

是的,是回归系数
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-4-20 10:56:00 | 显示全部楼层
天玖Y 发表于 2016-1-21 09:17
是的,是回归系数

请问楼主做的时候是不是对指数标准化,但是海温没有标准化?还有您有没有和指数和海温的相关作比较?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-4-21 08:04:09 | 显示全部楼层
subtropical 发表于 2016-4-20 10:56
请问楼主做的时候是不是对指数标准化,但是海温没有标准化?还有您有没有和指数和海温的相关作比较?

指数是标准化的  海温没有~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-4-21 14:49:43 | 显示全部楼层
天玖Y 发表于 2016-4-21 08:04
指数是标准化的  海温没有~

好的,谢谢您
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-10-4 10:02:55 | 显示全部楼层
楼主可不可以贴一下代码,分享一下经验,谢谢
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-9-1 08:56:08 | 显示全部楼层
楼主求代码 最近正要学习回归分析相关分析
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-10-6 05:14:00 | 显示全部楼层
zongqing123 发表于 2016-10-4 10:02
楼主可不可以贴一下代码,分享一下经验,谢谢

;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
time=45
nx=360
ny=180
;missing_value=-1.0E+30
lat = fspan(-89.5,89.5,180)
lon = fspan(-179.5,179.5,360)
lat@units = "degrees_north"
lon@units = "degrees_east"

x=fbindirread("/cygdrive/d/YYW/nino34/winter-nor/acc.grd",0,(/time/),"float")

x!0="time"
                      ;std_f=stddev(f)
                      ;print(std_f)   ;计算年际标准差
y=fbindirread("/cygdrive/d/YYW/regression/sst/ACCESM1-0.grd",0,(/time,ny,nx/),"float")
y!0="time"
y!1="lat"
y!2="lon"
y&lat=lat
y&lon=lon
;printVarSummary(y)   


rc = regCoef(x, y(lat|:,lon|:,time|:) )   ;交换维数,使最右维与x的最右维相同
rc!0   = "lat"    ; name dimensions
rc!1   = "lon"
rc&lat = y&lat   ; assign coordinate values to named dimensions
rc&lon = y&lon
;printVarSummary(rc)           ; variable overview
;rc@long_name   = "regression coefficient"

fout2="rc-ACCESM1-0.grd"
fbinrecwrite(fout2,-1,(/rc/))

tval = onedtond(rc@tval , dimsizes(rc))   ;t-statistic
;printVarSummary(tval)
tval@FillValue= 9.96921e+36
tval!0   = "lat"    ; name dimensions
tval!1   = "lon"
tval&lat = y&lat   ; assign coordinate values to named dimensions
tval&lon = y&lon
tval@long_name = "probability"

;fout="111.txt"
;asciiwrite(fout,(/tval/))
fout="t-ACCESM1-0.grd"
fbinrecwrite(fout,-1,(/tval/))

wks = gsn_open_wks("png","ACCESM1-0")
gsn_define_colormap(wks,"bluered")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnInfoLabelOn = False
res@cnFillOn = False
res@cnLinesOn = True
res@cnLineLabelsOn = False
;res@gsnSpreadColors = True
res@lbLabelBarOn = False
res@tiMainString = ""
res@gsnRightString = ""
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = -0.6
res@cnMaxLevelValF = 2.4
res@cnLevelSpacingF = 0.3
;res@mpCenterLonF = 180
res@gsnContourNegLineDashPattern=1
res@gsnContourZeroLineThicknessF=3
res@gsnAddCyclic=False

plot1 = gsn_csm_contour(wks,rc,res)

res2 = True
res2@cnFillOn = True
res2@cnLinesOn = False
;res2@mpCenterLonF = 180
res2@gsnDraw         = False                      ; do not draw  
res2@gsnFrame        = False                      ; do not advance frame
res2@gsnMaximize           = True

res2@mpCenterLonF         = 120.               ; center plot at 180
  res2@mpMinLonF            = -60.               ; select a subregion
  res2@mpMaxLonF            = 300.
  res2@mpMinLatF            = -70.
  res2@mpMaxLatF            =  60.

;res2@cnMonoFillPattern = False

;res2@cnLevelSelectionMode  = "ManualLevels"   ; set manual contour levels
;res2@cnMinLevelValF        = 0.1         ; set min contour level
;res2@cnMaxLevelValF        = 5.         ; set max contour level
;res2@cnLevelSpacingF       = 1.          ; set contour interval

res2@lbLabelBarOn= True
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/-2.02,2.02/)     ;; set to significance level
res2@cnFillColors =(/35,0,207/)
res2@gsnLeftString = ""
res2@mpFillDrawOrder= "PostDraw"

plot3 = gsn_csm_contour_map(wks,tval,res2)

overlay(plot3,plot1)
draw(plot3)
frame(wks)

end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-10-6 05:14:20 | 显示全部楼层
kathleen825 发表于 2017-9-1 08:56
楼主求代码 最近正要学习回归分析相关分析

;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
time=45
nx=360
ny=180
;missing_value=-1.0E+30
lat = fspan(-89.5,89.5,180)
lon = fspan(-179.5,179.5,360)
lat@units = "degrees_north"
lon@units = "degrees_east"

x=fbindirread("/cygdrive/d/YYW/nino34/winter-nor/acc.grd",0,(/time/),"float")

x!0="time"
                      ;std_f=stddev(f)
                      ;print(std_f)   ;计算年际标准差
y=fbindirread("/cygdrive/d/YYW/regression/sst/ACCESM1-0.grd",0,(/time,ny,nx/),"float")
y!0="time"
y!1="lat"
y!2="lon"
y&lat=lat
y&lon=lon
;printVarSummary(y)   


rc = regCoef(x, y(lat|:,lon|:,time|:) )   ;交换维数,使最右维与x的最右维相同
rc!0   = "lat"    ; name dimensions
rc!1   = "lon"
rc&lat = y&lat   ; assign coordinate values to named dimensions
rc&lon = y&lon
;printVarSummary(rc)           ; variable overview
;rc@long_name   = "regression coefficient"

fout2="rc-ACCESM1-0.grd"
fbinrecwrite(fout2,-1,(/rc/))

tval = onedtond(rc@tval , dimsizes(rc))   ;t-statistic
;printVarSummary(tval)
tval@FillValue= 9.96921e+36
tval!0   = "lat"    ; name dimensions
tval!1   = "lon"
tval&lat = y&lat   ; assign coordinate values to named dimensions
tval&lon = y&lon
tval@long_name = "probability"

;fout="111.txt"
;asciiwrite(fout,(/tval/))
fout="t-ACCESM1-0.grd"
fbinrecwrite(fout,-1,(/tval/))

wks = gsn_open_wks("png","ACCESM1-0")
gsn_define_colormap(wks,"bluered")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnInfoLabelOn = False
res@cnFillOn = False
res@cnLinesOn = True
res@cnLineLabelsOn = False
;res@gsnSpreadColors = True
res@lbLabelBarOn = False
res@tiMainString = ""
res@gsnRightString = ""
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = -0.6
res@cnMaxLevelValF = 2.4
res@cnLevelSpacingF = 0.3
;res@mpCenterLonF = 180
res@gsnContourNegLineDashPattern=1
res@gsnContourZeroLineThicknessF=3
res@gsnAddCyclic=False

plot1 = gsn_csm_contour(wks,rc,res)

res2 = True
res2@cnFillOn = True
res2@cnLinesOn = False
;res2@mpCenterLonF = 180
res2@gsnDraw         = False                      ; do not draw  
res2@gsnFrame        = False                      ; do not advance frame
res2@gsnMaximize           = True

res2@mpCenterLonF         = 120.               ; center plot at 180
  res2@mpMinLonF            = -60.               ; select a subregion
  res2@mpMaxLonF            = 300.
  res2@mpMinLatF            = -70.
  res2@mpMaxLatF            =  60.

;res2@cnMonoFillPattern = False

;res2@cnLevelSelectionMode  = "ManualLevels"   ; set manual contour levels
;res2@cnMinLevelValF        = 0.1         ; set min contour level
;res2@cnMaxLevelValF        = 5.         ; set max contour level
;res2@cnLevelSpacingF       = 1.          ; set contour interval

res2@lbLabelBarOn= True
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = (/-2.02,2.02/)     ;; set to significance level
res2@cnFillColors =(/35,0,207/)
res2@gsnLeftString = ""
res2@mpFillDrawOrder= "PostDraw"

plot3 = gsn_csm_contour_map(wks,tval,res2)

overlay(plot3,plot1)
draw(plot3)
frame(wks)

end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-17 16:04:50 | 显示全部楼层
碰到和你一样的问题,学习到了,现在正需要,非常感谢啦!
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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