- 积分
- 6723
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-9-3
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 wuyejincao 于 2016-10-27 15:16 编辑
啥都不说了脚本如下, 当cnres@mpFillDrawOrder = "PreDraw"时候出来图1
当 cnres@mpFillDrawOrder = "PostDraw"时候出来图2
总而言之,就是出不来maskout的效果,就是把中国区域外的抹掉吗,求指导!
;************************************************;
; ;
; Example of using the plotting parameters ;
; ;
; Main Program ;
; ;
;************************************************;
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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
begin
a = addfile("./wrfout_d01_2016-10-25_00:00:00.nc","r") ; Open a file
type = "eps"
wks = gsn_open_wks(type,"10-25-Pre")
; First get the variables we will need
pre1 = a->RAINC ; CUMULUS降水
pre2 = a->RAINNC ;GRID降水 rainc+rainnc才是总降水
lon2d = wrf_user_getvar(a,"XLONG",0)
lat2d = wrf_user_getvar(a,"XLAT",0)
prese=pre1+pre2
;predif=dim_avg_n_Wrap(prese(0:8,:,:),0)
predif= dim_sum_n_Wrap(prese(0:8,:,:),0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
olon = fspan(100,135,176)
olat = fspan(20,50,151)
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees-east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
grid_sm = rcm2rgrid_Wrap(lat2d,lon2d,predif,olat,olon,0)
grid_sm@description = "Pre Difference"
grid_sm@units = "%"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnMaximize = False
res@tmXTOn = False
res@tmYROn = False
res@gsnAddCyclic = False ;由于我们的数据不是循环地球一周的,因此必须把这个置否
res@gsnLeftString = ""
res@gsnRightString = ""
res@vpWidthF=0.9 ;图的宽度
res@vpHeightF=0.8 ;图的高度
res@vpXF=0.15 ;离屏幕左端的距离
res@vpYF=1.0 ;离屏幕下端的距离
;;set map;;
cnres = res
cnres@mpDataSetName = "Earth..4"
cnres@mpDataBaseVersion = "MediumRes"
cnres@mpOutlineOn = True
cnres@mpOutlineSpecifiers = (/"China","China:Provinces"/)
; cnres@mpFillOn = True
cnres@mpFillDrawOrder = "PreDraw"
cnres@mpAreaMaskingOn = True
cnres@mpMaskAreaSpecifiers = (/"China"/)
cnres@mpLandFillColor = "White"
cnres@mpInlandWaterFillColor = "White"
cnres@mpOceanFillColor = "White"
cnres@mpOutlineBoundarySets = "NoBoundaries" ;"National"
cnres@mpGeophysicalLineThicknessF = 2
cnres@mpNationalLineThicknessF = 2
cnres@mpGeophysicalLineColor = "Black"
;;set contour;;
; mpres = res
cnres@cnFillDrawOrder = "PreDraw"
cnres@cnFillOn = True
cnres@cnLinesOn = False
cnres@cnLevelSelectionMode = "ExplicitLevels"
cnres@cnLevels = (/ .1, .2, .4, .8, 1.6, 3.2, 6.4, \
12.8, 25.6, 51.2, 102.4/)
cnres@cnFillColors = (/"White","White","DarkOliveGreen1", \
"DarkOliveGreen3","Chartreuse", \
"Chartreuse3","Green","ForestGreen", \
"Yellow","Orange","Red","Violet"/)
cnres@pmLabelBarWidthF = 0.7
cnres@pmLabelBarHeightF = 0.1
cnres@lbLabelPosition = "Bottom" ; label position
cnres@pmLabelBarOrthogonalPosF = 0.1 ;bar往下移动的距离
; cnres@lbLabelFontHeightF = 0.03 ;Controls the size of the labels
cnres@lbLabelAngleF = 0
cnres@lbLabelStride = 2 ; skip every other label
;;set area;;
cnres@mpMinLatF = 20
cnres@mpMaxLatF = 50
cnres@mpMinLonF = 100
cnres@mpMaxLonF = 135
;;plot;;
; map = gsn_csm_map(wks,mpres)
; contour = gsn_csm_contour(wks,grid_sm,cnres)
map = gsn_csm_contour_map(wks,grid_sm,cnres)
;;drawing "map" will draw everything: map, contours
;overlay(map,contour)
draw(map)
frame(wks)
end
最后解决的办法是把经纬度扩大,包含中国区域,然后maskout就管用了。
|
|