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

楼主 |
发表于 2014-9-16 22:02:35
|
显示全部楼层
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;---Open WRF output file and read data
dir = "./"
filename = "wrfreckm912_20131211.nc"
a = addfile(dir + filename,"r")
wks = gsn_open_wks("png","wrf9_latlonoverlay")
res = True
times = wrf_user_getvar(a,"times",-1) ; get times in the file
ntimes = dimsizes(times) ; number of times in the file
;---Just look at first time step.
do it = 0,ntimes-1,1
print("Working on time: " + times(it) )
;---Read temperature and terrain height off file
tc2 = wrf_user_getvar(a,"T2",it)
tc2 = tc2-273.16 ; T in C
slp = wrf_user_getvar(a,"slp",it) ; slp
wrf_smooth_2d( slp, 3 ) ; smooth slp
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
lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude
lon2d = wrf_user_getvar(a,"XLONG",it) ; longitude
dims = dimsizes(tc2)
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,"BlWhRe")
res@gsnSpreadColors=True
opts@ContourParameters = (/ -15., 15., 1./)
opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map
opts@sfXArray = lon2d
opts@sfYArray = lat2d
contour = 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
opts@sfXArray = lon2d
opts@sfYArray = lat2d
contour_psl = wrf_contour(a,wks,slp,opts)
delete(opts)
; Plotting options for Wind Vectors
opts = res
res@gsnDraw = True ; Forces the plot to be drawn
res@gsnFrame = True ; Frame advance
opts@FieldTitle = "Wind" ; overwrite Field Title
opts@vcGlyphStyle ="WindBarb"
opts@vfXArray=lon2d
opts@vfYArray=lat2d
vector = wrf_vector(a,wks,u10,v10,opts)
delete(opts)
;---Set some basic plot options
opts = True
opts@MainTitle = "REAL-TIME WRF"
pltres = True
mpres = True
opts@TimeLabel = times(it) ; Set valid time to use on plots
;----------------------------------------------------------------------
; Plot partial domain.
;----------------------------------------------------------------------
;---Set special resource to indicate we are using XLAT/XLONG coordinates.
pltres@LatLonOverlay = True
;---Zoom in on map, which we can do because we're using lat/lon coordinates.
mpres@mpLeftCornerLatF = 34.
mpres@mpRightCornerLatF = 39.
mpres@mpLeftCornerLonF = 114.
mpres@mpRightCornerLonF = 124.
mpres@mpDataBaseVersion="MediumRes"
mpres@mpDataSetName="Earth..4"
mpres@mpGeophysicalLineColor = "Black"
mpres@mpGridLineColor = "Black"
mpres@mpLimbLineColor = "Black"
mpres@mpPerimLineColor = "Black"
mpres@mpUSStateLineThicknessF = 2
mpres@mpUSStateLineColor="Black"
mpres@mpOutlineSpecifiers="China:states"
mpres@mpNationalLineColor = "Black"
mpres@mpNationalLineThicknessF = 2
plot = wrf_map_overlays(a,wks,(/contour,contour_psl,vector/),pltres,mpres)
end do
end
|
|