- 积分
- 5783
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-9-28
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-8-24 21:25:30
|
显示全部楼层
其实我也觉得很疑惑,之前我处理一个nc数据,只写了 = “Vertical” 那一句就自动合适了,但是这次处理wrf输出数据就怎么样都不行。
脚本如下:
; 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"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("./wrfout_d01_1999-05-09_04:00:00","r")
; We generate plots, but what kind do we prefer?
; type = "x11"
; type = "pdf"
type = "ps"
; type = "ncgm"
wks = gsn_open_wks(type,"test3")
gsn_define_colormap(wks,"percent_11lev") ; overwrite the .hluresfile color map
; Set some basic resources
res = True
res@MainTitle = ""
res@cnInfoLabelOn = False ;close label on the right
res@NoHeaderFooter = True
res@pmLabelBarOrthogonalPosF = -1.25
res@lbLabelPosition="right"
res@lbOrientation = "Vertical"
mpres = True ; Map resources
pltres = True ; Plot resources
mpres@mpDataSetName="Earth..4"
mpres@mpOutlineOn = True
mpres@mpDataBaseVersion = "MediumRes"
mpres@mpOutlineSpecifiers=(/"China:states","Anhui","Jiangsu","Hubei"/)
mpres@mpProvincialLineThicknessF = 4
mpres@mpGeophysicalLineThicknessF = 4
mpres@mpGridLineThicknessF = 4
mpres@mpGeophysicalLineColor = "black"
mpres@mpProvincialLineColor ="black"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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 = ntimes-1,ntimes-1 ; TIME LOOP
it=ntimes-12
print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude
lon2d = wrf_user_getvar(a,"XLONG",it) ; longitude
if(isfilevar(a,"QICE"))
qia = wrf_user_getvar(a,"QICE",it)
qia = qia*1000.
qia@units = "g/kg"
end if
level=14
display_level = level + 1
; Plotting options for qi
opts = res
opts@cnLevelSelectionMode = "ExplicitLevels"
opts@cnLevels = (/ -0.16, -0.12, -0.08, -0.04, 0, 0.04, 0.08, \
0.12, 0.16,0.2/)
opts@cnFillOn = True
opts@cnInfoLabelOn = False
opts@cnConstFLabelOn = False
opts@cnFillOn = True
;----------------------------------------------------------------------
; Plot partial domain.
;----------------------------------------------------------------------
opts@sfXArray = lon2d
opts@sfYArray = lat2d
;---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 = 20.
mpres@mpRightCornerLatF = 40.
mpres@mpLeftCornerLonF = 100.
mpres@mpRightCornerLonF = 125.
if (isvar("qia"))
contour = wrf_contour(a,wks,qia(level,:,:),opts)
plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
delete(contour)
end if
delete(opts)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end
|
|