爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6801|回复: 0

ncl时间坐标问题

[复制链接]

新浪微博达人勋

发表于 2015-6-14 09:46:04 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 daxuanfang 于 2015-6-14 09:49 编辑

    NCL作图时,利用WRF_time_c函数时,出现如下错误:
Undefined identifier: (ut_inv_calendar) is undefined, can't continue
Error occurred at or near line 55 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 283 in file $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/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
begin
f      = addfile("/home/guj/wrf/WRFV3/run/wrfoutd03_89KFW.nc","r")
w      = wrf_user_getvar(f,"QICE",-1)
tc     = wrf_user_getvar(f,"tc",-1)
lev    = wrf_user_getvar(f,"pressure",-1)
ter = wrf_user_getvar(f,"HGT",1)   
dims = dimsizes(ter)
Times  = wrf_user_getvar(f,"Times",-1)
times  = wrf_times_c(Times,0)
ntimes = dimsizes(times)   
res = True
res@MainTitle                   = "REAL-TIME WRF"
pltres            = True   ; Set plot options
pltres@PanelPlot  = True   ; Tells wrf_map_overlays not to remove contours
mpres             = True   ; Set map options
mpres@mpOutlineOn = False
mpres@mpFillOn    = False   
; As an example, we are looking for the lower right 1/4 of the domain
x_start = dims(1)/8
x_end   = dims(1)/2
y_start = dims(0)/5
y_end   = dims(0)/2
mpres@ZoomIn = True
mpres@Xstart = x_start
mpres@Ystart = y_start
mpres@Xend = x_end
mpres@Yend = y_end

w_zoom  = w(:,:,y_start:y_end,x_start:x_end)
w_zoom@description = w@description
out = dim_max_n_Wrap(w_zoom, (/2,3/))
;out=out*1000
;out@units="g/kg"
out!1="lev"
out&lev=lev(0, :, 0, 0)
tc_zoom  = tc(:,:,y_start:y_end,x_start:x_end)
tc_zoom@description = tc@description
outtc=dim_max_n_Wrap(tc_zoom, (/2,3/))
outtc!1="lev"
outtc&lev=lev(0, :, 0, 0)
;================================================
; plot
;================================================
   wks   = gsn_open_wks ("pdf", "ice")
  gsn_define_colormap(wks,"WhViBlGrYeOrRe")
  ;gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")                ; choose colormap
  res                      = True                  ; plot mods desired
res@cnFillOn             = True                  ; turn on color
  res@cnLinesOn            = False                 ; no contour lines
  res@cnFillOn             = True
;---This resource not needed in V6.1.0
  res@gsnSpreadColors      = True                  ; use full range of colors
;---This resource defaults to True in NCL V6.1.0
  res@lbLabelAutoStride    = True                  ; optimal labels
  ;res@cnLevelSelectionMode = "ManualLevels"       ; set manual contour levels
  ;;res@cnMinLevelValF       = -40                  ; set min contour level
  ;res@cnMaxLevelValF       = 20                  ; set max contour level
  ;res@cnLevelSpacingF      = -10                 ; set contour spacing
;--set labelbar
  res@pmLabelBarSide       ="Right"
  res@pmLabelBarWidthF     =0.12
  res@lbLabelFontHeightF   = 0.015
  res@lbOrientation        = "Vertical"
  res@pmLabelBarOrthogonalPosF = 0.06
  res@gsnLeftString = out@description  + " (" + out@units + ")~C~" + \
                          tc_zoom@description + " (" + tc_zoom@units + ")~C~"
  res@gsnRightString=""                  
  
  res@tmXTOn      = False
  
  restick           = True
  restick@ttmFormat = "%H:%M"
  time_axis_labels(times,res,restick)
  
  restc                      = True                  ; plot mods desired  res@cnFillOn             = True                  ; turn on color
  restc@cnLinesOn            = True                ; no contour lines
  restc@cnMonoLineDashPattern  = True
  restc@cnLevelSelectionMode = "ExplicitLevels"       ; set manual contour levels
  restc@cnLevels             = ispan(-40,0,10)   ; set the contour levels
;---This resource not needed in V6.1.0
  restc@gsnSpreadColors      = True                  ; use full range of colors
;---This resource defaults to True in NCL V6.1.0
  restc@lbLabelAutoStride    = True        
  plot = gsn_csm_pres_hgt (wks, out(lev|:, Time|12:96),res)
  plot1 = gsn_csm_pres_hgt (wks, outtc(lev|:, Time|12:96),restc)
  overlay(plot,plot1)
  draw(plot)
  frame(wks)
end

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

本版积分规则

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

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

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