爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5994|回复: 0

兰伯特投影如何画中国+南海

[复制链接]

新浪微博达人勋

发表于 2019-12-24 10:12:19 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
求助各位大神:我的nc文件是兰伯特投影的,但是试了半天发现南海不能准确加在图上。
大陆倒是可以兰伯特投影,但是只能用‘latlon’的设置,‘lambert’也不可以。

代码如下

  wks  = gsn_open_wks ("png", "diff")  ; open workstation
  gsn_define_colormap(wks,"BlueWhiteOrangeRed")
; cmap = read_colormap_file("BlAqGrYeOrReVi200")

  res                            = True               ; plot mods desired
  res@gsnMaximize                = True
  res@gsnDraw                    = False
  res@gsnFrame                   = False
  res@pmTickMarkDisplayMode      = "Always"           ; turn on tickmarks

  res@mpMinLatF                  = 17.                       
  res@mpMaxLatF                  = 55.
  res@mpMinLonF                  = 72.
  res@mpMaxLonF                  = 136.

  res@tiMainString           = "New - Bak"
  res@gsnLeftString          = "2018-11-10 00:00"
  res@gsnRightString         = "ppm"
  res@tiMainFontHeightF      = 0.020              ; smaller title
  res@tiMainOffsetYF         = -0.005             ; move title down

  res@gsnAddCyclic           = False              ; regional data
  res@gsnMaximize            = True               ; enlarge image  
res@mpLimitMode            = "LatLon"           ; choose region of map
  res@mpMinLatF              = min(lat2d)-1         ; Add a little bit of
  res@mpMinLonF              = min(lon2d)-1         ; a margin around
  res@mpMaxLatF              = max(lat2d)+1         ; the plot.
  res@mpMaxLonF              = max(lon2d)+1

  res@trGridType                  = "TriangularMesh"
  res@sfXArray                    = lon2d
  res@sfYArray                    = lat2d  

  res@mpFillOn               = False
  res@mpGridAndLimbOn        = True
  res@mpGridLineThicknessF   = 0.5
  res@mpGridLineDashPattern  = 2
  res@mpGridSpacingF         =15.

  res@tfDoNDCOverlay = True

  res@mpFillOn                   = True
  res@mpDataSetName              = "/export/home/zhangshan/pics/NCL-Chinamap/database/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@mpNationalLineThicknessF   = 2
  res@mpProvincialLineThicknessF = 1

  res@cnFillOn               = True
  res@cnFillDrawOrder        = "PreDraw"          ; draw contours first  
; res@cnFillPalette          = cmap(2:,:)         ; subset the color map
  res@cnLinesOn              = False              ; no contour lines
  res@cnLineLabelsOn         = False              ; no contour labels
  res@cnInfoLabelOn          = False              ; no contour info label
  res@lbLabelAutoStride          = True

  res@tmXTOn                 =False
  res@tmYROn                 =False

;res@mpOutlineDrawOrder    = "PostDraw"      ; draw continental outline last
  ;res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries

  res@mpGridAndLimbOn        = True
  res@mpGridLineThicknessF   = 0.5
  res@mpGridLineDashPattern  = 2
  res@mpGridSpacingF         =10.

  res@cnFillOn = True
  res@cnLevelSelectionMode = "ExplicitLevels"
  res@cnLevels  =  (/-60,-50,-40,-30,-20,-10,0,10,20,30,40,50,60/)
  res@cnFillColors = (/2,17,30,40,50,65,88,158,177,186,202,220,238,255/)

  ;res@mpOutlineDrawOrder    = "PostDraw"      ; draw continental outline last
  ;res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries

  res@pmLabelBarWidthF  = 0.5
  res@pmLabelBarHeightF = 0.1
  res@lbLabelFontHeightF  = 0.01           ; label bar font height
  res@pmLabelBarOrthogonalPosF  = 0.05
  res@lbBoxLinesOn       = False

  ;res@tfDoNDCOverlay = True  

  plot = gsn_csm_contour_map(wks,diff,res)

;--- add South China Sea ---
  nhres                          = True
  nhres@gsnMaximize              = False

  nhres@vpHeightF                = 0.18   
  nhres@vpWidthF                 = 0.18

  nhres@mpMinLatF                =   2.0   
  nhres@mpMaxLatF                =  23.0
  nhres@mpMinLonF                = 105.0
  nhres@mpMaxLonF                = 123.0

  nhres@lbLabelBarOn             = False
  nhres@tmXBOn                   = False
  nhres@tmXTOn                   = False
  nhres@tmYLOn                   = False
  nhres@tmYROn                   = False
  nhres@gsnLeftString            = ""
  nhres@gsnRightString           = ""

  map_nanhai = gsn_csm_contour_map(wks,diff,nhres)

  adres                          = True
  adres@amParallelPosF           = 0.495 ; -0.5 is the left edge of the plot.
  adres@amOrthogonalPosF         = 0.49  ; -0.5 is the top edge of the plot.
  adres@amJust                   = "BottomRight"

  plotnh = gsn_add_annotation(plot,map_nanhai,adres)

  draw(plot)
  frame(wks)

end

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表