爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5975|回复: 4

[作图] 如何将等值线确定在中国地区范围内?

[复制链接]

新浪微博达人勋

发表于 2014-12-12 03:37:25 | 显示全部楼层 |阅读模式

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

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

x
如何将等值线确定在中国地区范围内?等值线超出了中国边界了
QQ截图20141212033441.jpg
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-12-12 07:21:19 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-12-14 15:17:34 | 显示全部楼层
这是我的脚本,为什么我用颜色画图就能控制在范围里面,如果用等值线的话就会跑到外面去?看了MASK,还是毫无头绪啊,@longlivehj
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
        fname = "13070308.000"
        a = asciiread("/cygdrive/J/Data/rainfall/rainfall/08/"+fname,-1,"string")
        b = a(11::)
        delim = " "
        zlon = stringtofloat(str_get_field(b,2,delim))
        zlat = stringtofloat(str_get_field(b,3,delim))
        zpre = stringtofloat(str_get_field(b,5,delim))
        zsta = stringtofloat(str_get_field(b,1,delim))
  

        olon = ispan(119,135,1)  ;olon = ispan(90,126,1)      
        olat = ispan(38,54,1)   ;olat = ispan(22,34,1)
  
        olon!0          = "lon"
        olon@long_name  = "lon"
        olon@units      = "degree_east"
        olon&lon        = olon
        olat!0          = "lat"
        olat@long_name  = "lat"
        olat@units      = "degree_north"
        olat&lat        = olat
  
        zpre@_FillValue = 999999.000000
        rscan = (/5,3,1,0.5/)          
               data1 = obj_anal_ic_Wrap(zlon,zlat,zpre,olon,olat,rscan,False)   
        wks = gsn_open_wks("pdf","2013070200_preciption")

        gsn_define_colormap(wks,"MPL_gist_yarg")               
        res                                                 = True
        res@gsnDraw                     = False           ; don't draw
        res@gsnFrame                    = False
        res@gsnAddCyclic  = False  

        res@mpDataSetName                         = "Earth..4"          res@mpDataBaseVersion                     = "MediumRes"          res@mpOutlineOn                           = True               res@mpFillAreaSpecifiers        = (/"Land", "China","Taiwan","Water","Island"/)
        res@mpSpecifiedFillColors       =(/"white","transparent","transparent","white","transparent"/)
        res@mpInlandWaterFillColor      = 0
        res@mpLandFillColor             = -1  
        res@mpOutlineBoundarySets       = "Geophysical"
        res@mpOutlineSpecifiers         = (/"Land","China","Taiwan","Water","island"/)
;        res@mpMaskOutlineSpecifiers     = (/"water"/)

  
        res@mpGeophysicalLineThicknessF= 1.      ; double the thickness of geophysical boundaries
        res@mpNationalLineThicknessF= 2.  
  
        res@mpLimitMode="LatLon"
        res@mpMinLatF=38     ;17         38         
        res@mpMaxLatF=54    ;55         54
        res@mpMinLonF=119   ;72       115
        res@mpMaxLonF=135   ;136        136


        res@mpLimbLineColor        = "Black"
        res@mpPerimLineColor       = "Black"

        res@cnFillOn      = True
        res@cnLinesOn     = True          ;等值线不显示
        res@cnLineLabelsOn = True
        res@cnFillDrawOrder = "PreDraw"         ; draw contours first
        res@cnLineLabelPlacementMode                 = "constant"
        res@cnLineDashSegLenF                          = 0.18
        res@cnLineLabelPerimSpaceF =0.1
        res@cnLineLabelFontAspectF =1.3
        res@cnLevelSelectionMode = "ExplicitLevels"       ; set explicit contour levels
        res@cnLevels    = (/1,5,10,15,20,30,40,50/)
        res@cnFillColors =(/0,0,0,0,0,0,0,0,105/)        
        res@cnSmoothingTensionF                        = -0.015                res@cnSmoothingDistanceF                        = 0.015                        res@cnSmoothingOn                                = True                        res@lbLabelBarOn = False
        data1 = smth9(data1,0.5,-0.25,False)
  
        map = gsn_csm_contour_map(wks,data1,res)
        draw(map)
        frame(wks)
end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-12-16 22:02:52 | 显示全部楼层
longlivehj 发表于 2014-12-12 07:21
http://www.ncl.ucar.edu/Applications/mask.shtml

大神,快来看看吧
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-12-18 14:04:57 | 显示全部楼层
问题解决了么?
先把原理弄清楚,就是把中国以外的全部用颜色填充,并且等值线优先绘制。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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