爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6683|回复: 1

ncl怎么只画陆地的部分

[复制链接]
发表于 2014-4-30 11:45:02 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图:
问题概况: 把陆地抠出来画,不画陆地和海洋的
我看过提问的智慧: 看过
自己思考时长(天): 2

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

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

x
本帖最后由 chongzika 于 2014-4-30 11:48 编辑

看了看官网MASKING的解释,;*************************************************; mask_1.ncl;; Concepts illustrated:;   - Using "mask" to set land or ocean values in your data to missing;   - Masking the ocean in a map plot;   - Masking land in a map plot;   - Spanning part of a color map for contour fill;;
************************************************l
oad "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
in = addfile("atmos.nc","r")  
ts = in->TS(0,:,:)
oro = in->ORO(0,:,:)
;************************************************
; use mask function to mask out land and then ocean data; ocean=0,land=1,sea_ice=2
;************************************************
land_only  = ts                              ; trick to keep cv's and atts
ocean_only = ts  
land_only  = mask(ts,oro,1)   ; Return the values of ts where oro=1  
ocean_only = mask(ts,oro,0)   ; Return the values of ts where oro=0
;************************************************; common resources
;************************************************
wks = gsn_open_wks("ps","mask")                  ; open a ps file  
gsn_define_colormap(wks,"BlAqGrYeOrRe")           ; choose colormap
res                      = True     ; plot mods desired
res@cnFillOn             = True     ; turn on color fill
res@cnLinesOn            = False    ; turn of contour lines  
res@gsnSpreadColors      = True     ; use full colormap
res@gsnSpreadColorStart  = 10       ; start at color 10
res@gsnSpreadColorEnd    = 96       ; end at color 96
;************************************************
; individual plots
;************************************************
res@cnLevelSpacingF         = 3                ; interval
  res@lbLabelStride           = 4                ; every 4th label  
res@tiMainString            = "Land Only"      ; title  
plot = gsn_csm_contour_map_ce(wks,land_only,res)
res@cnLevelSpacingF         = 2                ; interval
res@lbLabelStride           = 2                ; every 2nd label  
res@tiMainString            = "Ocean Only"     ; title
plot = gsn_csm_contour_map_ce(wks,ocean_only,res)
end
我的数据里面没有这TS,ORO怎么画呢

密码修改失败请联系微信:mofangbao
发表于 2014-4-30 12:51:20 | 显示全部楼层
本帖最后由 longlivehj 于 2014-4-30 13:04 编辑

masking里面有很多例子,你提到的只是其中一种方式,看看其它例子,总有一个适合你!
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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