- 积分
- 44
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-12-22
- 最后登录
- 1970-1-1
|
发表于 2016-6-7 11:07:10
|
显示全部楼层
三、使用源对地图进行基本设置
首先创建一个自定义的colormap配色方案,并且创建一个工作空间,
cmap = (/ \
(/ 255./255, 255./255, 255./255 /), \ ; 0 - White background.
(/ 0./255 , 0./255 , 0./255 /), \ ; 1 - Black foreground.
(/ 255./255, 0./255 , 0./255 /), \ ; 2 - Red.
(/ 0./255 , 0./255 , 255./255 /), \ ; 3 - Blue.
(/ 164./255, 244./255, 131./255 /), \ ; 4 - Ocean Blue.
(/ 0./255 , 0./255 , 255./255 /), \ ; 5 - Bar 1
(/ 0./255 , 153./255, 255./255 /), \ ; 6 - Bar 2
(/ 0./255, 153./255, 153./255 /), \ ; 7 - Bar 3
(/ 0./255 , 255./255, 0./255 /), \ ; 8 - Bar 4
(/ 255./255, 255./255 , 102./255 /), \ ; 9 - Bar 5
(/ 255./255, 153./255 , 102./255 /), \ ; 10 - Bar 6
(/ 255./255, 0./255 , 255./255 /) \ ; 11 - Bar 7
/)
wks_type = "png"
wks = gsn_open_wks(wks_type,argu(1)+argu(3)) ; Open a workstation and.
gsn_define_colormap(wks,cmap) ; define a different colormap.
这里创建了png的工作空间,NCL还支持X11、PS、NCGM、PDF、NEWPDF等。
接下来设置地图属性
res = True
res@gsnAddCyclic = False ;由于我们的数据不是循环地球一周的,因此必须把这个置否
res@mpDataSetName = "Earth..4" ; This new database contains
; divisions for other countries.
res@mpDataBaseVersion = "MediumRes" ; Medium resolution database
res@mpOutlineOn = True ; Turn on map outlines
res@mpOutlineSpecifiers = (/"China:states","Taiwan"/) ;China:states
中国地图包含在Earth..4这个地图库中,将边界区域设置为中国行政区域和台湾,在台湾问题这一点上比较郁闷,中国地图里没有台湾,激起了我这个爱国主义青年的强烈愤慨。
地图选好了,该把区域缩小到中国范围内了,这里和上面的插值范围有些出入,只是显示需要,没有实质联系。
res@mpMinLatF = 17 ; Asia limits
res@mpMaxLatF = 55
res@mpMinLonF = 72
res@mpMaxLonF = 136
你还可以使用这两行代码来加粗边界线。
res@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
res@mpNationalLineThicknessF= 2. ; double the thickness of national boundaries
默认的底图投影方式是等经纬度投影,画出来的中国地图比较扁,我们常看到的中国地图,投影方式是兰伯特投影,因此需要对投影方式进行修改
res@mpProjection = "LambertConformal" ;兰伯特投影
res@mpLambertMeridianF = 110.0
res@mpLimitMode = "LatLon"
res@mpLambertParallel1F = .001 ;Default: .001 ;可以自己改一改,看看投影有什么不同,挺有趣的
res@mpLambertParallel2F = 89.999 ;Default: 89.999
最后将填充区域设定在中国行政区域图之内,如果使用默认效果,等值线会对整个矩形区域填充颜色,因此需要去掉中国边境范围外的填充颜色
res@mpAreaMaskingOn = True ;使能填充覆盖
res@mpMaskAreaSpecifiers = (/"China:states","Taiwan"/) ;China:states
res@mpOceanFillColor = 0 ;用白色填充海洋 0是colormap的索引值
res@mpInlandWaterFillColor = 0 ;用白色填充内陆湖水 |
|