爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 7620|回复: 5

[作图] ncl画wrfout环流形势出现锯齿状边缘

[复制链接]

新浪微博达人勋

发表于 2018-9-26 15:46:00 | 显示全部楼层 |阅读模式

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

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

x
各位,为什么我用模式算的数据画出来的图是这样的,有锯齿边缘的空白,要怎么解决,我画了一下700hpa的就不会出现这种情况
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
  a = addfile("/home/models/shuchu/201524h/wrfout_d01_2015-11-21_12:00:00.nc","r")
  type = "png"
  wks = gsn_open_wks(type,"/home/models/shuchu/201524h/plt_PressureLevel2")

  res = True
  res@MainTitle                   = "REAL-TIME WRF"
  res@Footer = False

  pltres = True
  mpres = True
  mpres@mpGeophysicalLineColor      = "Black"
  mpres@mpNationalLineColor         = "Black"
  mpres@mpUSStateLineColor          = "Black"
  mpres@mpGridLineColor             = "Black"
  mpres@mpLimbLineColor             = "Black"
  mpres@mpPerimLineColor            = "Black"
  mpres@mpGeophysicalLineThicknessF = 1.0
  mpres@mpGridLineThicknessF        = 1.0
  mpres@mpLimbLineThicknessF        = 1.0
  mpres@mpNationalLineThicknessF    = 1.0
  mpres@mpUSStateLineThicknessF     = 1.0
  mpres@mpDataBaseVersion           ="MediumRes"
  mpres@mpDataSetName               ="/home/models/shuchu/ncl/Earth..4"
  mpres@mpAreaMaskingOn             = True
  mpres@mpMaskAreaSpecifiers        = (/"China"/)
;  mpres@mpOutlineSpecifiers=(/"China","Beijing Shi","Tianjin Shi","Shanxi","Hebei","Shandong","Nei Mongol"/)
  mpres@mpOutlineSpecifiers         =(/"China","China:Provinces"/)

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

  pressure_levels = (/ 850., 700., 500., 300./)   ; pressure levels to plot
  nlevels         = dimsizes(pressure_levels)     ; number of pressure levels

  do it = 0,ntimes-1,1             ; TIME LOOP

    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
    u  = wrf_user_getvar(a,"ua",it)        ; u averaged to mass points
    v  = wrf_user_getvar(a,"va",it)        ; v averaged to mass points
    p  = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical coordinate
    z  = wrf_user_getvar(a, "z",it)        ; grid point height
    rh = wrf_user_getvar(a,"rh",it)        ; relative humidity
    u10 = a->U10(it,:,:)
    v10 = a->V10(it,:,:)

    do level = 0,nlevels-1                 ; LOOP OVER LEVELS

      pressure = pressure_levels(level)

      tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False)
      z_plane  = wrf_user_intrp3d( z,p,"h",pressure,0.,False)
      z_plane = z_plane/10
      z_plane@units = "dagpm"
      rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False)
      u_plane  = wrf_user_intrp3d( u,p,"h",pressure,0.,False)
      v_plane  = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
      wrf_smooth_2d(tc_plane,5)
      wrf_smooth_2d(z_plane,5)
      wrf_smooth_2d(rh_plane,5)
      wrf_smooth_2d(u_plane,5)
      wrf_smooth_2d(v_plane,5)
      wrf_smooth_2d(tc_plane,5)
      wrf_smooth_2d(z_plane,5)
      wrf_smooth_2d(rh_plane,5)
      wrf_smooth_2d(u_plane,5)
      wrf_smooth_2d(v_plane,5)
      wrf_smooth_2d(tc_plane,5)
      wrf_smooth_2d(z_plane,5)
      wrf_smooth_2d(rh_plane,5)
      wrf_smooth_2d(u_plane,5)
      wrf_smooth_2d(v_plane,5)
      wrf_smooth_2d(tc_plane,5)
      wrf_smooth_2d(z_plane,5)
      wrf_smooth_2d(rh_plane,5)
      wrf_smooth_2d(u_plane,5)
      wrf_smooth_2d(v_plane,5)
      spd     = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec
      spd@description = "Wind Speed"
      spd@units = "m/s"
      u_plane = u_plane*1.94386     ; kts
      v_plane = v_plane*1.94386     ; kts
      u_plane@units = "kts"
      v_plane@units = "kts"
      rh_plane=rh_plane

      ; Plotting options for T               
        opts = res                          
        opts@cnLineColor = "Red"
        opts@ContourParameters = (/ 5.0 /)
        opts@cnInfoLabelOrthogonalPosF = 0.07  ; offset second label information
        opts@gsnContourLineThicknessesScale = 2.0
        contour_tc = wrf_contour(a,wks,tc_plane,opts)
        delete(opts)

      ; Plotting options for RH               
        opts = res                          
        opts@cnFillOn = True  
        opts@pmLabelBarOrthogonalPosF = -0.1
        opts@ContourParameters = (/ 10., 90., 10./)
        opts@cnFillColors = (/"White","White","White", \
                              "White","Chartreuse","Green",\
                              "Green3","Green4", \
                              "ForestGreen","PaleGreen4"/)
        contour_rh = wrf_contour(a,wks,rh_plane,opts)
        delete(opts)

      ; Plotting options for Wind Speed               
        opts = res                          
        opts@cnLineColor = "MediumSeaGreen"
        opts@ContourParameters = (/ 10. /)
        opts@cnInfoLabelOrthogonalPosF = 0.07  ; offset second label information
        opts@gsnContourLineThicknessesScale = 3.0
        contour_spd = wrf_contour(a,wks,spd,opts)
        delete(opts)

      ; Plotting options for Wind Vectors                 
        opts                                =True
;       opts@FieldTitle = "Wind"   ; overwrite Field Title
;       opts@NumVectors = 47       ; wind barb density
  opts@gsnDraw                       = False              ; don't draw
  opts@gsnFrame                      = False              ; don't advance frame
  opts@gsnLeftString                 = ""
  opts@gsnRightString                = ""
  opts@vcRefMagnitudeF               = 20.                ; make vectors larger
  opts@vcRefLengthF                  = 0.020              ; ref vec length
  opts@vcGlyphStyle                  = "WindBarb"         ; select wind barbs
  opts@vcMinDistanceF                = 0.03               ; thin out windbarbs
  opts@vcWindBarbScaleFactorF        = 2.5
  opts@vcRefAnnoOn                   = False              ; remove reference vector
  opts@vcRefAnnoPerimOn              = False              ; remove reference box
  opts@vcRefAnnoString2              = " "                 ; remove "reference vector"
        vector = gsn_csm_vector(wks,u10,v10,opts)
        delete(opts)

      ; Plotting options for Geopotential Heigh
        opts_z = res                          
        opts_z@cnLineColor = "Blue"
        opts_z@gsnContourLineThicknessesScale = 3.0

      ; MAKE PLOTS                                       

        if ( pressure .eq. 850 ) then   ; plot temp, rh, height, wind barbs
;          opts_z@ContourParameters = (/ 10.0 /)
            opts_z@cnLevelSpacingF              = 1
            opts_z@cnLineLabelPlacementMode     = "Computed"
            opts_z@cnLineLabelInterval          = 1
           opts_z@cnLineLabelPerimOn           = False
           opts_z@cnLineLabelFontHeightF       = 0.009
          contour_height = wrf_contour(a,wks,z_plane,opts_z)
          plot = wrf_map_overlays(a,wks,(/contour_tc,contour_height, \
                                    contour_rh,vector/),pltres,mpres)
        end if

        if ( pressure .eq. 700 ) then   ; plot temp, height, wind barbs
          opts_z@ContourParameters = (/ 30.0 /)
          contour_height = wrf_contour(a,wks, z_plane,opts_z)
       ;   plot = wrf_map_overlays(a,wks,(/contour_tc,contour_height, \
       ;                             vector/),pltres,mpres)
        end if

        if ( pressure .eq. 500 ) then   ; plot temp, height, wind barbs
          opts_z@ContourParameters = (/ 60.0 /)
          contour_height = wrf_contour(a,wks, z_plane,opts_z)
       ;   plot = wrf_map_overlays(a,wks,(/contour_tc,contour_height, \
       ;                             vector/),pltres,mpres)
        end if

        if ( pressure .eq. 300 ) then   ; plot windspeed, height, wind barbs
          opts_z@ContourParameters = (/ 60.0 /)
          contour_height = wrf_contour(a,wks, z_plane,opts_z)
       ;   plot = wrf_map_overlays(a,wks,(/contour_spd,contour_height, \
       ;                             vector/),pltres,mpres)
        end if
        delete(opts_z)

    end do      ; END OF LEVEL LOOP

  end do        ; END OF TIME LOOP

end



plt_PressureLevel2.000002.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-9-26 15:54:01 | 显示全部楼层
空白区域是高海拔区域,例如青藏高原地面气压也大约在500多~600多。所以画不出来很正常。锯齿是因为你分辨率的问题
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-9-26 16:00:24 | 显示全部楼层
andrewsoong 发表于 2018-9-26 15:54
空白区域是高海拔区域,例如青藏高原地面气压也大约在500多~600多。所以画不出来很正常。锯齿是因为你分辨 ...

哈哈,学长你来了呀,一针见血呢,那我把空白部分mask掉就可以吗,还是在模式计算的时候做些什么处理呢,我只用了fnl资料
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-9-26 16:17:24 | 显示全部楼层
气象草鸟 发表于 2018-9-26 16:00
哈哈,学长你来了呀,一针见血呢,那我把空白部分mask掉就可以吗,还是在模式计算的时候做些什么处理呢, ...

没必要mask掉啊,放着很正常。要不就用更高分辨率的地形数据和强迫数据
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-9-26 16:19:37 | 显示全部楼层
andrewsoong 发表于 2018-9-26 16:17
没必要mask掉啊,放着很正常。要不就用更高分辨率的地形数据和强迫数据

哦哦,就是感觉这样放着不能放到论文中去,想看着好看点,行吧,我试试增加地形分辨率模拟下,谢谢学长啦
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-4-30 23:00:51 | 显示全部楼层
想问下你这是在在官网下的脚本之后自己改的吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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