爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5678|回复: 2

ncl overlay 相关问题

[复制链接]

新浪微博达人勋

发表于 2022-1-26 13:14:50 | 显示全部楼层 |阅读模式

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

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

x
各位大侠,本人刚学ncl,想请教问题,下面附上脚本:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

f = addfile ("/cygdrive/H/d03/wrfout_d03_2018-04-25_00_00_00", "r")
tc = wrf_user_getvar(f,"tc",1)       ; temperature in degC
tc@units = "degC"                     ; better units
u = wrf_user_getvar(f,"ua",1)         ; U component
u@units = "m/s"
v = wrf_user_getvar(f,"va",1)         ; V component
v@units = "m/s"


printVarSummary(tc)
printVarSummary(u)
printVarSummary(v)

wks = gsn_open_wks("x11" ,"panel1c")  ; Open png file "panel1c.png"

res                 = True           ; Plot options desired
res@gsnDraw         = False          ; Don't draw plots
res@gsnFrame        = False          ; Don't advance frames

res = wrf_map_resources(f,res)        ; Add necessary resources for WRF map
res@tfDoNDCOverlay  = True            ; Use the native WRF map projection
res@gsnAddCyclic    = False           ; Don't add longitude cyclic point

res@cnFillOn        = True           ; Turn on color
res@lbOrientation   = "Vertical"     ; Vertical labelbar

;res@cnLevelSelectionMode = "ManualLevels"    ; Set contour levels
;res@cnMinLevelValF       = 8
;res@cnMaxLevelValF       = 38
;res@cnLevelSpacingF      = 2

res@cnLevelSelectionMode = "AutomaticLevels"    ; Set contour levels

; res@cnFillMode                  = "RasterFill"      
res@cnLinesOn                   = False  ; Turn off contour lines
res@cnLineLabelsOn              = False  ; Turn off contour labels
res@cnFillOn                    = True   ; Turn on contour fill



vcres = True ;-- vector only resources
vcres@gsnDraw = False ;-- don't draw
vcres@gsnFrame = False ;-- don't advance frame
vcres@vcGlyphStyle = "WindBarb" ;-- curly vectors
vcres@vcRefMagnitudeF = 20 ;-- define vector ref mag
vcres@vcRefLengthF = 0.045 ;-- define length of vec ref
;vcres@vcRefAnnoOrthogonalPosF = -.535 ;-- move ref vector into plot
vcres@gsnRightString = " " ;-- turn off right string92
vcres@gsnLeftString = " " ;-- turn off left string
vcres@tiXAxisString = " " ;-- turn off axis label

vcres@vcLevelSelectionMode = "ManualLevels"   
vcres@vcLevelSpacingF = 50
vcres@vcMinDistanceF=0.03

;
; Loop across four levels and create a contour plot for each one.
; Change the main title each time.
;
plots = new(4,graphic)
vplot = new(4,graphic)
do i=0,3
  if (i.eq.0) then
  res@tiMainString = "220hpa"
  mm=62
  else if (i.eq.1) then
  res@tiMainString = "500hpa"
  mm=55
  else if (i.eq.2) then
  res@tiMainString = "800hpa"
  mm=40
  else
  res@tiMainString = "1000hpa"
  mm=0
  end if
  end if
  end if
;  plots(i)         = gsn_csm_contour_map(wks,tc(0,mm,:,:),res)
  plots(i)         = gsn_csm_contour_map(wks,tc(mm,:,:),res)
  vplot(i)            = gsn_csm_vector(wks,u(mm,:,:),v(mm,:,:),vcres)
overlay(plots(i),vplot(i))

end do

;---Create a panel of plots with 2 rows and 2 columns.
gsn_panel(wks,plots,(/2,2/),False)


得到的图如下:

                               
登录/注册后可看大图

但是这个风场太稀疏了,而且箭头还有重叠。
我把温度数据忽略不画,然后把上面脚本的风场vplot全部输出了一下,得到下图:

                               
登录/注册后可看大图

这说明风场vplot的数据不是那么像上图一样稀疏的,只是温度plot和风场vplot的overlay之后才造成风场特别稀疏,这是为什么?我怎么改才能让温度场正常叠加风场?谢谢!

温度风场图

温度风场图

单纯风场图

单纯风场图
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2022-1-27 15:29:46 | 显示全部楼层
我在代码中加入
vcres = wrf_map_resources(f,res)    ;
可以叠加图了,但叠加之后的图坐标轴有两个刻度,哪位大侠看看这个如何解决?

                               
登录/注册后可看大图

温度风场叠加图

温度风场叠加图

温度风场叠加图

温度风场叠加图
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-1-27 15:52:30 | 显示全部楼层
试了一下,加上了这句:

vcres@tmXBMode     = "Explicit"
vcres@tmXBValues   =  res@tmXBValues
vcres@tmYLMode     = "Explicit"
vcres@tmYLValues   =  res@tmYLValues

图的坐标就成为一个了。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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