请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 41527|回复: 72

[秀图] NCL绘制中国地图和尼诺区的程序

  [复制链接]

新浪微博达人勋

发表于 2012-10-21 10:20:14 | 显示全部楼层 |阅读模式

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

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

x
最近,闲得慌绘制了一下我们的祖国和Nino区域,供大家作为底图使用,程序我贴出来了。
官网上可是没有的,欢迎大家使用啊!!!
分享总是快乐的。
;Written by Rao Jian for all of you
;2012.10.21
;================================================;
; Concepts illustrated:
;   - Changing the color of the oceans, land, and inland water areas
;   - draw the border of the mainland of China
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"
; ================================================;
begin

  wks  = gsn_open_wks("ps","map")         ; open a ps file
  gsn_define_colormap(wks,"wh-bl-gr-ye-re") ; choose a colormap

  res                        = True         ; mods desdired
  res@gsnDraw                = False        ; don't draw yet
  res@gsnFrame               = False        ; don't advance yet
  res@mpOceanFillColor       = 5            ; array index in color map
  res@mpLandFillColor        = 164          ; for land, ocean, and inland h20
  res@mpInlandWaterFillColor = 54
  res@mpDataBaseVersion      = "Ncarg4_1"   
  res@mpDataSetName          = "Earth..4"              
  res@mpOutlineOn            = True
; res@mpOutlineSpecifiers    = (/"China:states","Taiwan","Land:Eurasia"/)
  res@mpOutlineBoundarySets  = "National"           ; or "NoBoundaries"
  res@mpAreaMaskingOn        = True
; res@mpFillOn                    = False   
  res@mpGeophysicalLineColor      =  17 ;"Navy"   ; color of cont. outlines
  res@mpGeophysicalLineThicknessF = 1.5        ; thickness of outlines
; res@mpMinLonF                   = 120
; res@mpMaxLonF                   = 300
  res@mpCenterLonF                = 160        ; This is necessary to get the correct map
; res@mpMinLatF                   = -20
; res@mpMaxLatF                   = 20


  plot = gsn_csm_map_ce(wks,res)               ; draw global map
;************************************************
; create points for box
;************************************************
ypts = (/ -5.0,  5.0,  5.0,  -5.0,  -5.0/)
xpts = (/-150.0, -150.0, -90.0, -90.0,-150.0/)
;************************************************
; add the box
;************************************************
   resp                  = True                      ; polyline mods desired
   resp@gsLineColor      = "red"                     ; color of lines
  ;resp@gsLineThicknessF = 2.0                       ; thickness of lines
  ;resp@gsLineLabelString= "Nino3"                   ; adds a line label string

; create array of dummy graphic variables. This is required, b/c each line
; must be associated with a unique dummy variable.

  dum1 = new(4,graphic)  
  dum2 = new(4,graphic)
  dum3 = new(4,graphic)
  dum4 = new(4,graphic)
; resp@mpFillDrawOrder             = "PreDraw"
resp@gsFillIndex = 17
resp@gsFillColor = "purple"
do i = 0,3
    dum1(i)=gsn_add_polyline(wks,plot,xpts,ypts,resp)      
  end do

  resp@gsFillIndex = 17
  resp@gsFillColor = "navy"
  resp@gsLineColor = "navy"
  ypts = (/ -5.0,  5.0,  5.0,  -5.0,  -5.0/)
  xpts = (/160, 160, 210, 210, 160/)
  do i = 0,3
    dum2(i)=gsn_add_polyline(wks,plot,xpts,ypts,resp)
  end do


  ypts = (/ -5.0,  5.0,  5.0,  -5.0,  -5.0/)
  xpts = (/-170, -170, -120, -120, -170/)
  resp@gsFillScaleF = 0.75
  resp@gsFillColor  = "gray"
  resp@gsLineColor  = "gray"
  do i = 0,3
     dum3(i)=gsn_add_polyline(wks,plot,xpts,ypts,resp)
  end do

  ypts = (/ -10,  0.0,  0.0,  -10,  -10/)
  xpts = (/-90, -90, -80, -80, -90/)
  resp@gsFillScaleF = 1.0          ; Default
  resp@gsFillColor  = "forestgreen"
  resp@gsLineColor  = "forestgreen"
  do i = 0,3
     dum4(i)=gsn_add_polyline(wks,plot,xpts,ypts,resp)
  end do
  draw(plot)  

  ;************************************************
  ; label the box with additional text
  ;************************************************
   tres                  =  True
   tres@txFontHeightF    = 0.010
   tres@mpFillDrawOrder  = "PostDraw"
   gsn_text(wks,plot,"Nino3",-120,0.0,tres)
   gsn_text(wks,plot,"Nino4",185.,0.0,tres)
   gsn_text(wks,plot,"Nino3.4",-145.,0.0,tres)
   gsn_text(wks,plot,"Nino1+2",-85.,-5.,tres)
   tres@txFontHeightF   = 0.020
   tres@txFontColor     = 200   
   gsn_text(wks,plot,"C h i n a",105,35.,tres)
   frame(wks)
   maximize_output(wks,True)
  end


+++++++++++++++++++++++++++++
效果是这样的,见图。

China

China

评分

参与人数 2威望 +2 金钱 +35 贡献 +7 收起 理由
mofangbao + 2 + 15 + 5
Aires + 20 + 2 很给力!

查看全部评分

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-10-21 10:34:31 | 显示全部楼层
原来NCL出图效果这么好啊~谢谢楼主分享了!
密码修改失败请联系微信:mofangbao
回复 支持 0 反对 1

使用道具 举报

新浪微博达人勋

发表于 2012-10-21 10:28:17 | 显示全部楼层
游子给力啊!!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

0
早起挑战累计收入
发表于 2012-10-21 11:04:31 | 显示全部楼层
非常给力啊,ncl区需要这样的达人!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-10-21 13:59:16 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-10-21 13:59:45 | 显示全部楼层
Aires 发表于 2012-10-21 10:34
原来NCL出图效果这么好啊~谢谢楼主分享了!

是的,这就是我为什么放弃grads和matlab的原因
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-10-21 14:01:03 | 显示全部楼层
mofangbao 发表于 2012-10-21 11:04
非常给力啊,ncl区需要这样的达人!!

真不是什么达人,您太褒奖了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-10-21 15:49:28 | 显示全部楼层
游子 发表于 2012-10-21 13:59
是的,这就是我为什么放弃grads和matlab的原因

可是我们学的是matlab,大家都在用,所以现在也放不下,以后有机会再学NCL吧~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-10-21 18:26:30 | 显示全部楼层
非常好!支持游子!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2012-10-21 20:08:44 | 显示全部楼层
sam 发表于 2012-10-21 18:26
非常好!支持游子!

在这也能看到你,天呢。天之小啊
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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