请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6520|回复: 11

wrfout数据使用gsn_panel和wrf_overlays不兼容问题

[复制链接]

新浪微博达人勋

发表于 2019-8-31 16:51:33 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图: -
问题概况: 如题所示 想画剖面图的panel 因增加了地形及风场 地形用的gsn_csm_xy 无法与wrf_overlays兼容 但全改为gsn_csm_contour或gsn_contour也不行 最后组图没有出现地形 虽然也没有报错 但是风场也无法显示 求原因 由于是画剖面图 所以也没法用wrf_map_overlays或者gsn_csm_map_contour 求各位帮忙解决 困扰很久
我看过提问的智慧: 看过
自己思考时长(天): 3

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

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

x
如题所示 想画剖面图的panel 因增加了地形及风场 地形用的gsn_csm_xy 无法与wrf_overlays兼容 但全改为gsn_csm_contour或gsn_contour也不行 最后组图没有出现地形 虽然也没有报错 但是风场也无法显示 求原因 由于是画剖面图 所以也没法用wrf_map_overlays或者gsn_csm_map_contour 求各位帮忙解决 困扰很久
以下是我的部分脚本:
res              = True
res@MainTitle    = ""
res@InitTime     = False
res@ValidTime    = False
res@Footer       = False

pltres           = True
pltres@NoTitles  = True
pltres@PanelPlot = True


contour_ter  = gsn_csm_xy(wks,X_plane,ter_plane,opts_ter)
contour_ter1 = gsn_csm_xy(wks,X_plane1,ter_plane1,opts_ter1)
contour_ter2 = gsn_csm_xy(wks,X_plane2,ter_plane2,opts_ter2)
countour_dv  = wrf_contour(a, wks, dv_plane(0:zmax_pos,:), opts_dv)
countour_dv1 = wrf_contour(a1,wks, dv_plane1(0:zmax_pos1,:), opts_dv1)
countour_dv2 = wrf_contour(a2,wks, dv_plane2(0:zmax_pos2,:), opts_dv2)

plots(0) = wrf_overlays(a,wks,(/countour_dv,contour_ter/),True)    ; plot x-section
plots(1) = wrf_overlays(a1,wks,(/countour_dv1,contour_ter1/),True)    ; plot x-section
plots(2) = wrf_overlays(a2,wks,(/countour_dv2,contour_ter2/),True)    ; plot x-section


;set panel
  pnlres = res
  pnlres@gsnPanelCenter             = True
  pnlres@gsnPanelLabelBar           = True
  ;pnlres@gsnPanelXWhiteSpacePercent = 0.8
  pnlres@lbOrientation              = "Vertical"
  pnlres@lbLabelPosition            = "Right"
  pnlres@pmLabelBarParallelPosF     = 0.0
  pnlres@pmLabelBarOrthogonalPosF   = 0.0
  pnlres@pmLabelBarWidthF           = 0.05
  pnlres@pmLabelBarHeightF          = 0.15
  pnlres@gsnPanelRowSpec            = True
  pnlres@gsnPanelYWhiteSpacePercent = 5
  pnlres@gsnPanelScalePlotIndex     = 1
  pnlres@gsnPanelLeft               = 0.05
  pnlres@amJust                     = "TopLeft"
  gsn_panel(wks, (/plots/), (/3/), pnlres)

end

如果将wrf_overlays里两个互换就只显示地形 不显示等值线 求救
wrf_panel_dv.000001.png
wrf_panel_dv.000004.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-9-4 11:12:53 | 显示全部楼层
  res = True   ; plot mods desired
  res@gsnDraw      = False
  res@gsnFrame     = False
  res@cnFillOn = True
  res@cnInfoLabelOn = False
  res@cnLinesOn = False

  plot11=gsn_csm_contour(wks,dethdp_plane,res)
  plot12=gsn_csm_contour(wks,dethdp_plane,res)

;-------------------------------------
  res2=True
  res2@gsnDraw      = False
  res2@gsnFrame     = False

  plot21=gsn_csm_contour(wks,va_plane,res2)
  plot22=gsn_csm_contour(wks,va_plane,res2)

;----------------------------------------------------
  vcres                      := True
  vcres@gsnDraw              := False
  vcres@gsnFrame             := False

  plot31 := gsn_csm_vector(wks,va_plane,wa_plane,vcres)
  plot32 := gsn_csm_vector(wks,va_plane,wa_plane,vcres)

;---------------------------------
  overlay(plot11,plot21)
  overlay(plot12,plot22)
  overlay(plot11,plot31)
  overlay(plot12,plot32)

  pres1 = True
  pres1@gsnFrame               = False
  gsn_panel(wks,(/plot11,plot12/),(/2,1/),pres1)
  frame(wks)

我试了下,这样是可以三个量叠加的,我觉得你是draw跟frame没有用好
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

新浪微博达人勋

发表于 2019-9-1 09:05:03 | 显示全部楼层
试试overlay(contour_ter,countour_dv),另外wrf画图的命令不好用,建议都用gsn_系列的
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-9-1 09:56:24 | 显示全部楼层
pigzero527 发表于 2019-9-1 09:05
试试overlay(contour_ter,countour_dv),另外wrf画图的命令不好用,建议都用gsn_系列的

感谢回复 我按你的方法还是不行 可能是因为剖面图的原因 没有map?感觉没有overlay上
以下是我的脚本
countour_dv = new(3, "graphic")
contour_ter = new(3, "graphic")
vector      = new(3, "graphic")
countour_dv(0)  = gsn_csm_contour(wks, dv_plane(0:zmax_pos,:), opts_dv)
countour_dv(1)  = gsn_csm_contour(wks, dv_plane1(0:zmax_pos1,:), opts_dv1)
countour_dv(2) = gsn_csm_contour(wks, dv_plane2(0:zmax_pos2,:), opts_dv2)
contour_ter(0)  = gsn_csm_xy(wks,X_plane,ter_plane,opts_ter)
contour_ter(1) = gsn_csm_xy(wks,X_plane1,ter_plane1,opts_ter1)
contour_ter(2) = gsn_csm_xy(wks,X_plane2,ter_plane2,opts_ter2)
vector(0)  = gsn_csm_vector(wks,u_plane(0:zmax_pos,:),w_plane(0:zmax_pos,:)*10.,vcres)
vector(1) = gsn_csm_vector(wks,u_plane1(0:zmax_pos1,:),w_plane1(0:zmax_pos1,:)*10.,vcres1)
vector(2) = gsn_csm_vector(wks,u_plane2(0:zmax_pos2,:),w_plane2(0:zmax_pos2,:)*10.,vcres2)
;plots(0) = wrf_overlays(a,wks,(/countour_dv,vector,contour_ter/),True)    ; plot x-section
;plots(1) = wrf_overlays(a1,wks,(/countour_dv1,vector1,contour_ter/),True)    ; plot x-section
;plots(2) = wrf_overlays(a2,wks,(/countour_dv2,vector2,contour_ter2/),True)    ; plot x-section
overlay(contour_ter(0) , countour_dv(0))
overlay(contour_ter(0), vector(0))

overlay(contour_ter(1) , countour_dv(1))
overlay(contour_ter(1), vector(1))

overlay(contour_ter(2) , countour_dv(2))
overlay(contour_ter(2), vector(2))
; Delete options and fields, so we don't have carry over
delete(opts_xy)
delete(ter_plane)
delete(opts_xy1)
delete(ter_plane1)
delete(opts_xy2)
delete(ter_plane2)
  ;set panel
  pnlres = res
  pnlres@gsnPanelCenter             = True
  pnlres@gsnPanelLabelBar           = True
  pnlres@lbOrientation              = "Vertical"
  pnlres@lbLabelPosition            = "Right"
  pnlres@pmLabelBarParallelPosF     = 0.0
  pnlres@pmLabelBarOrthogonalPosF   = 0.0
  pnlres@pmLabelBarWidthF           = 0.05
  pnlres@pmLabelBarHeightF          = 0.15
  pnlres@gsnPanelRowSpec            = True
  pnlres@gsnPanelYWhiteSpacePercent = 5
  pnlres@gsnPanelScalePlotIndex     = 1
  pnlres@amJust                     = "TopLeft"
  gsn_panel(wks, contour_ter, (/3/), pnlres)

end出图如下:

wrf_panel_dv_vector1.000004.png
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-9-1 09:58:30 | 显示全部楼层
pigzero527 发表于 2019-9-1 09:05
试试overlay(contour_ter,countour_dv),另外wrf画图的命令不好用,建议都用gsn_系列的

他还提示有个warning
Warning: gsn_panel: unrecognized plot type for getting labelbar information. Ignoring labelbar request.
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-9-3 15:39:10 | 显示全部楼层
建议先不要做panel了,先把overlay解决了,我用下面这几行,是可以把气温场跟风场叠加到一起的,你可以试一下,可以的话再进行调整

  res = True   
  res@gsnDraw      = False
  res@gsnFrame     = False
  res@cnFillOn     = True

  plot1=gsn_csm_contour(wks,t_plane,res)

;---------------------------------
  vcres                      := True
  vcres@gsnDraw              := False
  vcres@gsnFrame             := False

  plot2 := gsn_csm_vector(wks,va_plane,wa_plane,vcres)

  overlay(plot1,plot2)
  draw(plot1)
  frame(wks)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-9-3 17:38:07 | 显示全部楼层
pigzero527 发表于 2019-9-3 15:39
建议先不要做panel了,先把overlay解决了,我用下面这几行,是可以把气温场跟风场叠加到一起的,你可以试一 ...

感谢回复 我正常单张图overlay是没有问题的 就是用了gsn_panel后 无法overlay
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-9-4 11:29:05 | 显示全部楼层
pigzero527 发表于 2019-9-4 11:12
res = True   ; plot mods desired
  res@gsnDraw      = False
  res@gsnFrame     = False

啊啊 原来是要添加frame 万分感谢 还有我想问下draw怎么写呢 我看你这个部分脚本里没有写draw  求指教
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-9-4 21:07:33 | 显示全部楼层
pigzero527 发表于 2019-9-4 11:12
res = True   ; plot mods desired
  res@gsnDraw      = False
  res@gsnFrame     = False

还有就是对于vector为什么要用:=呢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-9-5 17:35:34 | 显示全部楼层
supersupergirl 发表于 2019-9-4 11:29
啊啊 原来是要添加frame 万分感谢 还有我想问下draw怎么写呢 我看你这个部分脚本里没有写draw  求指教

draw一般是用在单图上吧,前面如果gsnDraw=False就需要draw(plot),否则可以不用写draw,这边应该是panel了就不用draw了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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