爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4676|回复: 9

关于NCL标题显示的问题

[复制链接]

新浪微博达人勋

发表于 2015-11-15 21:40:54 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图:
问题概况: 本人刚学WRF和NCL,用官网脚本画了一幅图如下。有三个问题不知道怎么解决。1右上角Init和Valid显示不全。2图像上方的三个小标题之间用~C~连接,为啥不是管网上那种显示三行。3右下角两个contour说明也显示不全。先谢谢大家了!!
我看过提问的智慧: 看过
自己思考时长(天): 1

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

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

x
{:mad:}
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-11-16 10:16:12 | 显示全部楼层
没人帮下忙啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-11-16 12:59:04 | 显示全部楼层
能提供一点儿你使用的官网上例子的网址吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-11-16 15:02:37 | 显示全部楼层
风之精灵 发表于 2015-11-16 12:59
能提供一点儿你使用的官网上例子的网址吗?

http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/NCL_examples.htm
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-11-17 08:41:10 | 显示全部楼层
你实际上用的应该是http://www2.mmm.ucar.edu/wrf/OnL ... f_PressureLevel.htm上面的例子,把你的绘图脚本也贴上来了吧,对比一下
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-11-17 20:08:30 | 显示全部楼层
风之精灵 发表于 2015-11-17 08:41
你实际上用的应该是http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/LEVELS_INTERP/wr ...

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

  a = addfile("/data1/home/WRF/WRFV3/test/em_real/wrfout_d01_2012-01-16_00:00:00.nc","r")
  type = "ps"
  wks = gsn_open_wks(type,"plt_PressureLevel3")
; Set some Basic Plot options
  res = True
  res@MainTitle                   = "REAL-TIME WRF"
  res@Footer = False

  pltres = True                     ;plot option
  mpres = True                      ; map option
  mpres@mpGeophysicalLineColor      = "Black"
  mpres@mpNationalLineColor         = "Black"
  mpres@mpUSStateLineColor          = "Black"
  mpres@mpGridLineColor             = "Black"
  mpres@mpLimbLineColor             = "Black"
  mpres@mpPerimLineColor            = "Black"
  mpres@mpGeophysicalLineThicknessF = 2.0
  mpres@mpGridLineThicknessF        = 2.0
  mpres@mpLimbLineThicknessF        = 2.0
  mpres@mpNationalLineThicknessF    = 2.0
  mpres@mpUSStateLineThicknessF     = 2.0

  times = wrf_user_list_times(a) ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need

    tc = wrf_user_getvar(a,"tc",-1)        ; T in C
    u  = wrf_user_getvar(a,"ua",-1)        ; u averaged to mass points
    v  = wrf_user_getvar(a,"va",-1)        ; v averaged to mass points
    p  = wrf_user_getvar(a, "pressure",-1) ; pressure is our vertical coordinate
    z  = wrf_user_getvar(a, "z",-1)        ; grid point height
    rh = wrf_user_getvar(a,"rh",-1)        ; relative humidity

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

  tc_plane = wrf_user_intrp3d(tc,p,"h",pressure_levels,0.,False)
  z_plane  = wrf_user_intrp3d( z,p,"h",pressure_levels,0.,False)
  rh_plane = wrf_user_intrp3d(rh,p,"h",pressure_levels,0.,False)
  u_plane  = wrf_user_intrp3d( u,p,"h",pressure_levels,0.,False)
  v_plane  = wrf_user_intrp3d( v,p,"h",pressure_levels,0.,False)

  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"


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

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

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


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

      pressure = pressure_levels(level)

      ; Add some level info to the plot
        res@PlotLevelID = pressure + " hPa"

      ; 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(it,level,:,:),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(it,level,:,:),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(it,level,:,:),opts)
        delete(opts)

      ; Plotting options for Wind Vectors
        opts = res
        opts@FieldTitle = "Wind"   ; overwrite Field Title
        opts@NumVectors = 47       ; wind barb density
        vector = wrf_vector(a,wks,u_plane(it,level,:,:),v_plane(it,level,:,:),opts)
        delete(opts)

      ; Plotting options for Geopotential Height
        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 = (/ 20.0 /)
          contour_height = wrf_contour(a,wks,z_plane(it,level,:,:),opts_z)
          plot = wrf_map_overlays(a,wks,(/contour_rh,contour_tc,contour_height, \
                                    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(it,level,:,:),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(it,level,:,:),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(it,level,:,:),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
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-11-17 20:12:06 | 显示全部楼层
我除了修改了一下路径,输出改为ps还把times = wrf_user_getvar(a,"times",-1)改成times = wrf_user_list_times(a)外(因为开始那个读时间有问题),其他的都没变,但就是画的不一样,就算输出改为X11也是这样,见了鬼。。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-11-18 09:25:12 | 显示全部楼层
拖把 发表于 2015-11-17 20:12
我除了修改了一下路径,输出改为ps还把times = wrf_user_getvar(a,"times",-1)改成times = wrf_user_list_t ...

暂时我也没找到原因,sorry
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-11-18 13:49:44 | 显示全部楼层
风之精灵 发表于 2015-11-18 09:25
暂时我也没找到原因,sorry

已经解决了,是版本的问题,我把之前那个ncl卸载了。重新装了一个最新版的就可以了。不过还是谢谢你
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-11-18 14:51:02 | 显示全部楼层
拖把 发表于 2015-11-18 13:49
已经解决了,是版本的问题,我把之前那个ncl卸载了。重新装了一个最新版的就可以了。不过还是 ...

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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