- 积分
- 119
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-7-27
- 最后登录
- 1970-1-1
![未绑定新浪微博用户 新浪微博达人勋](source/plugin/sina_login/img/gray.png)
|
![](static/image/common//ico_lz.png)
楼主 |
发表于 2014-9-13 10:56:48
|
显示全部楼层
没有了,我刚查了一下,那个Warning应该是不算错误的,现在风场和旋度场都画出来了,但是那个colorbar的效果不是我想要的,我只想在所有图的最右边有一个竖着的就行,麻烦你帮忙看一下我的程序还有哪里可以添加的东西,谢谢!
;********************************************************
; Load NCL scripts
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl"
begin
;files = systemfunc("ls ./windstress*.nc") ;批量处理
; f =addfile("windstress01.nc","r") ;以只读方式打开一个文件
f0 =addfile("./soda_wind_curl.nc","r")
print(f0)
taux1 = f0->taux_mean(time|:,lat|:,lon|:)
tauy1 = f0->tauy_mean(time|:,lat|:,lon|:)
rota = f0->rota_mean(time|:,lat|:,lon|:)
rota=rota*1e3
if (any(isnan_ieee(rota))) then ;isnan_ieee返回包含ieee nan的数组
value = 1.e20
replace_ieeenan (rota, value, 0) ;该函数用于将nan值转换成用户指定的值 ;value是用于代替nan
rota@_FillValue = value
end if
printVarSummary(taux1)
lat =f0->lat
lon =f0->lon
lat@units = "degrees_north"
lon@units = "degrees_east"
taux1_mean=dim_avg_n_Wrap(taux1,0) ;求年平均
tauy1_mean=dim_avg_n_Wrap(tauy1,0)
rota_mean =dim_avg_n_Wrap(rota,0)
taux2 =dim_rmvmean_n_Wrap(taux1,0) ;直接是三维场时减去年平均
tauy2 =dim_rmvmean_n_Wrap(tauy1,0)
rota1 =dim_rmvmean_n_Wrap(rota,0)
taux1&lat@units = "degrees_north"
taux1&lon@units = "degrees_east"
tauy1&lat@units = "degrees_north"
tauy1&lon@units = "degrees_east"
rota&lat@units = "degrees_north"
rota&lon@units = "degrees_east"
taux2&lat@units = "degrees_north"
taux2&lon@units = "degrees_east"
tauy2&lat@units = "degrees_north"
tauy2&lon@units = "degrees_east"
rota1&lat@units = "degrees_north"
rota1&lon@units = "degrees_east"
printVarSummary(taux2)
delete(taux2@long_name)
delete(tauy2@long_name)
delete(rota1@long_name)
;******************************************
;---Graphics
wks1 = gsn_open_wks("ps","soda_wind_field_mon_mean_minus_annual_mean")
wks2 = gsn_open_wks("ps","wind_field_annual_mean")
gsn_define_colormap(wks1,"BlWhRe")
gsn_define_colormap(wks2,"Default")
vres = True
plot = new(12,graphic)
vres@gsnDraw = False
vres@gsnFrame = False
vres@gsnAddCyclic = False ;只有数据是全球的才需要设置成True
vres@vfXArray = lon
vres@vfYArray = lat
vres@sfXArray = lon
vres@sfYArray = lat
vres@cnFillOn = True ; turn on color for contours
vres@cnLinesOn = False ; turn off contour lines
vres@cnLineLabelsOn = False
vres@gsnScalarContour = True
vres@gsnSpreadColors = True
vres@mpMinLonF = 20.25
vres@mpMaxLonF = 120.75
vres@mpMinLatF = -33.75
vres@mpMaxLatF = 26.25
;*******设置contour的属性**********************************************************
vres@cnLevelSelectionMode ="ExplicitLevels" ;设置colorbar等距
; vres@cnMinLevelValF =-10
; vres@cnMaxLevelValF =10
; vres@cnLevelSpacingF =1
vres@cnLevels =(/-10,-8,-6,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.7,-0.4,-0.2,-0.1,0,0.1,0.2,0.4,0.7,1,1.5,2,2.5,3,3.5,4,6,8,10/)
;*******设置vector的属性***********************************************************
vres@vcRefMagnitudeF = 0.04 ;设置矢量标度
vres@vcRefLengthF = 0.02
vres@vcMinDistanceF =0.04 ; 设置向量的疏密
vres@vcRefAnnoOrthogonalPosF = -1.0
vres@vcLineArrowThicknessF =0.6
vres@vcFillArrowWidthF =0.02
vres@vcVectorDrawOrder = "PostDraw"
;******每个图形的大小***************************************************************
vres@vpHeightF =0.4
vres@vpWidthF =0.5
;******各图形坐标轴属性*************************************************************
vres@tmYRLabelsOn = False ; no right labels
vres@tmYROn = False ; no right tickmarks
vres@tmXTLabelsOn = False ; do not draw top labels
vres@tmXTOn = False
vres@tmXBOn = False
vres@tmXBLabelsOn = False
vres@tmXBOn = False
vres@tmYLLabelsOn = False
vres@tmYLOn = False
do i=0,1
plot(i+1)=gsn_csm_vector_scalar_map_ce(wks1,taux2(i+1,:,:),tauy2(i+1,:,:),rota1(i+1,:,:),vres)
plot(i+4)=gsn_csm_vector_scalar_map_ce(wks1,taux2(i+4,:,:),tauy2(i+1,:,:),rota1(i+4,:,:),vres)
plot(i+7)=gsn_csm_vector_scalar_map_ce(wks1,taux2(i+7,:,:),tauy2(i+1,:,:),rota1(i+7,:,:),vres)
end do
vres@tmYLOn =False
vres@tmXBOn =True
vres@tmXBLabelsOn =True
vres@tmXBMode ="Explicit"
vres@tmXBValues =(/25,40,55,70,85,100,115/)
vres@tmXBLabels =(/"25E","40E","55E","70E","85E","100E","115E"/)
do i=0,1
plot(i+10)=gsn_csm_vector_scalar_map_ce(wks1,taux2(i+10,:,:),tauy2(i+10,:,:),rota1(i+10,:,:),vres)
end do
vres@tmYLOn =True
vres@tmYLLabelsOn =True
vres@tmYLMode ="Explicit"
vres@tmYLValues =(/-33,-23,-13,-3,3,13,23/)
vres@tmYLLabels =(/"33S","23S","13S","3S","3N","13N","23N"/)
plot(9) =gsn_csm_vector_scalar_map_ce(wks1,taux2(9,:,:),tauy2(9,:,:),rota1(9,:,:),vres)
vres@tmXBOn =False
plot(0) =gsn_csm_vector_scalar_map_ce(wks1,taux2(0,:,:),tauy2(0,:,:),rota1(0,:,:),vres)
plot(3) =gsn_csm_vector_scalar_map_ce(wks1,taux2(3,:,:),tauy2(3,:,:),rota1(3,:,:),vres)
plot(6) =gsn_csm_vector_scalar_map_ce(wks1,taux2(6,:,:),tauy2(6,:,:),rota1(6,:,:),vres)
;panel plot ;所有图画在一张图上
pres =True
pres@gsnPanelFigureStrings= (/"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"/)
pres@amJust = "BottomLeft"
; pres@gsnPanelScalePlotIndex = 3
; pres@pmLabelBarOrthogonalPosF =0.005
pres@gsnPanelFigureStringsFontHeightF=0.01
pres@gsnPanelXWhiteSpacePercent =0.0
pres@gsnPanelYWhiteSpacePercent =0
pres@lbLabelBarOn =True
pres@lbOrientation ="Vertical"
pres@pmLabelBarHeightF =0.6
pres@lbLabelStride = 1
pres@gsnPanelScalePlotIndex = 7
pres@gsnPanelLeft = 0.1
pres@gsnPanelRight = 0.95
pres@txFontHeightF = 0.01
gsn_text_ndc(wks1,"x10~S~-2",0.93,0.91,pres)
gsn_panel(wks1,plot,(/4,3/),pres)
; res@tmXBOn =True
; res@lbLabelBarOn =True
plot2 =gsn_csm_vector_scalar_map_ce(wks2,taux1_mean,tauy1_mean,rota_mean,vres)
end
|
|