- 积分
- 79
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-12-22
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2016-12-13 13:46:46
|
显示全部楼层
这是我的脚本,之前可以做出气象图,就是不知道怎么添加地图,插入地图脚本就一直报错,说是语法错误,希望您麻烦看一下
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/wrf/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "./WRFUserARW.ncl"
begin
;
; Make a list of all files we are interested in
DATADir = "/home/zhy/program/test-wrf/WRFV3/test/em_real/output/"
FILES = systemfunc (" ls -1 " + DATADir + "wrfout* ")
numFILES = dimsizes(FILES)
print("numFILES = " + numFILES)
print(FILES)
print (" ")
; We generate plots, but what kind do we prefer?
; type = "ps"
type = "pdf"
; type = "ps"
; type = "ncgm"
wks = gsn_open_wks(type,"plt_Surface_multi_files")
; Set some basic resources
res = True
res@MainTitle = "REAL-TIME WRF"
res@Footer = False
pltres = True
mpres = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a = addfiles(FILES+".nc","r")
; f_lonlat = addfiles(FILES+".nc","r")
times = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
slp = wrf_user_getvar(a,"slp",-1) ; slp
wrf_smooth_2d( slp, 3 ) ; smooth slp
tc = wrf_user_getvar(a,"tc",-1) ; 3D tc
u = wrf_user_getvar(a,"ua",-1) ; 3D U at mass points
v = wrf_user_getvar(a,"va",-1) ; 3D V at mass points
td2 = wrf_user_getvar(a,"td2",-1) ; Td2 in C
tc2 = wrf_user_getvar(a,"T2",-1) ; T2 in Kelvin
tc2 = tc2-273.16 ; T2 in C
u10 = wrf_user_getvar(a,"U10",-1) ; u at 10 m, mass point
v10 = wrf_user_getvar(a,"V10",-1) ; v at 10 m, mass point
tf2 = 1.8*tc2+32. ; Turn temperature into Fahrenheit
tf2@description = "Surface Temperature"
tf2@units = "F"
u10 = u10*1.94386 ; Turn wind into knots
v10 = v10*1.94386
u10@units = "kts"
v10@units = "kts"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res@pmTickMarkDisplayMode = "Always"
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes"
res@mpOutlineOn = True
res@mpOutlineSpecifiers = (/"China:states"/)
res@mpFillOn = True
res@mpFillBoundarySets = "National"
res@mpFillAreaSpecifiers = (/"China:states","Taiwan"/)
res@mpGeophysicalLineThicknessF = 2.0
res@mpUSStateLineThicknessF = 2.0
; gsn_define_colormap(wks,"WhViBlGrYeOrRe")
WRF_map_c(a,res,0)
res@tfDoNDCOverlay = True
; lon2d = wrf_user_getvar(a[:],"XLONG",0)
; lat2d = wrf_user_getvar(a[:],"XLAT",0)
tf2@lat2d = a->XLAT(0,:,:)
tf2@lon2d = a->XLONG(0,:,:)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
do it = 0,ntimes-1,1 ; TIME LOOP
wks = gsn_open_wks("pdf","plt_Surface_multi_files"+times(it))
print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots
; Plotting options for T
opts = res
opts@cnFillOn = True
opts@ContourParameters = (/ -20., 90., 5./)
opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map
contour_tc = wrf_contour(a[0],wks,tf2(it,:,:),opts)
delete(opts)
; Plotting options for SLP
opts = res
opts@cnLineColor = "Blue"
opts@cnHighLabelsOn = True
opts@cnLowLabelsOn = True
opts@ContourParameters = (/ 900., 1100., 4. /)
opts@cnLineLabelBackgroundColor = -1
opts@gsnContourLineThicknessesScale = 2.0
contour_psl = wrf_contour(a[0],wks,slp(it,:,:),opts)
delete(opts)
; Plotting options for Wind Vectors
opts = res
opts@vcGlyphStyle = "LineArrow"
opts@vcRefMagnitudeF = 2
opts@vcRefLengthF = 0.003
opts@FieldTitle = "Wind" ; overwrite Field Title
opts@NumVectors = 20 ; density of wind barbs
vector = wrf_vector(a[0],wks,u10(it,:,:),v10(it,:,:),opts)
delete(opts)
; MAKE PLOTS
; plot1 = wrf_map_overlays(a[0],wks,(/contour_tc,contour_psl,vector/),pltres,mpres)
plot = gsn_csm_contour_map(wks,tf2(it,0,:,:),res)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end do ; END OF TIME LOOP
|
|