爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 22094|回复: 59

ncl 去除边界

[复制链接]

新浪微博达人勋

发表于 2014-7-29 18:03:45 | 显示全部楼层 |阅读模式

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

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

x
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/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"

begin

   files=systemfunc("ls -1 wrfout_d01_2013-07*")
   f=addfiles(files,"r")
   ListSetType(f,"cat")
   rainc=wrf_user_getvar(f[:],"RAINC",-1)
   rainnc=wrf_user_getvar(f[:],"RAINNC",-1)
   i_rainc=wrf_user_getvar(f[:],"I_RAINC",-1)
   i_rainnc=wrf_user_getvar(f[:],"I_RAINNC",-1)
   times=wrf_user_getvar(f[:],"times",-1) ; get all times in the file
   ntimes = dimsizes(times)         ; number of times in the file
   rain=rainc+100.0*i_rainc+rainnc+10*i_rainnc
   ;result_rain=rain(1,:,:)-rain(0,:,:)
   ;t_rain=dim_avg_n_Wrap(rain,0)
   result_rain1 = dim_avg_n_Wrap(rain(1 : , :, :) - rain(0 : ntimes - 2, :, :), 0)
   result_rain=result_rain1*4
   ;result_rain=dim_sum_n_Wrap(rain,0)
   ;wrf_smooth_2d( result_rain, 3 )       
   wks = gsn_open_wks("png","wrfout_avg_rain_July")
   colors = (/"white","black", "Snow"    \
               ,"PaleTurquoise","PaleGreen","SeaGreen3" ,"Yellow"  \
              ,"Orange","HotPink","Red","Violet", "Purple", "Brown"/)
       ;gsn_define_colormap(wks,"wh-bl-gr-ye-re")

   gsn_define_colormap(wks, colors);rain,dir,maxdir,spd,vis
   ; Set some basic resources
   res = True
   res@MainTitle                   = "REAL-TIME WRF"
   pltres = True
   mpres = True                     
   res@cnFillOn=True
   res@cnLineColor = "Blue"
   ;res@gsnDraw  = False               ; Don't draw plots
   ;res@gsnFrame = False               ; Don't advance frames
   ;res@cnFillColors = 2       ; 起始于color index 14
   res@cnLinesOn            = False     ; 关闭等值线线条                  
   res@FieldTitle = "RAIN(mm)"
   res@cnLevelSelectionMode = "ExplicitLevels"
   ;res@cnLevels             = (/20,40,60,80,100,120,140,160,180,200,220/) ; rain
   res@cnLevels             = (/0.4,4,8,12,16,20,30,40,60,80/) ; rain
   contour_rain = wrf_contour(f[0],wks,result_rain,res)
   mpres@mpDataBaseVersion="MediumRes"
   mpres@mpDataSetName="Earth..4"
   mpres@mpOutlineSpecifiers=(/"China:states","Taiwan"/)
   mpres@mpAreaMaskingOn         = True
   mpres@mpMaskAreaSpecifiers    = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)   ;China:state
   mpres@mpGeophysicalLineColor      = "Black"
   mpres@mpNationalLineColor         = "Black"
   mpres@mpUSStateLineColor          = "Black"
   mpres@mpGridLineColor             = "Black"
   mpres@mpLimbLineColor             = "Black"
   mpres@mpPerimLineColor            = "Black"
   mpres@mpGeophysicalLineThicknessF = 2.0
   mpres@mpGridLineThicknessF        = 2.0
   mpres@mpLimbLineThicknessF        = 2.0
   mpres@mpNationalLineThicknessF    = 2.0
   mpres@mpUSStateLineThicknessF     = 2.0
   ;mpres@mpOutlineBoundarySets ="NoBoundaries"s
   plot= wrf_map_overlays(f[0],wks,(/contour_rain/),pltres,mpres)
end
请问一下这个程序为什么画出来的图还是有中国边界意外的部分啊

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

新浪微博达人勋

 楼主| 发表于 2014-7-29 18:06:44 | 显示全部楼层
求大神解答啊{:eb303:}{:eb303:}
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-29 19:37:00 来自手机 | 显示全部楼层
加入mpres@mpFillOn=True
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-7-29 20:36:29 | 显示全部楼层
longlivehj 发表于 2014-7-29 19:37
加入mpres@mpFillOn=True

用这种方式的话画出来的图就只在中国范围进行调色,其他范围就没有进行填色,但是我想要的是出来的图中就只有中国的,没有其他的!这该怎么办呢?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-29 23:18:32 来自手机 | 显示全部楼层
风之牧语 发表于 2014-7-29 20:36
用这种方式的话画出来的图就只在中国范围进行调色,其他范围就没有进行填色,但是我想要的是出来的图中就 ...

呃,没看明白你的意思。只在中国填色,其他地方不填色,不就是你说的只有中国的么?!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-7-30 09:18:00 | 显示全部楼层
longlivehj 发表于 2014-7-29 23:18
呃,没看明白你的意思。只在中国填色,其他地方不填色,不就是你说的只有中国的么?!

我说的是图上整个界面只显示中国的图,其他的虽然没有填色,但是在图片上占据了位置的!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 09:45:00 来自手机 | 显示全部楼层
风之牧语 发表于 2014-7-30 09:18
我说的是图上整个界面只显示中国的图,其他的虽然没有填色,但是在图片上占据了位置的!

加入mpres@mpOutlineBoundarySets="NoBoundaries"
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-7-30 09:50:57 | 显示全部楼层
longlivehj 发表于 2014-7-30 09:45
加入mpres@mpOutlineBoundarySets="NoBoundaries"

我加了,有点纳闷了,中国以外的地区,比如像印度啊,虽然没有画填色图,但是还在在图片上保留了位置的,我想要的是就只有中国地图在
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-7-30 09:56:49 来自手机 | 显示全部楼层
风之牧语 发表于 2014-7-30 09:50
我加了,有点纳闷了,中国以外的地区,比如像印度啊,虽然没有画填色图,但是还在在图片上保留了位置的, ...

哦,你是这个意思。你查查mpLimitMode及其相关属性,可以缩小作图范围。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-7-30 10:01:18 | 显示全部楼层
longlivehj 发表于 2014-7-30 09:56
哦,你是这个意思。你查查mpLimitMode及其相关属性,可以缩小作图范围。

我尝试过用这个语句,也没有成功,因为这个数据是经过了兰伯特投影的,使用了这个语句就会出现画图错误,哎!
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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