爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1724|回复: 0

[作图] NCL报错:Eq: Dimension size, for dimension number 0, of operands does not match

[复制链接]
发表于 2023-8-19 23:48:38 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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