【zz】ncl画南非地图(地理库中的geographical areas)

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
;
; Generate an ny x nx array of random data with a minimum of -10 and a
; maximum of 110.
;
  nx = 40
  ny = 40
  z  = generate_2d_array(15,15,-10.,110.,0,(/ny,nx/))
;
; Generate 1D lat/lon coord arrays and attach to data. Make sure
; to include the units so we don't get warning messages from the
; gsn_csm_contour_map routine.
;
  lat   = fspan(-35,38,ny)
  lon   = fspan(-18,52,nx)
  z!0   = "lat"
  z!1   = "lon"
  z&lat = lat
  z&lon = lon
  z&lat@units = "degrees_north"
  z&lon@units = "degrees_east"

;
; These are the geographical areas we want to fill.
;
  fill_specs = (/"water","land"/)
;
; These are the geographical areas we want to mask.
;
  mask_specs = (/\
  "algeria","angola","angola-exclave-called-cabinda","benin","botswana",\
  "burundi","cameroon","central-african-republic","chad","congo","djibouti",\
  "egypt","equatorial-guinea","ethiopia","gabon","gambia","ghana","guinea",\
  "guinea-bissau","ivory-coast","kenya","lesotho","liberia","libya",\
  "madagascar","malawi","mali","mauritania","mauritius","morocco",\
  "mozambique","namibia","niger","nigeria","rwanda","senegal","sierra-leone",\
  "somalia","south-africa","sudan","swaziland","tanzania","togo","tunisia",\
  "uganda","upper-volta","western-sahara","zaire","zambia","zimbabwe"/)


;
; Open workstation and define colormap.
;
  wks = gsn_open_wks("pdf","africa")

  color_map = (/(/1.00,1.00,1.00/),(/0.00,0.00,0.00/),(/0.70,0.70,0.70/), \
                (/0.75,0.50,1.00/),(/0.50,0.00,1.00/),(/0.00,0.00,1.00/), \
                (/0.00,0.50,1.00/),(/0.00,1.00,1.00/),(/0.00,1.00,0.60/), \
                (/0.00,1.00,0.00/),(/0.70,1.00,0.00/),(/1.00,1.00,0.00/), \
                (/1.00,0.75,0.00/),(/1.00,0.38,0.38/),(/1.00,0.00,0.38/), \
                (/1.00,0.00,0.00/)/)

  gsn_define_colormap(wks,color_map)


; Set some resources.
;
  res                 = True
  res@gsnMaximize     = True
  res@gsnAddCyclic    = False

  res@cnFillColors    = (/3,4,5,6,8,9,10,11,12,13,14,15/)
  res@cnFillOn        = True
  res@cnFillDrawOrder = "Predraw"
  res@cnLineDrawOrder = "Predraw"
  res@cnHighLabelsOn  = False
  res@cnInfoLabelOn   = False
  res@cnLineLabelsOn  = False
  res@cnLowLabelsOn   = False
;
; Map projection resources
;
  res@mpProjection         = "Orthographic"
  res@mpEllipticalBoundary = True
  res@mpCenterLatF         = 20.0
  res@mpCenterLonF         = 14.0

;
; Map lat/lon grid resources
;
  res@mpGridAndLimbOn      = True
  res@mpGridSpacingF       = 10
  res@mpGridLineColor      = 2
  res@mpGridLineThicknessF = 1.1
  res@mpGridMaskMode       = "MaskLand"  ; Don't draw grid over land.
;
; Set the resources to indicate which areas to fill and which to mask.
;
;
; Map fill area resources
;
  res@mpFillBoundarySets    = "NoBoundaries"
  res@mpAreaMaskingOn       = 1
  res@mpMaskAreaSpecifiers  = mask_specs
  res@mpSpecifiedFillColors = (/7,2/)
  res@mpFillAreaSpecifiers  = fill_specs

;
; LabelBar resources. Note that this labelbar has two more boxes
; than we have contour levels. These extra boxes are used to show the
; colors for land and ocean.
;
  res@lbOrientation    = "Vertical"
  res@lbBoxCount       = 14
  res@lbLabelFont      = "Helvetica-bold"
  res@lbLabelAlignment = "BoxCenters"
  res@lbLabelStrings   = (/"Ocean","Land","< 0","0-10","10-20","20-30", \
                           "30-40","40-50","50-60","60-70","70-80",     \
                           "80-90","90-100","> 100"/)
  res@lbFillColors     = (/7,2,3,4,5,6,8,9,10,11,12,13,14,15/)

  contour = gsn_csm_contour_map(wks,z,res)

end




  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值