- 积分
- 572
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-10-30
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
大家好,我使用ncl绘制nc文件并叠加了shapefile地图。 因为只想显示部分区域,所以在范围设置 res@mpMinLatF 等直接设置了想要区域的经纬度。结果输出的时候地图的经纬度与nc文件的范围不匹配,下方是展示的图和ncl脚本。谢谢大家
begin
f1 = addfile ("GRIDCRO2D.1km.20150102", "r")
f = addfile("aver_day_lay1.nc","r")
do nh=0,1
p = f->PMFINE(nh,0,:,:)
p@lat2d = f1->LAT(0,0,:,:)
p@lon2d = f1->LON(0,0,:,:)
;=================================================;
; PLOT 2
;=================================================;
wks = gsn_open_wks("png",nh) ; send graphics to PNG file
res = True ; plot mods desired
;res@lbOrientation="vertical"
res@cnLevelSpacingF = 0.08
res@cnMinLevelValF=.0002
res@cnMaxLevelValF=.8
;res@lgLabelStride=3
;res@tiMainString="PM2.5 Concentration"
res@tmYLLabelFontHeightF = 0.028
dims = dimsizes(p@lat2d)
res@mpLimitMode = "Corners" ; choose region of map
res@mpLeftCornerLatF =22.084; min(p@lat2d)
res@mpLeftCornerLonF =113.7705; min(p@lon2d)
res@mpRightCornerLatF =22.6217; max(p@lat2d)
res@mpRightCornerLonF =114.4273; max(p@lon2d)
;res@mpPolarLabelSpacing="0.5"
res@mpProjection = "LambertConformal"
res@mpLambertParallel1F = 15.
res@mpLambertParallel2F = 40.
res@mpLambertMeridianF = 114.
res@pmTickMarkDisplayMode = "Always"
res@mpFillOn = False ; turn off map fill
res@mpOutlineOn = False ; only plot shp file
; res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last
; res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries
;--------------------------------------------
; usually, when data is placed onto a map, it is TRANSFORMED to the specified
; projection. Since this model is already on a native lambert conformal grid,
; we want to turn OFF the transformation.
;--------------------------------------------
res@tfDoNDCOverlay = True
; res@tfDoNDCOverlay = "NDCViewport" ; NCL V6.5.0 or later
;--------------------------------------------
res@gsnMaximize = True ; maximize plot size
res@gsnLeftString=" "
res@gsnRightString=" "
res@cnLevelSelectionMode="ManualLevels"
res@cnFillOn = True ; color plot desired
res@cnLinesOn = False ; turn off contour lines
res@cnFillPalette = "WhBlGrYeRe" ; NCV_rainbow2 set color map MPL_Reds MPL_pink WhBlGrYeRe MPL_gist_heat
res@gsnAddCyclic = False ; regional data
;res@gsnreverse_colormap = "BlAqGrYeOrRe"
;res@cnLevelSelectionMode = "ExplicitLevels"
;res@cnLevels = (/15,35,55,75,95,115,150/)
;res@cnFillColors =(/130,135,159,164,177,180,193,224/)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res@lbBoxMinorExtentF=0.15
res@tmYLMinorPerMajor = 0 ;次刻度尺
res@tmXBMinorPerMajor = 0
res@tmYRLabelsOn = False
res@tmYRMinorPerMajor = 0
res@tmXTMinorPerMajor = 0
res@tmYROn = False
res@tmXTOn = False
res@tmXMajorGrid=False ;网格线
res@tmXBMajorOutwardLengthF = False
res@tmYLMajorOutwardLengthF = False
plot = gsn_csm_contour_map(wks,p(:,:),res) ; contour the variable
shpfn2="hk.shp"
shpres= True
shpres@gsLineThicknessF = 5 ;-- increase line thickness地图线深浅
shpres@gsLineColor = "black"
dumstr1 = unique_string("poly") ;-- generate string 'dumstr1'
plot@$dumstr1$ = gsn_add_shapefile_polylines(wks,plot,shpfn2,shpres) ;-- add polylines
draw(plot) ;-- draw the plot
frame(wks) ;-- advance the frame
end do
; In this file, the coordinate variables of the data are listed as
; lat and long, but they are really just index points, which makes this
; data suitable for plotting without a map.
end
|
-
|