爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4271|回复: 6

[其他] 没有任何出错提示,但是无法出图

[复制链接]
发表于 2016-11-22 23:47:06 | 显示全部楼层 |阅读模式

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

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

x
begin
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;open a file
datadir = "~/shuju/Metgrid/"
filenames = systemfunc("ls -1 "+datadir+"met_em.d01*")
nfilenames = dimsizes(filenames)
;;;;;;;;;;;;;;;;;;;;;-----open a workstation
type = "x11"
;type = "ncgm"
;type = "ps"
;type = "pdf"
wks = gsn_open_wks(type,"overlayrs")
;------------set some basic plot resources
res = True
res@Footer = False
res@gsnframe = False
pltres = True
mpres = True
;--------get variables
do i=0,nfilenames-1
a = addfile(filenames(i),"r")
  if(isfilevar(a,"slp") .and. isfilevar(a,"U10") .and. isfilevar(a,"V10") .and. isfilevar(a,"T2"))
slp = wrf_user_getvar(a,"slp",0)

u10 = wrf_user_getvar(a,"U10",0)
v10 = wrf_user_getvar(a,"V10",0)
u10 = u10*1.94386
v10 = v10*1.94386
u10@units = "kts"
v10@units = "kts"

tc2 = wrf_user_getvar(a,"T2",0)
tc2 = tc2-273.16
tf2 = 1.8*tc2+32.
tf2@units = "F"
;;;;;;;;;;;;;;;;;;;set some special plotting resources for some variables
  ;-----------for SLP
opts = res
opts@FieldTitle = "Sea Level Temperature"
opts@cnLinesOn = True
opts@cnLineColor = "Blue"
opts@cnLineLabelsOn = True
opts@gsnContourLineThicknessesScale = 2.0
opts@cnLineLabelBackgroundColor = -1
opts@cnHighLabelsOn = True
opts@cnHighLabelFontThicknessF = 2.0
opts@cnLowLabelsOn = True
opts@cnLowLabelFontThicknessF = 2.0
opts@ContourParameters = (/900.,1100.,4./)
contour_SLP = wrf_contour(a,wks,slp,opts)
delete (opts)
;----------for wind vectors
opts = res
opts@FieldTitle = "wind"
opts@NumVectors = 50
vector = wrf_vector(a,wks,u10,v10,opts)
delete(opts)

;;;---------for T2
opts = res
opts@cnFillOn = True
opts@FieldTitle = "Surface Temperature"
contour_tf2 = wrf_contour(a,wks,tf2,opts)
delete(opts)
plot = wrf_map_overlays(a,wks,(/contour_SLP,vector,contour_tf2/),pltres,mpres)
end if
frame(wks)
end do
end
密码修改失败请联系微信:mofangbao
发表于 2016-11-23 08:52:58 | 显示全部楼层
确定 if(isfilevar(a,"slp") .and. isfilevar(a,"U10") .and. isfilevar(a,"V10") .and. isfilevar(a,"T2"))这句的结果是true吗?met文件里我记得没这些变量吧?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-11-23 11:24:42 | 显示全部楼层
挺身而出 发表于 2016-11-23 08:52
确定 if(isfilevar(a,"slp") .and. isfilevar(a,"U10") .and. isfilevar(a,"V10") .and. isfilevar(a,"T2") ...

呃呃呃,我不知道呢,wrf和met不一样吗。。
密码修改失败请联系微信:mofangbao
发表于 2016-11-24 11:06:54 | 显示全部楼层
clannand 发表于 2016-11-23 11:24
呃呃呃,我不知道呢,wrf和met不一样吗。。

ncdump看看就知道了
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-11-24 12:21:42 | 显示全部楼层

谢谢,换成了wrf数据还是不行,难道是语法错了吗
密码修改失败请联系微信:mofangbao
发表于 2016-11-24 15:05:13 | 显示全部楼层
因为wrf里也没有slp这个变量,所以你的if就没通过。为啥要加这么一句呢? 可以在关键的地方输出一下看看到底哪里错了
密码修改失败请联系微信:mofangbao
发表于 2016-11-29 12:11:49 | 显示全部楼层
估计是你生成文件找不到? wks里面放一个绝对路径试试
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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