- 积分
- 67
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-12-22
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在处理WRF的结果时,由于wrf自带的边界比较模糊,所以自己重新弄了一套边界,但是叠加上去的时候会把原来的内容覆盖掉,不知道怎么把填充的部分设置成透明,或者只填充边界呢,希望大神们可以提供帮助。下面是代码:
These files are loaded by default in NCL V6.2.0 and newer
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "/home/xiaom/chinamap/cnmap/cnmap.ncl"
begin
;---Open WRF output file.
dir = "/home/xiaom/WRF/ncl_plot/"
filename = "wrfout_d02_2011-12-10_00:00:00"
a = addfile(dir + filename + ".nc","r")
;---Read terrain height and lat/lon off file.
it = 20 ; first time step
hgt = wrf_user_getvar(a,"V10",it) ; Terrain elevation
hgt@lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude/longitude
hgt@lon2d = wrf_user_getvar(a,"XLONG",it) ; required for plotting
wks = gsn_open_wks("png","wrf_gsn")
;---Set some basic plot options
res = True
res@tiMainString = "WRF"
res@gsnMaximize = True ; maximize plot in frame
res@cnFillOn = True
res@cnFillPalette = "OceanLakeLandSnow"
res@cnLinesOn = False
res@mpProjection = "CylindricalEquidistant" ; The default
res@gsnAddCyclic = False
;---Zoom in on plot
res@mpMinLatF = min(hgt@lat2d)
res@mpMaxLatF = max(hgt@lat2d)
res@mpMinLonF = min(hgt@lon2d)
res@mpMaxLonF = max(hgt@lon2d)
;---Additional resources desired
res@pmTickMarkDisplayMode = "Always" ; nicer tickmarks
res@mpDataBaseVersion = "MediumRes" ; better and more map outlines
res@mpDataSetName = "Earth..4"
res@mpOutlineBoundarySets = "AllBoundaries"
res@mpOutlineOn = True
res@lbOrientation = "Vertical"
res@tiMainOffsetYF = -0.03 ; Move the title down
;---Change contour levels to better match the color map being used
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/-10,-8,-6,-4,-2,0,2,4,6,8/)
plot=gsn_csm_contour_map(wks,hgt,res)
;
; This is for debugging purposes only. It shows what map resources the
; wrf_map_overlays routine would have use, if you had called that routine
; to do the plotting. This can be useful if you are trying to reproduce
; an original WRF-ARW plot.
;
AttachShape= 1
shres=True
if (AttachShape.eq.1)
dir ="/home/xiaom/WRF/ncl_plot/Data/"
filenames =(/"prlPoly.shp","prl.shp"/)
nfiles =dimsizes(filenames)
filenames =dir+filenames +".shp"
;set an array of fill or line color indexes for polygons or polyline
; res@gsColors="black"
shres@gsLineColor = "brown"
shres@gsLineThicknessF = 0.1
shres@gsMarkerIndex = 16
shres@gsMarkerColor = "green"
; ture on line of polygons
shres@gsEdgesOn = False
shres@gsEdgeColor ="brown"
shres@gsEdgeThicknessF =0.1
shres@gsFillColor ="white"
shres@gsFillColor =0
print("Adding polygons...")
poly0 = gsn_add_shapefile_polygons(wks,plot,filenames(0),shres)
print("Adding polylines...")
poly1 = gsn_add_shapefile_polylines(wks,plot,filenames(1),shres)
;print("Adding polymarkers...")
;poly1 = gsn_add_shapefile_polymarkers(wks,map(2),filenames(2),pres)
end if
draw(plot)
frame(wks)
end
|
-
-
|