立即注册 登录
气象家园 返回首页

MDAmike的个人空间 http://bbs.06climate.com/?63836 [收藏] [复制] [分享] [RSS]

日志

NCL相对湿度、气压场和风场绘图脚本---wrfout

已有 122 次阅读2020-9-4 09:50 |个人分类:NCL脚本

作者:tentne's world

链接:https://www.lofter.com/lpost/1f3cfc6d_12ace4e6b

来源:LOFTER

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/WRF_contributed.ncl"

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

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

begin

  a = addfile("./wrfout_d02_2016-07-19_00:00:00.nc","r")

 ; a = addfile("./wrfout_d02_2016-07-20_00:00:00.nc","r")

 ; a = addfile("./wrfout_d02_2016-07-21_00:00:00.nc","r")

  type = "png"

  wks = gsn_open_wks(type,"plt_HeightLevel")

  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@mpDataBaseVersion      = "Ncarg4_1"

  mpres@mpAreaMaskingOn        = True

  mpres@mpMaskAreaSpecifiers   =(/"China"/)

  mpres@mpOutlineSpecifiers    = (/"China","China:Provinces"/)

  times = wrf_user_getvar(a,"times",-1)   

  ntimes = dimsizes(times)         

  height_levels = (/ 250., 2000./)   

  nlevels       = dimsizes(height_levels)     

  do it = 0,ntimes-1,2             

    print("Working on time: " + times(it) )

    res@TimeLabel = times(it)       

    u  = wrf_user_getvar(a,"ua",it)        

    v  = wrf_user_getvar(a,"va",it)       

    p  = wrf_user_getvar(a, "pressure",it) 

    z  = wrf_user_getvar(a, "z",it)       

    rh = wrf_user_getvar(a,"rh",it)      

    do level = 0,nlevels-1                

      height = height_levels(level) 

      p_plane  = wrf_user_intrp3d( p,z,"h",height,0.,False)

      rh_plane = wrf_user_intrp3d(rh,z,"h",height,0.,False)

      u_plane  = wrf_user_intrp3d( u,z,"h",height,0.,False)

      v_plane  = wrf_user_intrp3d( v,z,"h",height,0.,False)

      u_plane = u_plane*1.94386     ; kts

      v_plane = v_plane*1.94386     ; kts

      u_plane@units = "kts"

      v_plane@units = "kts"

  ; Plotting options for Pressure

      opts = res                          

      opts@cnLineColor = "Blue"

      opts@gsnContourLineThicknessesScale = 3.0

      contour_p = wrf_contour(a,wks,p_plane,opts)

      delete(opts)

 ; Plotting options for RH                

      opts = res                          

      opts@cnFillOn = True  

      opts_r@cnLevelSelectionMode = "ExplicitLevels"

      opts_r@cnLevels             = (/ 10, 20, 30, 40, 50, 60, 70,80, 90, 100/)

      opts_r@cnFillColors         = (/"White","White","White","DarkOliveGreen3", "Chartreuse", "Chartreuse3","Green","ForestGreen", "Yellow","Orange"/)

      contour_rh = wrf_contour(a,wks,rh_plane,opts)

      delete(opts)

 ; Plotting options for Wind Vectors                 

      opts = res          

      opts@FieldTitle = "Wind"   ; overwrite Field Title

      opts@NumVectors = 30       ; wind barb density

      vector = wrf_vector(a,wks,u_plane,v_plane,opts)

      delete(opts)

    ; MAKE PLOTS                                       

      plot = wrf_map_overlays(a,wks,(/contour_rh,contour_tc, vector/),pltres,mpres)

    end do      

  end do        

end

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

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

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

返回顶部