爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5068|回复: 5

【求助】用wrf_user_intrp3d 函数画图出现问题

[复制链接]

新浪微博达人勋

发表于 2019-6-16 22:01:56 | 显示全部楼层 |阅读模式

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

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

x
如图是我用wrf输出的结果 绘制的温度和湿度的垂直廓线,但发现在最底层 总是出现空白,这是什么原因呢?

图1

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

新浪微博达人勋

 楼主| 发表于 2019-6-16 22:03:58 | 显示全部楼层

;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.
;   Plot data on a cross section
;   This script will plot data from point A to point B
;   Add some label info to the Y-axis

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

begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("../wrfout_d02_2016-04-02_00:00:00(feedback)","r")


; We generate plots, but what kind do we prefer?
  type = "png"
; type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_test_8")


; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"
  res@Footer = 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,ntimes-1,2                  ; TIME LOOP
  ;do it = 0,2
    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
    rh = wrf_user_getvar(a,"rh",it)      ; relative humidity
    z   = wrf_user_getvar(a, "z",it)     ; grid point height

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

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

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

        plane = new(4,float)
        plane = (/ 33,37, 33, 0 /)    ; start x;y & end x;y point           
        opts = True                                        ; start and end points specified

        rh_plane = wrf_user_intrp3d(rh,z,"v",plane,0.,opts)
        tc_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)

        dim = dimsizes(rh_plane)                      ; Find the data span - for use in labels
        zspan = dim(0)   ;;;;;;;;;;;;;垂直层数 100

      ; 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@trYMaxF           =   10                    ; axis max
         opts_xy@trYMinF           =    0.  

         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
        

      ; Plotting options for RH
        opts_rh = opts_xy
        opts_rh@ContourParameters       = (/ 5., 95., 5. /)
        opts_rh@pmLabelBarOrthogonalPosF = -0.07
        opts_rh@cnFillOn                = True
         opts_rh@cnFillPalette =  "CBR_wet"
        ;opts_rh@cnFillColors            = (/"White","White","White", \
         ;                                   "White","Chartreuse","Green", \
          ;                                  "Green3","Green4", \
           ;                                 "ForestGreen","PaleGreen4"/)

      ; Plotting options for Temperature
        opts_tc = opts_xy
        opts_tc@cnInfoLabelOrthogonalPosF = 0.00
        opts_tc@ContourParameters  = (/ 0.5 /)


      ; Get the contour info for the rh and temp
        contour_tc = wrf_contour(a,wks,tc_plane,opts_tc)
        contour_rh = wrf_contour(a,wks,rh_plane,opts_rh)


      ; MAKE PLOTS         
        plot = wrf_overlays(a,wks,(/contour_rh,contour_tc/),pltres)

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

  end do        ; END OF TIME LOOP

end


这是我的ncl 画图代码
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-6-16 23:31:35 | 显示全部楼层
你横坐标是什么?格点数还是距离      白色区域应该是地形
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2019-6-17 09:49:25 | 显示全部楼层
freekiller 发表于 2019-6-16 23:31
你横坐标是什么?格点数还是距离      白色区域应该是地形

感谢您的回复

我在wrf_user_intrp3d 函数中设为两个点之间 ,所以横坐标应该是格点数

我画的每一张图 这个白色区域的大小都一样, 地形不应该是高低起伏的吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-6-17 23:32:16 | 显示全部楼层
区域太小,也许就是平原
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2019-9-12 16:10:48 | 显示全部楼层
wrf_user_intrp3d
Interpolates ARW WRF model data vertically or horizontally (deprecated).

Note: in NCL V6.5.0 a bug was fixed in this routine and in wrf_user_intrp2d in which the 0th grid point was not being included when setting up the output domain, causing the output array to be missing a grid point in the rightmost dimension.
不知道会不会是以上原因,
http://www.ncl.ucar.edu/Document ... _user_intrp3d.shtml
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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