- 积分
- 900
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-8-14
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2014-9-14 16:18:07
|
显示全部楼层
; Example script to produce plots for a WRF real-data run,
; with the ARW coordinate dynamics option.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "./WRFUserARW.ncl"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("./wrfrec_20121127.nc","r")
; We generate plots, but what kind do we prefer?
type = "pdf"
; type = "png"
; type = "pdf"
; type = "ps"
; type = "ncgm"
wks = gsn_open_wks(type,"aaa")
; Set some basic resources
res = True
res@MainTitle = "REAL-TIME WRF"
pltres = True
mpres = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
times = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
do it = 0,ntimes-1,1 ; TIME LOOP
print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
slp = wrf_user_getvar(a,"slp",it) ; slp
wrf_smooth_2d( slp, 3 ) ; smooth slp
tc = wrf_user_getvar(a,"tc",it) ; 3D tc
u = wrf_user_getvar(a,"ua",it) ; 3D U at mass points
v = wrf_user_getvar(a,"va",it) ; 3D V at mass points
tc2 = wrf_user_getvar(a,"T2",it) ; T2 in Kelvin
tc2 = tc2-273.16 ; T2 in C
u10 = wrf_user_getvar(a,"U10",it) ; u at 10 m, mass point
v10 = wrf_user_getvar(a,"V10",it) ; v at 10 m, mass point
tc2@description = "Surface Temperature"
tc2@units = "C"
u10@units = "m/s"
v10@units = "m/s"
; Plotting options for T
opts = res
opts@cnFillOn = True
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
res@gsnSpreadColors=True
opts@ContourParameters = (/ -40., 30., 4./)
opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map
contour_tc = wrf_contour(a,wks,tc2,opts)
delete(opts)
; Plotting options for SLP
opts = res
opts@cnLineColor = "Red"
opts@cnHighLabelsOn = True
opts@cnLowLabelsOn = True
opts@ContourParameters = (/ 900., 1100., 4. /)
opts@cnLineLabelBackgroundColor = -1
opts@gsnContourLineThicknessesScale = 2.0
contour_psl = wrf_contour(a,wks,slp,opts)
delete(opts)
; Plotting options for Wind Vectors
opts = res
opts@FieldTitle = "Wind" ; overwrite Field Title
opts@NumVectors = 47 ; density of wind barbs
vector = wrf_vector(a,wks,u10,v10,opts)
delete(opts)
;Plotting Provincial boundary
mpres@mpMinLatF = 34.5
mpres@mpMaxLatF = 38.5
mpres@mpMinLonF = 114.5
mpres@mpMaxLonF = 122.5
mpres@mpDataBaseVersion="MediumRes"
mpres@mpDataSetName="Earth..4"
mpres@mpGeophysicalLineColor = "Black"
mpres@mpNationalLineColor = "Black"
mpres@mpGridLineColor = "Black"
mpres@mpLimbLineColor = "Black"
mpres@mpPerimLineColor = "Black"
mpres@mpUSStateLineThicknessF = 2
mpres@mpNationalLineThicknessF = 2
mpres@mpUSStateLineColor="Black"
mpres@mpOutlineSpecifiers="China:states"
; MAKE PLOTS
plot = wrf_map_overlays(a,wks,(/contour_tc,contour_psl,vector/),pltres,mpres)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end do ; END OF TIME LOOP
end |
|