爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 17157|回复: 10

WRF结果用NCL画流场图求助

[复制链接]
发表于 2012-11-14 20:28:17 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 薇风拂尘 于 2012-11-14 20:31 编辑

这是我的脚本,画出来的图很奇怪,要么就是空白,求指点。



;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.
;   Interpolating to specified pressure levels

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

begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.

  a = addfile("wrfout_d01_2009-04-28_18_00_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,"streamline")
  res = True
;************************************************
; Use WRF_contributed procedure to set map resources
;************************************************
  ;WRF_map_c(a, res, 0)                   ; reads info from file

;************************************************
; if appropriate, set True for native mapping (faster)
; set False otherwise
;************************************************
; res@tfDoNDCOverlay       = True
;************************************************
; Turn on lat / lon labeling
;************************************************
  ;res@pmTickMarkDisplayMode = "Always"         ; turn on tickmarks

  res@mpDataBaseVersion="MediumRes"
  res@mpDataSetName="Earth..4"
  res@mpOutlineSpecifiers="China:Provinces"
  res@mpFillOn=False
  res@mpGridAndLimbOn=False
;  res@mpGeophysicalLineColor      = "Black"
;  res@mpNationalLineColor         = "Black"
;  res@mpUSStateLineColor          = "Black"
;  res@mpGridLineColor             = "Black"
;  res@mpLimbLineColor             = "Black"
;  res@mpPerimLineColor            = "Black"
;  res@mpGeophysicalLineThicknessF = 1.0
;  res@mpGridLineThicknessF        = 1.0
;  res@mpLimbLineThicknessF        = 1.0
;  res@mpNationalLineThicknessF    = 1.0
;  res@mpUSStateLineThicknessF     = 1.0

res@mpMinLatF            =38.                  ; zoom in on map
res@mpMaxLatF            = 44.
res@mpMinLonF            = 110.
res@mpMaxLonF            = 120.

res@tmYLMode="Explicit"
res@tmYLValues=(/38,39,40,41,42,43,44/)
res@tmYLLabels=(/"38","39","40","41","42","43","44N"/)

res@tmXBMode="Explicit"
res@tmXBValues=(/110,112,114,116,118,120/)
res@tmXBLabels=(/"110","112","114","116","118","120E"/)



res@gsnLeftString=" "
res@gsnRightString=" "
res@stLineColor="Blue"
res@stArrowLengthF     = 0.004                    ; size of the arrows

res@stMinArrowSpacingF = 0.001                  ; arrow spacing.
  res@stArrowStride      = 2                     ; arrows start every third


res@stLineColor="Blue"
res@stMinDistanceF=0.03
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; What times and how many time steps are in the data set?
  times  = wrf_user_list_times(a)  ; get times in the file
  ntimes = dimsizes(times)         ; number of times in the file

; The specific pressure levels that we want the data interpolated to.
  pressure_levels = (/ 1000.,925.,850., 700., 500./)   ; pressure levels to plot
  nlevels         = dimsizes(pressure_levels)           ; number of pressure levels

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

  do it = 7,8              ; TIME LOOP

    print("Working on time: " + times(it) )
;    res@TimeLabel = times(it)   ; Set Valid time to use on plots

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        

    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
    z=0.1*z
    rh = wrf_user_getvar(a,"rh",it)        ; relative humidity
  lat2 = wrf_user_getvar(a,"XLAT",0)
  lon2 = wrf_user_getvar(a,"XLONG",0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    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)
      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)
printVarSummary(u_plane)
      ;u_plane = u_plane*1.94386     ; kts
      ;v_plane = v_plane*1.94386     ; kts
      u_plane@units = "m/s"
      v_plane@units = "m/s"


plot=gsn_csm_streamline_map(wks,u_plane,v_plane,res)

    end do      ; END OF LEVEL LOOP
  end do        ; END OF TIME LOOP

end

1.jpg






file:///C:\Users\sparrow\AppData\Roaming\Tencent\Users\245450868\QQ\WinTemp\RichOle\5{RYDU_D00JWIPHVLLTR8PD.jpg


密码修改失败请联系微信:mofangbao
发表于 2012-11-19 09:20:26 | 显示全部楼层
楼主解决了可以分享一下给大家啊
密码修改失败请联系微信:mofangbao
发表于 2012-12-29 22:56:33 | 显示全部楼层
不知你解决没
密码修改失败请联系微信:mofangbao
发表于 2014-10-22 07:46:38 | 显示全部楼层
楼主解决了吗??
密码修改失败请联系微信:mofangbao
发表于 2015-1-15 13:55:31 | 显示全部楼层
不错啊,就是不知道能不能用啊
密码修改失败请联系微信:mofangbao
发表于 2015-5-7 18:01:29 | 显示全部楼层
老师解决了吗
密码修改失败请联系微信:mofangbao
发表于 2015-5-7 18:01:55 | 显示全部楼层
学习一下~~~~~~~~~
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2016-1-28 13:05:50 | 显示全部楼层
{:5_275:}{:5_275:}{:5_275:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2016-6-14 11:37:32 | 显示全部楼层
楼主,看了你画流场图的ncl脚本,就是用你的脚本画出来的流场线就只有1条,请教楼主,这个问题你解决了吗?应该如何处理?谢谢
密码修改失败请联系微信:mofangbao
发表于 2016-6-14 17:38:53 | 显示全部楼层
我表示看不懂,学习中……
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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