- 积分
- 6207
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-9-26
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-7-15 12:14:34
|
显示全部楼层
所用脚本如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("/nuist/scratch/wrf/wrfout/wrfout_d02_2015-06-27_06: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,"qr-yuan-32.15")
gsn_define_colormap(wks,"BlueDarkRed18")
; Set some basic resources
res = True
; res@MainTitle = "REAL-TIME WRF"
res@gsnMaximize = True
res@Footer = False
res@gsnDraw = True ; Forces the plot to be drawn
res@gsnFrame = True ; Frame advance
;res@tmYRMode = "Explicit"
;res@tmYRValues = fspan(0,96,11)
;res@tmYLValues = fspan(0,96,11)
res@tmXBMode = "Explicit"
res@tmXBValues = fspan(0,92,4) ; Create tick marks
res@tmXBLabels = sprintf("%.1f",fspan(104,107,4)) ; Create labels
;res@tmYLLabels = sprintf("%4.1f",fspan(0,20,11))
res@tmXTOn = False
pltres = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
times = wrf_user_getvar(a,"times",-1) ; get times in the file
ntimes = dimsizes(times) ; number of times in the file
FirstTime = True
mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file
nd = dimsizes(mdims)
;---------------------------------------------------------------
do it = 0,49,1
print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots
tc = wrf_user_getvar(a,"tc",it) ; T in C
rcaccr01 = wrf_user_getvar(a,"RCACCR",it) ;ice water mixed ratio
rcaccr = rcaccr01*1000000.0
qmlgr01 = wrf_user_getvar(a,"QMLGR",it) ;ice water mixed ratio
qmlgr = qmlgr01*1000000.0
qmlsr01 = wrf_user_getvar(a,"QMLSR",it) ;cloud water mixed ratio
qmlsr = qmlsr01*1000000.0
w = wrf_user_getvar(a,"wa",it)
u = wrf_user_getvar(a,"ua",it)
z = wrf_user_getvar(a, "z",it) ; grid point height
if ( FirstTime ) then ; get height info for labels
zmin = 0.
zmax = max(z)/1000.
;zmax = 12000/1000
nz = floattoint(zmax/2 + 1)
FirstTime = False
end if
;---------------------------------------------------------------
; Plot a cross session that run from point A to point B
loc1 = wrf_user_latlon_to_ij(a,32.15,104)
loc2 = wrf_user_latlon_to_ij(a,32.15,107)
plane = new(4,float)
;plane=(/120,30, 80,120/)
plane=(/loc1(1),loc2(1), loc1(0),loc2(0)/) ; start x;y & end x;y point
print(dimsizes(plane))
opts = True ; start and end points specified
tc_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)
rcaccr_plane = wrf_user_intrp3d(rcaccr,z,"v",plane,0.,opts)
qmlgr_plane = wrf_user_intrp3d(qmlgr,z,"v",plane,0.,opts)
qmlsr_plane = wrf_user_intrp3d(qmlsr,z,"v",plane,0.,opts)
w_plane = wrf_user_intrp3d(w,z,"v",plane,0.,opts)
u_plane = wrf_user_intrp3d(u,z,"v",plane,0.,opts)
; u_plane!1="latitude" ; u_plane&latitude=lat
dim = dimsizes(u_plane) ; Find the data span - for use in labels
zspan = dim(0)
; Options for XY Plots
opts_xy = res
opts_xy@tiYAxisString = "Height (km)"
;opts_xy@cnMissingValPerimOn = True
opts_xy@cnMissingValFillColor = 0
opts_xy@cnMissingValFillPattern = 11
opts_xy@tmYLMode = "Explicit"
;opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks
;opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz))
; Create labels ;
opts_xy@tiXAxisFontHeightF = 0.020
opts_xy@tiYAxisFontHeightF = 0.020
opts_xy@tmXBMajorLengthF = 0.02
opts_xy@tmYLMajorLengthF = 0.02
opts_xy@tmYLLabelFontHeightF = 0.015
; opts_xy@PlotOrientation = tc_plane@Orientation
opts_xy@cnInfoLabelOn = False
; Plotting options for Temperature
opts_tc = opts_xy
opts_tc@cnInfoLabelOrthogonalPosF = 0.00
; opts_tc@cnLineColor = "slategray"
opts_tc@ContourParameters = (/ -80, 20, 10 /)
; Plotting options for qice
opts_rcaccr = opts_xy
opts_rcaccr@ContourParameters = (/1, 25, 2 /)
opts_rcaccr@cnLineThicknessF = 3
opts_rcaccr@gsnContourPosLineDashPattern = 1
; opts_rcaccr@pmLabelBarOrthogonalPosF = -0.07
opts_rcaccr@cnFillOn = False
; plotting options for qcloud
opts_qmlgr = opts_xy
opts_qmlgr@ContourParameters = (/10, 150, 30 /)
opts_qmlgr@cnLineThicknessF = 3
opts_qmlgr@pmLabelBarOrthogonalPosF = -0.07
opts_qmlgr@cnFillOn = False
;opts_qmlgr@cnLevelSelectionMode = "ExplicitLevels"
;opts_qmlgr@cnLevels = (/1,10,50,100,150,200,250/)
; plotting options for qcloud
opts_qmlsr = opts_xy
opts_qmlsr@ContourParameters = (/1, 25, 2 /)
opts_qmlsr@cnLineThicknessF = 3
opts_qmlsr@pmLabelBarOrthogonalPosF = -0.07
opts_qmlsr@cnFillOn = False
; plotting options for w
opts_w = opts_xy
opts_w@FieldTitle = "Wind" ; overwrite Field Title
opts_w@cnFillOn = True
opts_w@ContourParameters = (/-2, 8, 1 /)
opts_w@cnFillColors =(/3,5,0,0,12,13,14,15,16,17,18,19/)
; Get the contour info for the qrain qsi and temp
contour_tc = wrf_contour(a,wks,tc_plane,opts_tc)
contour_rcaccr = wrf_contour(a,wks,rcaccr_plane,opts_rcaccr)
contour_qmlgr = wrf_contour(a,wks,qmlgr_plane,opts_qmlgr)
contour_qmlsr = wrf_contour(a,wks,qmlsr_plane,opts_qmlsr)
contour_w = wrf_contour(a,wks,w_plane,opts_w)
; MAKE PLOTS
plot = wrf_overlays(a,wks,(/contour_tc,contour_rcaccr,contour_qmlgr,contour_qmlsr/),res)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end do ; END OF TIME LOOP
end
|
|