- 积分
- 119
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-7-27
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2013-7-31 21:53:34
|
显示全部楼层
尽头的尽头 发表于 2013-7-31 21:49
帖完整的脚本吧,就这样没法帮你解决
begin
files = systemfunc("ls ./rota*.nc") ;批量处理
f0 =addfiles(files,"r") ;以只读方式打开一个文件
ListSetType (f0, "join")
rot =f0[:]->rota
rot!0 ="time"
; tem =lonFlip(tem0)
if (any(isnan_ieee(rot))) then ;isnan_ieee返回包含ieee nan的数组
value = 1.e20
replace_ieeenan (rot, value, 0) ;该函数用于将nan值转换成用户指定的值 ;value是用于代替nan
rot@_FillValue = value
end if
rot1 =rot(time|:,{lat|0:30},{lon|99:122})
rot1 =rot1*1e2
lat =f0[0]->lat
lon =f0[0]->lon
lat@units ="degrees_north"
lon@units ="degrees_east"
lat =rot1&lat
lon =rot1&lon
rot1_mean=dim_avg_n_Wrap(rot1,0) ;求年平均
rot2 =dim_rmvmean_n_Wrap(rot1,0) ;直接是三维场时减去年平均
print(rot2(0,0,:))
;printVarSummary(strf1) ;Prints a summary of a variable's information.
; strf1&lat =lat
; rot1&depth=dep
delete(rot2@long_name) ;去掉strf2中的属性long_name
printVarSummary(rot1)
;******************************************
;plot
wks1 =gsn_open_wks("ps","curl_mon_mean_minus_annual_mean00011")
; wks2 =gsn_open_wks("ps","curl_mean00011")
gsn_define_colormap(wks1,"ncl_default")
; gsn_define_colormap(wks2,"ncl_default")
res =True
plot =new(12,graphic)
; res@gsnDraw =False
; res@gsnFrame =False
; res@mpLimitMode ="LatLon"
; res@mpFillBoundarySets ="Geophysical"
res@mpFillDrawOrder = "PreDraw"
res@mpLandFillColor = "gray" ;加陆地边界
res@mpOutlineOn = True
res@gsnAddCyclic = False
res@mpMinLatF = 0
res@mpMaxLatF = 20
res@mpMinLonF = 99
res@mpMaxLonF = 122
res@cnLevelSelectionMode ="ManualLevels" ;设置colorbar等距
res@cnMinLevelValF =-1.6
res@cnMaxLevelValF =1.6
res@cnLevelSpacingF =0.1
res@cnInfoLabelFontHeightF =0.012
res@tmXBLabelFontHeightF =0.025
res@tmYLLabelFontHeightF =0.02
res@tmXBOn =False
res@tmYLOn =False ;y轴左边字符不开
res@tmXBLabelFontColor =1
res@tmYLLabelFontColor =1
res@lbLabelStride =1
res@lbLabelBarOn =False
res@lbOrientation ="Vertical";
res@vpHeightF =0.4
res@vpWidthF =0.5
res@cnFillOn =True
res@cnLinesOn =False
res@cnLineLabelsOn =False
res@cnInfoLabelOn =False
res@gsnSpreadColors=True
res@lbOrientation ="vertical"
res@gsnAddCyclic = False
res@sfXArray =lon
res@sfYArray =lat
res@gsnYAxisIrregular2Linear =True
res@trYReverse =False
do i=0,1
plot(i+1)=gsn_csm_contour(wks1,rot2(i+1,:,:),res)
plot(i+4)=gsn_csm_contour(wks1,rot2(i+4,:,:),res)
plot(i+7)=gsn_csm_contour(wks1,rot2(i+7,:,:),res)
end do
res@tmYLOn =False
res@tmXBOn =True
res@tmXBMode ="Explicit"
print(lat)
res@tmXBValues =(/100,105,110,115,120/)
res@tmXBLabels =(/"100E","105E","110E","115E","120E"/)
do i=0,1
plot(i+10)=gsn_csm_contour(wks1,rot2(i+10,:,:),res)
end do
res@tmYLOn =True
res@tmYLMode ="Explicit"
res@tmYLValues =(/3.0,6.0,9.0,12.0,15.0,18.0/)
res@tmYLLabels =(/"3N","6N","9N","12N","15N","18N"/)
plot(9) =gsn_csm_contour(wks1,rot2(9,:,:),res)
res@tmXBOn =False ;x轴下边字符不开
plot(0) =gsn_csm_contour(wks1,rot2(0,:,:),res)
plot(3) =gsn_csm_contour(wks1,rot2(3,:,:),res)
plot(6) =gsn_csm_contour(wks1,rot2(6,:,:),res)
;panel plot ;所有图画在一张图上
pres =True
pres@gsnPanelLabelBar =True
pres@gsnPanelFigureStrings= (/"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"/)
pres@amJust = "BottomLeft"
pres@pmLabelBarOrthogonalPosF =0.005
pres@gsnPanelFigureStringsFontHeightF=0.01
pres@gsnPanelXWhiteSpacePercent =0
pres@gsnPanelYWhiteSpacePercent =0
pres@lbLabelBarOn =True
pres@lbOrientation ="Vertical"
pres@pmLabelBarHeightF =0.8
pres@lbLabelStride = 3
; drawNDCGrid(wks1)
pres@txFontHeightF = 0.01
gsn_text_ndc(wks1,"x10~S~-2",0.97,0.91,pres)
gsn_panel(wks1,plot,(/4,3/),pres)
Trueend |
|