- 积分
- 762
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-8-24
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 xlilium 于 2020-9-26 08:32 编辑
各位好,使用了兰溪大神的脚本想画中国地图,由于想用Lambert投影所以对脚本进行了更改,但是在画南海小图的时候出了问题,小图的填充颜色和大图不符,想请问下应该如何解决呢?请各位大佬指点~谢谢
下面是我的部分代码:
var = wrf_user_getvar(a1, "xxx", -1)*1000
lat2d=a1[:]->XLAT(0,:,:)
lon2d=a1[:]->XLONG(0,:,:)
nlat=dimsizes(lat2d(:,0))
nlon=dimsizes(lon2d(0,:))
wks = gsn_open_wks("eps","./pictures/xxx")
cmap = read_colormap_file("MPL_RdBu")
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnMaximize = True
res@gsnAddCyclic = False
res@cnFillPalette = cmap(::-1,:) ; reverse color map
res@tfDoNDCOverlay = "NDCViewport"
res@cnFillOn = True
res@cnLinesOn = False
res@cnFillDrawOrder = "PreDraw"
res@cnLevelSelectionMode = "ManualLevels"
res@cnLevelSpacingF = 0.5
res@cnMaxLevelValF = 4
res@cnMinLevelValF = -6
;---Contour levels to use.
data_levels = (/-6,-5.5,-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4/)
res@lbLabelStrings = sprintf("%5.1f",data_levels) ; Format the labelbar labels
res@lbOrientation = "Vertical"
res@tiMainOffsetYF = -0.03 ; Move the title down
;
res@tmYLLabelFontHeightF = 0.02
res@tmXBLabelFontHeightF = 0.02
res@tmXTOn = False
res@tmYROn = False
res@pmTickMarkDisplayMode = "Always" ; nicer tickmarks
res@mpProjection = "LambertConformal"
res@mpLambertParallel1F = 20.
res@mpLambertParallel2F = 50.
res@mpLambertMeridianF = 105.5
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(nlat-1,nlon-1)
res@mpRightCornerLonF = lon2d(nlat-1,nlon-1)
res@mpFillOn = True
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes" ; or "Ncarg4_1"
res@mpAreaMaskingOn = True
res@mpMaskAreaSpecifiers = (/"China"/)
res@mpOutlineSpecifiers = (/"China","China:Provinces"/)
;
res@mpLandFillColor = "white"
res@mpInlandWaterFillColor = "white"
res@mpOceanFillColor = "white"
res@mpFillBoundarySets = "NoBoundaries"
res@mpOutlineBoundarySets = "NoBoundaries"
res@mpNationalLineColor = "black"
res@mpProvincialLineColor = "black"
res@mpGeophysicalLineColor = "black"
res@mpGeophysicalLineThicknessF = 2
res@mpNationalLineThicknessF = 2
res@mpProvincialLineThicknessF = 1
res@mpGridAndLimbOn = True
res@mpGridLineColor = "Grey"
res@mpGridLatSpacingF = 5
res@mpGridLonSpacingF = 5
res@mpGridLineThicknessF = 2
res@mpGridMaskMode = "MaskFillArea"
map = gsn_csm_contour_map(wks,var,res)
;--- add South China Sea ---
nhres = res
nhres@gsnMaximize = False
nhres@vpHeightF = 0.15
nhres@vpWidthF = 0.15
;若为以下四行则小图为大图的缩小版,并不是南海区域
;nhres@mpMinLatF = 2.0
;nhres@mpMaxLatF = 23.0
;nhres@mpMinLonF = 105.0
;nhres@mpMaxLonF = 123.0
nhres@mpRightCornerLonF = 123.0
nhres@mpRightCornerLatF = 23.0
nhres@mpLeftCornerLonF = 105.0
nhres@mpLeftCornerLatF = 2.0
;
nhres@mpGridAndLimbOn = False
nhres@mpOutlineOn = True
nhres@lbLabelBarOn = False
nhres@tmXBOn = False
nhres@tmXTOn = False
nhres@tmYLOn = False
nhres@tmYROn = False
nhres@gsnLeftString = ""
nhres@gsnRightString = ""
nhres@cnLineLabelsOn = False
map_nanhai = gsn_csm_contour_map(wks,var,nhres)
adres = True
adres@amParallelPosF = 0.5 ; -0.5 is the left edge of the plot.0.495
adres@amOrthogonalPosF = 0.5 ; -0.5 is the top edge of the plot.0.49
adres@amJust = "BottomRight"
plotnh = gsn_add_annotation(map,map_nanhai,adres)
出图:
|
-
|