- 积分
- 1502
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|
NCL
系统平台: |
|
问题截图: |
- |
问题概况: |
自己画横坐标,想直接用wrfout的时间来做横坐标,从网站上找到这个例子,看了函数讲解自己试着用了一下,还有一些不懂的
time_axis_labels(times,res,restick)怎么把wrf_times_c提取出来的时间数列转化啊,还有wrf_times_c的四种opt,0、1、2、3提取出来的时间格式都可以用time_axis_labels转化吗? |
我看过提问的智慧: |
看过 |
自己思考时长(天): |
3 |
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
自己画横坐标,想直接用wrfout的时间来做横坐标,从网站上找到这个例子(如下),看了函数讲解自己试着用了一下,还有一些不懂的
time_axis_labels(times,res,restick)怎么把wrf_times_c提取出来的时间数列转化啊,还有wrf_times_c的四种opt,0、1、2、3提取出来的时间格式都可以用time_axis_labels转化吗?
我自己在例子的基础上改的,提取每个wrfout数据的前24个时间序列并把它们连起来,用time_axis_labels,wrf_times_c画图,提示fatal:Argument type mismatch on argument (0) of (time_axis_labels) can not coerce
可能是我对这两个函数还不是很熟悉,不知道问题出在哪了,求大神指点迷津
--------------------------------------------------------
; time_labels_3.ncl
;
; Concepts illustrated:
; - Drawing a time series plot
; - Labeling the X axis with nicely-formatted time labels
; - Converting WRF Times variable to numeric values
; - Removing trailing zeros from tickmark labels
; - Changing the width and height of a plot
;----------------------------------------------------------------------
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
;---Get some data to plot
filename = "wrfout_d01_000000_25time.nc"
a = addfile(filename,"r")
slp = wrf_user_getvar(a,"slp",-1) ; sea level pressure
slp_avg = dim_avg_n_Wrap(slp,(/1,2/)) ; Average across all lat/lon
;--------------------------------------------------
; The "Times" on the file are in the format:
;
; 2001-06-11_12:00:00
; 2001-06-11_13:00:00
; ...
;
; Convert this to values representing
; "hours since 2001-06-11 12:00:00"
;--------------------------------------------------
times = wrf_times_c(a->Times,0)
ntimes = dimsizes(times)
;---Start the graphics
wks = gsn_open_wks("ps","time_labels")
;---Plotting options for time series plot
res = True
res@gsnMaximize = True
res@vpWidthF = 0.8
res@vpHeightF = 0.3
res@tmXTOn = False
res@tmYLFormat = "f" ; remove trailing ".0"
;--------------------------------------------------
; The time_axis_label function adds additional
; resources to "res" to produce nicely-formatted
; time labels on X axis. This function only works
; if you have a time "units" recognized by the
; cd_calendar function.
;--------------------------------------------------
restick = True
restick@ttmFormat = "%N/%D %H:%M"
time_axis_labels(times,res,restick)
;print(res)
res@tiMainString = filename
res@tiYAxisString = "Average slp (" + slp_avg@units + ")"
res@tiMainFontHeightF = 0.025
res@tiYAxisFontHeightF = 0.02
plot = gsn_csm_xy(wks,times,slp_avg,res)
end
|
|