- 积分
- 7108
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-7-4
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 1649518749 于 2017-2-16 09:46 编辑
为了把色标做成像grads那样两头是三角形的,但结果很奇怪。画单个要素场时色标会和图在一起,可是画叠加图时色标却和图形分开了,就像图1、图2一样。最后我只能PS了。请大神帮我解忧
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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/labelbar/label.ncl" ;label.ncl来自官网
begin
a = addfile("/home/fc/datafile/data/uwnd.time.mean.nc","r")
b = addfile("/home/fc/datafile/data/vwnd.time.mean.nc","r")
f = addfile("/home/fc/datafile/data/precip.time.mean.nc","r")
u = a->uwnd(0,5,:,:)
v = b->vwnd(0,5,:,:)
w = f->precip(0,:,:)
;>--------------------------------------------<
; set for the map
;>--------------------------------------------<
res = True
res@gsnMaximize = True
res@gsnDraw = False
;res@gsnFram = False
;res@mpFillOn = True
mpres=True
mpres@mpOutlineOn = True ; Use outlines from shapefile
mpres@mpFillDrawOrder = "PreDraw"
mpres@mpDataBaseVersion = "MediumRes"
mpres@mpDataSetName = "Earth..4"
mpres@mpAreaMaskingOn = True
mpres@mpMaskAreaSpecifiers = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
mpres@mpLandFillColor = "gray"
mpres@mpInlandWaterFillColor = "white"
mpres@mpOceanFillColor = "white"
mpres@mpOutlineBoundarySets = "National" ;NoBoundaries
mpres@mpMinLatF = -90
mpres@mpMaxLatF = 90
mpres@mpMinLonF = 0
mpres@mpMaxLonF = 360
mpres@mpCenterLonF = 180
mpres@gsnMajorLonSpacing=30
mpres@gsnMajorLatSpacing=10
;>--------------------------------------------<
wks = gsn_open_wks("pdf","vector") ; send graphics to PNG file
; gsn_define_colormap( wks ,"BkBlAqGrYeOrReViWh200")
plot = gsn_csm_map(wks,mpres)
;>--------------------------------------------<
res = True
; res@gsnMaximize = True
res@gsnLeftString = ""
res@gsnRightString = ""
res@tiMainString ="500 hPa uvwind and precipitation"
res@gsnDraw = False
res@gsnFrame = False ; so we can draw time stamp
res@vcGlyphStyle = "LineArrow"
res@vcLineArrowThicknessF = 2.5
res@vcRefAnnoOn = True
res@vcRefMagnitudeF = 5
res@vcRefAnnoString1 = "5m/s
; res@vcRefAnnoSide = "Top"
res@vcRefAnnoString2On = False
res@vcRefAnnoPerimOn = False
res@vcRefAnnoParallelPosF = 0.999
res@vcRefAnnoBackgroundColor = "Purple"
res@vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector up
; res@vcRefMagnitudeF = 5.0 ; define vector ref mag
res@vcWindBarbScaleFactorF=2.5
res@vcRefLengthF = 0.025 ; define length of vec ref
res@vcRefAnnoArrowLineColor ="black"
res@vcRefAnnoArrowUseVecColor = True
res@vcGlyphStyle = "CurlyVector" ; turn on curly vectors
res@vcVectorDrawOrder = "PostDraw"
res@vcMinDistanceF = 0.02
res@vcMonoLineArrowColor = True
res@vcLineArrowColor = "navy"
vector = gsn_csm_vector(wks,u,v,res)
;>--------------------------------------------<
; set for the plot
resCN = True
resCN@gsnLeftString = "precipitation"
resCN@cnFillOn = True
resCN@cnLinesOn = False
resCN@gsnSpreadColors = True
resCN@gsnDraw = False
;resCN@cnLineColor = "blue"
resCN@lbOrientation = "Vertical"
resCN@pmLabelBarOrthogonalPosF = -0.03
resCN@lbLabelFontHeightF = 0.01
resCN@lbBottomMarginF=0.01
resCN@lbLabelFontThicknessF=0.25
resCN@lbBoxMinorExtentF=0.15
resCN@cnFillColors = (/"white","cadetblue1","steelblue2","green","green4",\
"gold2", "orange","red","red3","red4","violet"/)
map=gsn_csm_contour(wks,w,resCN)
;>============================================================<
;>------------------------------------------------------------<
; add China map
;>------------------------------------------------------------<
cnres = True
cnres@china = True ;draw china map or not
cnres@river = True ;draw changjiang&huanghe or not
cnres@province = False ;draw province boundary or not
cnres@nanhai = False ;draw nanhai or not
cnres@diqu = False ;draw diqujie or not
chinamap = add_china_map(wks,map,cnres)
overlay(plot,map)
labelbar_w_tri_ends(wks,map) ; 这句话怎么调都出现下图,色标和叠加图分开了。
overlay(plot,vector)
draw(plot)
; draw(map)
frame (wks)
end
|
-
图1
-
图2
-
我想要的图,但这是PS的
-
-
label.ncl
11.69 KB, 下载次数: 5, 下载积分: 金钱 -5
|