- 积分
- 816
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-6-18
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想画个剖面图,出错,以前也画过好像没有问题。不过这次的是时间剖面图。有高手帮忙看看怎么回事吗?脚本如下:
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
lat1=30
lon1=90
lat2=35
lon2=100
lat3=40
lon3=120
lat4=50
lon4=135
for_shixiao_1=24
for_shixiao_2=36
for_shixiao_3=60
for_shixiao_4=120
levels_choosed=7
points=4
day="2016120700"
pltType="png"
year=str_get_cols(day,0,3)
month=str_get_cols(day,4,5)
days=str_get_cols(day,6,7)
hours=str_get_cols(day,8,9)
diri="/fs01/home/climate/INTERP/data/global_atmo/ToGRIB025/"
pltDir=diri+day+"/"
strT=new(points,string)
U_points_isbls=new((/points,26/),float)
V_points_isbls=new((/points,26/),float)
RH_points_isbls=new((/points,26/),float)
TIME=new(points,"integer")
U_points_isbls_7lels=new((/points,7/),float)
V_points_isbls_7lels=new((/points,7/),float)
RH_points_isbls_7lels=new((/points,7/),float)
UV=new((/points,7/),float)
do ss=1,points
if(ss.eq.1)then
for_shixiao=for_shixiao_1
lat_o=lat1
lon_o=lon1
TIME((ss-1):(ss-1))=for_shixiao_1
end if
if(ss.eq.2)then
for_shixiao=for_shixiao_2
lat_o=lat2
lon_o=lon2
TIME((ss-1):(ss-1))=for_shixiao_2
end if
if(ss.eq.3)then
for_shixiao=for_shixiao_3
lat_o=lat3
lon_o=lon3
TIME((ss-1):(ss-1))=for_shixiao_3
end if
if(ss.eq.4)then
for_shixiao=for_shixiao_4
lat_o=lat4
lon_o=lon4
TIME((ss-1):(ss-1))=for_shixiao_4
end if
do n=0,points-1,1
strT(n)=str_concat(tostring(TIME(n)))
end do
print(strT)
if(for_shixiao.lt.10)then
shixiao_biaoshi2="00"+tostring(for_shixiao)
end if
if(for_shixiao.lt.100 .and. for_shixiao.gt.10)then
shixiao_biaoshi2="0"+tostring(for_shixiao)
end if
if(for_shixiao.gt.100)then
shixiao_biaoshi2=tostring(for_shixiao)
end if
fils_u = systemfunc ("ls "+diri+day+"/HTUUG*"+shixiao_biaoshi2+".grb") ;
fils_v = systemfunc ("ls "+diri+day+"/HTVVG*"+shixiao_biaoshi2+".grb")
fils_rh = systemfunc ("ls "+diri+day+"/HTRHG*"+shixiao_biaoshi2+".grb")
currentFile_u=addfile(fils_u,"r")
currentFile_v=addfile(fils_v,"r")
currentFile_rh=addfile(fils_rh,"r")
lv_ISBL0=currentFile_u->lv_ISBL0
U_GRD_3_ISBL=short2flt(currentFile_u->U_GRD_3_ISBL)
V_GRD_3_ISBL=short2flt(currentFile_v->V_GRD_3_ISBL)
RH_GRD_3_ISBL=short2flt(currentFile_rh->R_H_3_ISBL)
lat=currentFile_u->lat_3
lon=currentFile_u->lon_3
U_points_isbl=ndtooned(U_GRD_3_ISBL({lv_ISBL0|:},{lat_3|lat_o:lat_o},{lon_3|lon_o:lon_o}))
V_points_isbl=ndtooned(V_GRD_3_ISBL({lv_ISBL0|:},{lat_3|lat_o:lat_o},{lon_3|lon_o:lon_o}))
RH_points_isbl=ndtooned(RH_GRD_3_ISBL({lv_ISBL0|:},{lat_3|lat_o:lat_o},{lon_3|lon_o:lon_o}))
dim_u=dimsizes(U_points_isbl)
U_points_isbls((ss-1):(ss-1),:)=onedtond(U_points_isbl,(/1,dim_u/))
V_points_isbls((ss-1):(ss-1),:)=onedtond(V_points_isbl,(/1,dim_u/))
RH_points_isbls((ss-1):(ss-1),:)=onedtond(RH_points_isbl,(/1,dim_u/))
end do
TIME@units="hours since "+year+"-"+month+"-"+days+" "+hours+":00:00"
date_fore=ut_calendar(TIME,-3)
U_points_isbls!0="time"
U_points_isbls!1="level"
U_points_isbls&time=date_fore
U_points_isbls&level=lv_ISBL0
copy_VarCoords(U_points_isbls,V_points_isbls)
copy_VarCoords(U_points_isbls,RH_points_isbls)
U_points_isbls_7lels(:,0:0)=U_points_isbls({time|:},{level|1000:1000})
U_points_isbls_7lels(:,1:1)=U_points_isbls({time|:},{level|925:925})
U_points_isbls_7lels(:,2:2)=U_points_isbls({time|:},{level|850:850})
U_points_isbls_7lels(:,3:3)=U_points_isbls({time|:},{level|700:700})
U_points_isbls_7lels(:,4:4)=U_points_isbls({time|:},{level|500:500})
U_points_isbls_7lels(:,5:5)=U_points_isbls({time|:},{level|300:300})
U_points_isbls_7lels(:,6:6)=U_points_isbls({time|:},{level|100:100})
V_points_isbls_7lels(:,0:0)=V_points_isbls({time|:},{level|1000:1000})
V_points_isbls_7lels(:,1:1)=V_points_isbls({time|:},{level|925:925})
V_points_isbls_7lels(:,2:2)=V_points_isbls({time|:},{level|850:850})
V_points_isbls_7lels(:,3:3)=V_points_isbls({time|:},{level|700:700})
V_points_isbls_7lels(:,4:4)=V_points_isbls({time|:},{level|500:500})
V_points_isbls_7lels(:,5:5)=V_points_isbls({time|:},{level|300:300})
V_points_isbls_7lels(:,6:6)=V_points_isbls({time|:},{level|100:100})
RH_points_isbls_7lels(:,0:0)=RH_points_isbls({time|:},{level|1000:1000})
RH_points_isbls_7lels(:,1:1)=RH_points_isbls({time|:},{level|925:925})
RH_points_isbls_7lels(:,2:2)=RH_points_isbls({time|:},{level|850:850})
RH_points_isbls_7lels(:,3:3)=RH_points_isbls({time|:},{level|700:700})
RH_points_isbls_7lels(:,4:4)=RH_points_isbls({time|:},{level|500:500})
RH_points_isbls_7lels(:,5:5)=RH_points_isbls({time|:},{level|300:300})
RH_points_isbls_7lels(:,6:6)=RH_points_isbls({time|:},{level|100:100})
lv_ISBL0_7lels=new(levels_choosed,"integer")
lv_ISBL0_7lels=(/1000,925,850,700,500,300,100/)
;fu shuxing
TIME@units="hours since "+year+"-"+month+"-"+days+" "+hours+":00:00"
date_fore=ut_calendar(TIME,-3)
UV=sqrt(U_points_isbls_7lels*U_points_isbls_7lels+V_points_isbls_7lels*V_points_isbls_7lels)
U_points_isbls_7lels=U_points_isbls_7lels*2.5
V_points_isbls_7lels=V_points_isbls_7lels*2.5
U_points_isbls_7lels!0="time"
U_points_isbls_7lels!1="level"
U_points_isbls_7lels&time=date_fore
U_points_isbls_7lels&level=lv_ISBL0_7lels
copy_VarCoords(U_points_isbls_7lels,V_points_isbls_7lels)
copy_VarCoords(U_points_isbls_7lels,RH_points_isbls_7lels)
pltName="wind_hr_line_501-rh"
pltPath=pltDir+pltName
wks = gsn_open_wks(pltType,pltPath)
gsn_define_colormap(wks,"GMT_drywet");
;gsn_reverse_colormap(wks)
ymin=100;
ymax=1000;
yy = ispan(0,6,1)*1.
z0=(/1000,800,600,400,225,175,100/)
do gg = 0,points-1
z = lv_ISBL0_7lels;lv_ISBL0
u = ndtooned(U_points_isbls_7lels(gg:gg,:))
v = ndtooned(V_points_isbls_7lels(gg:gg,:))
uv=ndtooned(UV(gg:gg,:))
res = True
res@gsnDraw = False
res@gsnFrame = False
res@vpWidthF = 0.7
res@vpHeightF = 0.5
res@vpXF = 0.15
res@vpYF = 0.9
res@trYMinF = ymin
res@trYMaxF = ymax
res@tmYLMode ="Explicit"
res@tmYLValues = (/1000,800,600,400,250,175,100/)
res@tmYLLabels = (/"100","300","500","700","850","925","1000"/)
res@tmXBMode = "Explicit"
res@tmXBValues = (/0.5,1.5,2.5,3.5/)
res@tmXBLabels = strT
res@tmYMajorGrid = True ; Turn on grid lines
res@tmYMajorGridLineDashPattern = 2 ; Dashed lines
res@tmYMajorGridThicknessF = 1.0 ;
res@tmXMajorGrid = True ; Turn on grid lines
res@tmXMajorGridLineDashPattern = 2 ; Dashed lines
res@tmXMajorGridThicknessF = 1.0 ;
res@tiYAxisString = "Pressure (hPa)"
;res@tiXAxisString = "time"
res@tiMainString = "Wind Profile"
res@tmXBMajorLengthF=-0.01
xc = (/0,4,4,0,0/)
yc = (/ymin,ymin,ymax,ymax,ymin/)
if (gg.eq.0) then
plot = gsn_csm_xy(wks,xc,yc,res)
end if ; draw blank xy plot by outlining min/max of X/Y axes
contours = ispan(5,65,5)*1. ; set contours used to define barb color
colors = (/20,30,40,45,50,55,60,65,70,75,80,85,90,95/) ; set colors
wmsetp ("wdf", 1) ; meteorological dir
wmsetp("wbs",0.035)
wmsetp ("blw",3.0) ; increase line thickness of wind barbs
do hh = 0,dimsizes(z)-1
wmsetp("col", GetFillColorIndex(contours,colors,uv(dimsizes(z)-1-hh)))
wmbarb(wks, gg*1.+0.5, z0(hh),u(dimsizes(z)-1-hh), v(dimsizes(z)-1-hh))
end do
delete([/z,u,v/])
end do
vcres=True
;vcres@gsnDraw =False
;vcres@gsnFrame =False
vcres@cnFillOn = True ; turn on color fill
vcres@cnFillPalette = "BlWhRe"
vcres@cnLinesOn = False ; True is default
vcres@cnLineLabelsOn = False ; True is default
;vcres@cnLineLabelPlacementMode="Constant"
;vcres@cnLineDashSegLenF=0.065
;vcres@cnLineLabelInterval=1
;vcres@cnLevelSelectionMode="ExplicitLevels"
;vcres@cnLevels=(/0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0/)
;vcres@cnFillColors=(/10,14,18,23,27,29,33,37,39,43/)
vcres@cnLevelSpacingF = 0.1
rrh_plot=RH_points_isbls_7lels(level|:,time|:)
plot2=gsn_csm_pres_hgt(wks,rrh_plot,vcres)
;overlay(plot,plot2)
draw(plot2)
frame(wks)
end
出错信息是:
warning:IrTransInitialize: trXCoordPoints contains invalid coordinate array: defaulting trXAxisType to LinearAxis
warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value
warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value
warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for X axis failed: consider adjusting trXTensionF value
fatal:IrTransInitialize: spline coordinate approximation not possible:
fatal:Unable to initialize layer-Can't Create
fatal:ContourPlotInitialize: Error creating transformation object
fatal:ContourPlotInitialize: error setting up transformation
fatal:Unable to initialize layer-Can't Create
fatal:PID #-4 can't be found in NhlSetValues
fatal:NhlGetValues:PID #-4 is invalid
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 2222 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 9571 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 13393 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 13532 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 13813 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8638]:Execute: Error occurred at or near line 172
由于我在找错误,所以提示的line172行显示的就是 plot2=gsn_csm_pres_hgt(wks,rrh_plot,vcres)这里头。
|
|