- 积分
- 169
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2021-6-29
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
利用ncl官网的例子绘制pv,报错了本人依据 PV = pot_vort_isobaric(lev,u,v,t,t&latitude, gridType, optPV ) 各变量要求下载了ERA5数据,也进行了数据的重新排列,还是出错了
求各位帮帮孩子吧!!!
错误如下:
fatal:divide: Division by 0, Can't continue
fatal:Div: operator failed, can't continue
代码如下:
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
;=================================================================================
; MAIN
;=================================================================================
TEST = True
gridType = 0 ; gaussian grid
optPV = 1 ; return variable of type list
plev = (/ 300 /)
fu = addfile ("E:/data/pv/U201606.nc", "r")
fv = addfile ("E:/data/pv/V201606.nc", "r")
ft = addfile ("E:/data/pv/T201606.nc", "r")
u = fu->u ; (time,lev,lat,lon)
v = fv->v
t = ft->t
u = u(:,:,::-1,:) ; 对数据重新排序(换为从南到北)。reorder to South -> North
v = v(:,:,::-1,:)
t = t(:,:,::-1,:)
if (TEST) then
ntStrt = 0
ntLast = 0
u = u(ntStrt:ntLast,:,:,:) ; (time,lev,lat,lon)
v = v(ntStrt:ntLast,:,:,:)
t = t(ntStrt:ntLast,:,:,:) ; K
else
u = fu->u ; (time,lev,lat,lon)
v = fv->v
t = ft->t ; K
end if
printVarSummary(u)
printVarSummary(v)
printVarSummary(t)
lev = ft->level ; hPa
lev = lev*100 ; convert units
lev@units = "Pa"
printVarSummary(lev)
PV = pot_vort_isobaric(lev,u,v,t,t&latitude, gridType, optPV )
printVarSummary(PV)
pv = PV[0] ; extract PV
s = PV[1] ; extract static stability
theta = PV[2] ; extract potential temperature
printVarSummary(pv)
printMinMax(pv,0)
printVarSummary(s)
printMinMax(s,0)
printVarSummary(theta)
printMinMax(theta,0)
;************************************************
; create plots
;************************************************
dims = dimsizes(t)
ntim = dims(0)
klev = dims(1)
nlat = dims(2)
mlon = dims(3)
if (.not.TEST) then
ntStrt = 0
ntLast = ntim-1
end if
wks = gsn_open_wks("png","pv_isobaric") ; send graphics to PNG file
;;gsn_define_colormap(wks,"gui_default")
plot = new(3,graphic) ; create a plot array
res = True
res@gsnDraw = False
res@gsnFrame = False
res@cnFillOn = True ; turn on color
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@cnLevelSelectionMode = "ManualLevels"
res@lbOrientation = "Vertical"
resP = True ; modify the panel plot
resP@gsnMaximize = True
do nt=ntStrt,ntLast
do pl=0,dimsizes(plev)-1
res@gsnCenterString = plev(pl)+"hPa"
symMinMaxPlt( pv(nt,{plev(pl)},:,:), 16, True, res)
res@cnLevelSpacingF = 0.5*res@cnLevelSpacingF
res@gsnLeftString = "PV: NCL derived"
plot(0) = gsn_csm_contour_map(wks, pv(nt,{plev(pl)},:,:),res)
delete( [/res@gsnLeftString, res@cnLevelSelectionMode \
,res@cnMinLevelValF, res@cnMaxLevelValF, res@cnLevelSpacingF/] )
plot(1) = gsn_csm_contour_map(wks, s(nt,{plev(pl)},:,:),res)
plot(2) = gsn_csm_contour_map(wks,theta(nt,{plev(pl)},:,:),res)
gsn_panel(wks,plot ,(/3,1/),resP) ; now draw as one plot
end do
end do
end
|
|