爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6438|回复: 5

overlay函数无法叠加

[复制链接]
发表于 2014-5-6 21:26:26 | 显示全部楼层 |阅读模式
GrADS
系统平台: linux
问题截图:
问题概况: 原本plot,plot_vr可以顺利叠加,后来想加入降水量(降雨随时间变化的折线图),但是出图后原来的plot,plot_vr不再显示,只显示加入的折线图,并且折线图如下图所示,雨量一直上升(正常情况下雨量应该有波动才对)雨量一直上升感觉是把雨量叠加在了一起
我看过提问的智慧: 看过
自己思考时长(天): 1

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

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

x
下面是我的脚本,请问有什么问题呢?谢谢!(红色部分为后加入的语句,加入后发现上述问题)
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
begin
;************************************************
; variable and file handling
;************************************************
  in  = addfile("/home/zssapr/WRF3.5.1/20110710/data/wrf_data/wrfout_d02_2011-07-10_00:00:00","r")
  rain_exp = wrf_user_getvar(in,"RAINNC",-1)
  rain_con = wrf_user_getvar(in,"RAINC", -1)
  
  rain_tot = new ( dimsizes(rain_exp), typeof(rain_exp), rain_exp@_FillValue )
  dimp   = dimsizes( rain_exp )
  ntime   = dimp(0)
  rain_acc   =  new ( (/ntime/), typeof(rain_exp) )



  copy_VarCoords(rain_exp, rain_tot)
  rain_tot = rain_exp + rain_con
  rain_tot@description = "Total Precipitation (inches)"
  rain_acc = dim_sum_n_Wrap(rain_tot(:,:,:),(/1,2/))

  resrain                  = True                     ; plot mods desired

  resrain@tmYRLabelsOn         = True           ; turn on right axis labels
  resrain@tmYUseLeft           = False          ; don' use any left settings
  resrain@tmYRAutoPrecision    = False          ; no auto precision
  resrain@tmYRPrecision        = 4              ; set the precision
  resrain@vpWidthF            = 0.5           ; change aspect ratio of plot
  resrain@vpHeightF           = 0.3


  U =in->U
  ua = wrf_user_unstagger(U,U@stagger)
  V = in->V
  va = wrf_user_unstagger(V,V@stagger)
  lat = in->XLAT(0,:,0)
  lon = in->XLONG(0,0,:)
  scale=1.e05

  dv = new ( dimsizes(ua), typeof(ua), ua@_FillValue )
  dv@units      = "1.e05 1/s"
  dv = (uv2dv_cfd (ua,va,lat,lon, 2))*scale

  vr = new ( dimsizes(ua), typeof(ua), ua@_FillValue )
  vr@long_name  = "vorticity&divengence"
  vr@units      = "1.e05 1/s"
  vr = (uv2vr_cfd (ua,va,lat,lon, 2))*scale
  
  copy_VarCoords(ua, dv)
  Dv = dim_avg_n_Wrap(dv(:, :, 18 : 36, 18 : 45), (/2, 3/))
  copy_VarCoords(ua, vr)
  Vr = dim_avg_n_Wrap(vr(:, :, 18 : 36, 18 : 45), (/2, 3/))

  res = True
  res@cnFillOn = True
  res@cnLinesOn       = False
  res@gsnDraw      =  False                   ; do not draw the plot
  res@gsnFrame     =  False                   ; do not advance the frame
  res@vpWidthF            = 0.5           ; change aspect ratio of plot
  res@vpHeightF           = 0.3

  resvr = True
  resvr@cnFillOn = False
  resvr@cnLinesOn       = True
  resvr@cnLevelSelectionMode ="ExplicitLevels"

  resvr@cnLevels               =(/-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0/)
  resvr@gsnDraw = False                        ; do not draw the plot
  resvr@gsnFrame = False                       ; do not advance the frame
  resvr@vpWidthF            = 0.5           ; change aspect ratio of plot
  resvr@vpHeightF           = 0.3
  
  wks  = gsn_open_wks("ps","press_time3")
  gsn_define_colormap(wks,"BlueWhiteOrangeRed")
  
  plot = gsn_csm_contour(wks, Vr(bottom_top|:,Time|:),res)
  plot_vr = gsn_csm_contour(wks, Dv(bottom_top|:,Time|:),resvr)
  plot_rain = gsn_csm_y(wks, rain_acc,resrain)

  overlay(plot,plot_vr)
overlay(plot,plot_rain)
  draw(plot)
  frame(wks)
end

密码修改失败请联系微信:mofangbao
发表于 2014-5-6 22:13:20 | 显示全部楼层
加入  
  resrain@gsnDraw      =  False
  resrain@gsnFrame     =  False
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

发表于 2014-5-6 22:09:38 | 显示全部楼层
这是NCL不是GrADS
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-5-7 10:26:56 | 显示全部楼层
longlivehj 发表于 2014-5-6 22:13
加入  
  resrain@gsnDraw      =  False
  resrain@gsnFrame     =  False

这俩个语句加入后,plot和plot_vr可以显示,但折线显示不了。。。如下图
捕获.JPG


隐去plot_vr(即用plot_rain代替plot_vr)画面也只显示plot
密码修改失败请联系微信:mofangbao
发表于 2014-5-7 12:12:33 | 显示全部楼层
追风的阳光 发表于 2014-5-7 10:26
这俩个语句加入后,plot和plot_vr可以显示,但折线显示不了。。。如下图

刚注意到,你这个好像不能overlay吧!一个y是高度,一个是雨量。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-5-7 15:16:52 | 显示全部楼层
longlivehj 发表于 2014-5-7 12:12
刚注意到,你这个好像不能overlay吧!一个y是高度,一个是雨量。

那请问有什么办法可以叠加上呢?雨量可以放在右边
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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