- 积分
- 15
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2022-4-15
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 LTTLDD 于 2023-8-20 14:12 编辑
批量读取wrfout文件画图时出现错误Eq: Dimension size, for dimension number 0, of operands does not match, can't continue。但是读取单个文件的时候却没问题,求教各位如何修改?
报错如下:
fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 926 in file /public/software/apps/ncl_ncarg/ncl630/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 1551 in file /public/software/apps/ncl_ncarg/ncl630/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 6944 in file /public/software/apps/ncl_ncarg/ncl630/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 10599 in file /public/software/apps/ncl_ncarg/ncl630/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 64 in file panel.ncl
脚本如下:
begin
;---Open WRF output file.
dir = "ls -1 /data/riems/users/zhaodm/202308/data.wrf/201908/"
filename = "wrfout_d02_2019-08-1*"
files = systemfunc(dir + filename) + ".nc"
a = addfiles(files,"r")
;---Read terrain height and lat/lon off file.
it = -1 ;
T2 = wrf_user_getvar(a,"T2",it)
T2@lat2d = wrf_user_getvar(a,"XLAT",it)
T2@lon2d = wrf_user_getvar(a,"XLONG",it)
T2!1 ="lat2d"
T2!2 ="lon2d"
T = T2 - 273
copy_VarAtts(T2,T)
copy_VarCoords(T2, T)
wks = gsn_open_wks("png","/data/riems/users/zhaodm/202308/plot/out_T2_panel_201908")
;---Set some basic plot options
res = True
res@gsnFrame = False
res@gsnDraw = False
res@gsnMaximize = True ; maximize plot in frame
res@cnFillOn = True
res@cnFillPalette = "matlab_jet"
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@mpProjection = "CylindricalEquidistant" ; The default
res@mpDataBaseVersion = "MediumRes"
res@gsnAddCyclic = False
res@mpOutlineSpecifiers=(/"China:States"/)
res@mpDataBaseVersion="Ncarg4_1"
res@mpDataSetName="Earth..4"
res@lbLabelBarOn = False
res@tiYAxisOn = False
res@gsnRightString = ""
res@gsnLeftString = ""
;---Zoom in on plot
res@mpMinLatF = min(T@lat2d)
res@mpMaxLatF = max(T@lat2d)
res@mpMinLonF = min(T@lon2d)
res@mpMaxLonF = max(T@lon2d)
contour = new(4,graphic)
contour(0) = gsn_csm_contour_map(wks,T(2,:,:),res);2:00
contour(1) = gsn_csm_contour_map(wks,T(8,:,:),res);8:00
contour(2) = gsn_csm_contour_map(wks,T(14,:,:),res);14:00
contour(3) = gsn_csm_contour_map(wks,T(20,:,:),res);20:00
;---set panel
res1 = True
timename = "T 20190815 "
res1@tiMainString = timename
res1@gsnPanelLabelBar = True
res1@lbOrientation = "horizontal"
res1@lbTitleString = "~S~o~N~C"
res1@lbTitleFontThicknessF = 0.6
res1@lbTitleExtentF = 0.06
res1@lbTitleJust = "bottomcenter"
res1@cnLineLabelsOn = False
res1@cnLinesOn = False
;res1@gsnCenterString = "Temp at 2m"
res1@gsnPanelFigureStrings= (/"a)","b)","c)","d)"/)
res1@amJust = "TopLeft"
gsn_panel(wks, contour, (/2,2/), res1)
end
|
|