爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 8396|回复: 10

[作图] 求助!ncl垂直剖面纵坐标修改?

[复制链接]

新浪微博达人勋

发表于 2016-7-15 11:24:49 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 diandian 于 2016-7-15 12:12 编辑

用ncl画wrfout雨水源汇项,但是雨水源项基本在底层,而画出的图中高层都是空白区域,如图,求助如何缩小纵坐标范围,如只到12km,求大神帮个忙,谢谢了!!
H5MO_3_$}GFQ({89YX$BJ]9.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-7-15 12:14:34 | 显示全部楼层
所用脚本如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a  = addfile("/nuist/scratch/wrf/wrfout/wrfout_d02_2015-06-27_06:00:00.nc","r")

; We generate plots, but what kind do we prefer?
;  type = "x11"
  type = "pdf"
;  type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"qr-yuan-32.15")
  gsn_define_colormap(wks,"BlueDarkRed18")

; Set some basic resources
  res = True
;  res@MainTitle = "REAL-TIME WRF"
  res@gsnMaximize       = True  
  res@Footer = False
  res@gsnDraw  = True    ; Forces the plot to be drawn
  res@gsnFrame = True    ; Frame advance
  
;res@tmYRMode                         = "Explicit"
;res@tmYRValues                = fspan(0,96,11)                    
;res@tmYLValues                = fspan(0,96,11)                    
res@tmXBMode                        = "Explicit"
res@tmXBValues                = fspan(0,92,4)                    ; Create tick marks
res@tmXBLabels                = sprintf("%.1f",fspan(104,107,4))  ; Create labels  
;res@tmYLLabels                = sprintf("%4.1f",fspan(0,20,11))  
res@tmXTOn                         = False

   pltres = True

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  times  = wrf_user_getvar(a,"times",-1) ; get times in the file
  ntimes = dimsizes(times)          ; number of times in the file
  FirstTime = True

  mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file
  nd = dimsizes(mdims)

;---------------------------------------------------------------
  do it = 0,49,1  
    print("Working on time: " + times(it) )
    res@TimeLabel = times(it)           ; Set Valid time to use on plots

  tc  = wrf_user_getvar(a,"tc",it)     ; T in C
  rcaccr01 = wrf_user_getvar(a,"RCACCR",it)   ;ice water mixed ratio
     rcaccr = rcaccr01*1000000.0
  qmlgr01 = wrf_user_getvar(a,"QMLGR",it)   ;ice water mixed ratio
     qmlgr = qmlgr01*1000000.0
  qmlsr01 = wrf_user_getvar(a,"QMLSR",it)   ;cloud water mixed ratio
    qmlsr = qmlsr01*1000000.0

    w  = wrf_user_getvar(a,"wa",it)  
    u  = wrf_user_getvar(a,"ua",it)
    z   = wrf_user_getvar(a, "z",it)     ; grid point height

    if ( FirstTime ) then                ; get height info for labels
      zmin = 0.
      zmax = max(z)/1000.
      ;zmax = 12000/1000
      nz   = floattoint(zmax/2 + 1)
      FirstTime = False
    end if

;---------------------------------------------------------------

; Plot a cross session that run from point A to point B

loc1    = wrf_user_latlon_to_ij(a,32.15,104)
loc2    = wrf_user_latlon_to_ij(a,32.15,107)
        plane = new(4,float)
         ;plane=(/120,30, 80,120/)     
       plane=(/loc1(1),loc2(1), loc1(0),loc2(0)/)     ; start x;y & end x;y point           
        print(dimsizes(plane))
        opts = True            ; start and end points specified

       tc_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)
       rcaccr_plane = wrf_user_intrp3d(rcaccr,z,"v",plane,0.,opts)
       qmlgr_plane = wrf_user_intrp3d(qmlgr,z,"v",plane,0.,opts)
       qmlsr_plane = wrf_user_intrp3d(qmlsr,z,"v",plane,0.,opts)
        w_plane = wrf_user_intrp3d(w,z,"v",plane,0.,opts)
        u_plane = wrf_user_intrp3d(u,z,"v",plane,0.,opts)

       ; u_plane!1="latitude"   ; u_plane&latitude=lat


        dim = dimsizes(u_plane) ; Find the data span - for use in labels
        zspan = dim(0)

    ; Options for XY Plots
        opts_xy                         = res
        opts_xy@tiYAxisString           = "Height (km)"
        ;opts_xy@cnMissingValPerimOn     = True
        opts_xy@cnMissingValFillColor   = 0
        opts_xy@cnMissingValFillPattern = 11
        opts_xy@tmYLMode                = "Explicit"
       ;opts_xy@tmYLValues              = fspan(0,zspan,nz)     ; Create tick marks
        ;opts_xy@tmYLLabels              = sprintf("%.1f",fspan(zmin,zmax,nz))  

; Create labels  ;

        opts_xy@tiXAxisFontHeightF      = 0.020
        opts_xy@tiYAxisFontHeightF      = 0.020
        opts_xy@tmXBMajorLengthF        = 0.02
        opts_xy@tmYLMajorLengthF        = 0.02
        opts_xy@tmYLLabelFontHeightF    = 0.015
;        opts_xy@PlotOrientation         = tc_plane@Orientation
        opts_xy@cnInfoLabelOn            = False

      ; Plotting options for Temperature
        opts_tc = opts_xy
        opts_tc@cnInfoLabelOrthogonalPosF = 0.00
     ;   opts_tc@cnLineColor             = "slategray"
        opts_tc@ContourParameters  = (/ -80, 20, 10 /)

      ; Plotting options for qice
        opts_rcaccr = opts_xy
        opts_rcaccr@ContourParameters       = (/1, 25, 2 /)
        opts_rcaccr@cnLineThicknessF        = 3
        opts_rcaccr@gsnContourPosLineDashPattern = 1
      ;  opts_rcaccr@pmLabelBarOrthogonalPosF = -0.07
        opts_rcaccr@cnFillOn                = False
            
       ; plotting options for qcloud
        opts_qmlgr = opts_xy
        opts_qmlgr@ContourParameters       = (/10, 150, 30 /)
        opts_qmlgr@cnLineThicknessF        = 3
        opts_qmlgr@pmLabelBarOrthogonalPosF = -0.07
        opts_qmlgr@cnFillOn                = False
        
        ;opts_qmlgr@cnLevelSelectionMode = "ExplicitLevels"
        ;opts_qmlgr@cnLevels             = (/1,10,50,100,150,200,250/)

; plotting options for qcloud
        opts_qmlsr = opts_xy
        opts_qmlsr@ContourParameters       = (/1, 25, 2 /)
        opts_qmlsr@cnLineThicknessF        = 3
        opts_qmlsr@pmLabelBarOrthogonalPosF = -0.07
        opts_qmlsr@cnFillOn                = False

  ; plotting options for w
      opts_w = opts_xy         
      opts_w@FieldTitle = "Wind"       ; overwrite Field Title
      opts_w@cnFillOn                = True
      opts_w@ContourParameters       = (/-2, 8, 1 /)
      opts_w@cnFillColors =(/3,5,0,0,12,13,14,15,16,17,18,19/)

      ; Get the contour info for the qrain qsi and temp
        contour_tc = wrf_contour(a,wks,tc_plane,opts_tc)
        contour_rcaccr = wrf_contour(a,wks,rcaccr_plane,opts_rcaccr)
        contour_qmlgr = wrf_contour(a,wks,qmlgr_plane,opts_qmlgr)
        contour_qmlsr = wrf_contour(a,wks,qmlsr_plane,opts_qmlsr)
        contour_w = wrf_contour(a,wks,w_plane,opts_w)

; MAKE PLOTS         
  plot = wrf_overlays(a,wks,(/contour_tc,contour_rcaccr,contour_qmlgr,contour_qmlsr/),res)





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  end do        ; END OF TIME LOOP

end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-7-15 15:13:24 | 显示全部楼层
res@trYMaxF   
res@trYMinF
设置这两个参数不行么?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-7-15 17:21:42 | 显示全部楼层
我也不会啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-7-18 11:21:54 | 显示全部楼层
孤独卡齐莫多 发表于 2016-7-15 15:13
res@trYMaxF   
res@trYMinF
设置这两个参数不行么?

可以,谢谢啦
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-8-8 19:33:50 | 显示全部楼层
多谢分享,观摩学习。。。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-9-6 21:01:53 | 显示全部楼层
请问加上那两句就可以了么?为什么我还是没有解决
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-3-31 10:32:45 | 显示全部楼层
diandian 发表于 2016-7-15 12:14
所用脚本如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncar ...

我想问下为何你的垂直层差值出来是高度,而我的只有垂直方向为100层呢?求指点
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-7-24 15:48:42 | 显示全部楼层
tc_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)
       rcaccr_plane = wrf_user_intrp3d(rcaccr,z,"v",plane,0.,opts)
       qmlgr_plane = wrf_user_intrp3d(qmlgr,z,"v",plane,0.,opts)
       qmlsr_plane = wrf_user_intrp3d(qmlsr,z,"v",plane,0.,opts)
        w_plane = wrf_user_intrp3d(w,z,"v",plane,0.,opts)
        u_plane = wrf_user_intrp3d(u,z,"v",plane,0.,opts)
你这个angle设置的是0,是S-N的,但是你是经度W-E方向的,怎么没有报错啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-12-29 11:11:50 | 显示全部楼层
爱地理不爱物理 发表于 2017-7-24 15:48
tc_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)
       rcaccr_plane = wrf_user_intrp3d(rcaccr,z ...

给了两个经纬度,所以angel无效
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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