- 积分
- 1095
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-4-3
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
感觉是个挺蠢的问题,但是一直找不到解决方法,我的数据只用到106小时,而折线X轴却一直延伸到120,出现了一段空余区域,这种情况要如何解决?以下是脚本
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"
begin
;---Read in data
; f = addfile("wrfchem1/WRFV3/test/em_real/wrfout_d02_2016-11-03_11:00:00","r")
; t = f->T2(0,:,:) ; get t data
; lat = f->XLAT(0,:,50)
; lat@unit = "degree_north"
; lon = f->XLONG(0,:,50)
; t2=t-273
; t2!0 = "lat"
; t2&lat = lat
fils = systemfunc ("ls wrfchem1/WRFV3/test/em_real/wrfout_d02*") ; Open netCDF file.
f = addfiles(fils,"r")
ListSetType(f,"cat")
t := f[:]->T2
lat = f[:]->XLAT(0,:,100)
lat@unit = "degree_north"
t!0 = "time"
t!1 = "lat"
t&lat = lat
lon = f[:]->XLONG(0,50,:)
lon@unit = "degree_east"
ffils = systemfunc ("ls ncar/fnl*") ; Open netCDF file.
fin = addfiles(ffils,"r")
ListSetType(fin,"join")
; p = fin[:]->TMP_P0_L1_GLL0
p := fin[:]->TMP_P0_L103_GLL0
date = ispan(0,107,6)
; t@lat2d = f[:]->XLAT(0,:,:)
; t@lon2d = f[:]->XLONG(0,:,:)
printVarSummary(p)
printVarSummary(t)
;---To plot multiple lines, you must put them into a mulidimensional array.
data = new((/2,18/),float)
data(0,:) := t(0:107:6,120,64)
data(1,:) := p(0:17:1,0,{39},{117})
wks = gsn_open_wks ("png","xy2") ; send graphics to PNG file
;---Set plotting parameters
res = True ; plot mods desired
res@gsnFrame = False
res@tiMainString = "2m Temperature" ; add title
res@tiXAxisString = "Time(hour)"
res@tiYAxisString = "Temperature(K)"
res@xyLineThicknesses = (/ 1.0, 2.0/) ; make second line thicker
res@xyLineColors = (/"blue","red"/) ; change line color
res@tmXTOn = False
res@tmYROn = False
plot = gsn_csm_xy (wks,date,data,res) ; create plot
lgres = True
lgres@vpWidthF = 0.2
lgres@vpHeightF = 0.1
lgres@lgLabelFontHeightF = 0.06
lgres@lgPerimOn = False
lgres@lgLineColors = (/"blue","red"/)
lgres@lgLineThicknessF = (/6,6/)
lgres@lgDashIndex =(/0,12/)
gsn_legend_ndc(wks,2,(/"RRTMG","OBS"/),0.55,0.3,lgres)
frame(wks)
end
|
|