爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 16357|回复: 25

ncl画风场图如何去掉陆地上的值呢

[复制链接]

新浪微博达人勋

发表于 2013-1-27 11:56:26 | 显示全部楼层 |阅读模式

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

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

x
想用ncl画风矢量,但想去掉陆地上的值,请教大虾如何屏蔽陆地上的值呢?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-1-27 13:23:32 | 显示全部楼层
http://www.ncl.ucar.edu/Applications/mask.shtml,自己看看吧,可以mask的
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-1-28 12:12:36 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-1-30 10:58:01 | 显示全部楼层
尽头的尽头 发表于 2013-1-27 13:23
http://www.ncl.ucar.edu/Applications/mask.shtml,自己看看吧,可以mask的

非常感谢大虾了!!!!!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-1-31 11:17:39 | 显示全部楼层
尽头的尽头 发表于 2013-1-27 13:23
http://www.ncl.ucar.edu/Applications/mask.shtml,自己看看吧,可以mask的

请教大虾,偶在使用landsea_mask的时候,却出不了图,总是提示fatal:Number of dimensions in parameter (0) of (landsea_mask) is (3), (2) dimensions were expected
fatal:Execute: Error occurred at or near line 29 in file mask_5.ncl
这样的错误,请问偶的ncl脚本里面,哪里设置不对呢?
偶的ncl脚本如下:
;*************************************************
; mask_5.ncl
;
; Concepts illustrated:
;   - Using "landsea_mask" to create a land/sea mask for your dataset
;   - Using "mask" to set land or ocean values in your data to missing
;   - Paneling two plots on a page
;   - Drawing raster contours
;   - Explicitly setting the fill colors for contours
;   - Drawing contours over land only
;   - Using draw order resources to mask areas in a plot
;   - Centering labels with respect to labelbar boxes
;   - Adding a title to a labelbar
;   - Turning off map tickmarks
;   - Turning off the gray-filled continents
;   - Adding white space around paneled plots
;
;************************************************
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
  a = addfile("uwnd.sig995.mon.mean.nc","r")     ; read in sample data file (resolution=T85)
  t85 = a->uwnd(0,:,:)               ; grab the first timestep of the TS field
  
  b = addfile("land.sfc.gauss.nc","r")   ; read in land sea mask basemap file
  lsm_t85  = landsea_mask(b->land,t85&lat,t85&lon)         ; read in land sea mask, and pass it and
                                                             ; the t85 lat/lon arrays into landsea_mask
  t85 = mask(t85,lsm_t85.eq.0,False)        ; mask out all ocean points from t85                                                                                                  
;============================================================================
  wks = gsn_open_wks("ps","mask")
  gsn_define_colormap(wks,"wh-bl-gr-ye-re")
  
  res = True
  res@mpFillOn         = False                ; do not color-fill the map
  res@gsnTickMarksOn   = False                ; turn off all tick marks
  res@mpPerimOn        = True                 ; turn the map perimeter on
  res@mpPerimDrawOrder = "PostDraw"           ; draw the map perimeter last
  res@gsnDraw          = False                ; do not draw the plot
  res@gsnFrame         = False                ; do not advance the frame
  res@cnLinesOn        = False                ; turn off the contour lines
  res@cnLineLabelsOn   = False                ; turn off the contour line labels
  res@cnLevelSelectionMode = "ExplicitLevels" ; explicitly set the levels via cnLevels
  res@cnLevels         = (/1.,2.,3.,4./)      ; set the levels
  res@cnFillOn         = True                 ; turn on color fill
  res@cnFillMode       = "RasterFill"         ; use raster fill         
  res@cnFillColors     = (/60,100,20,140,5/)  ; set the colors that will be used to color fill
  res@lbLabelStrings   = ispan(0,4,1)         ; labels for the labelbar boxes
  res@lbLabelAlignment = "BoxCenters"         ; put the labels in the center of the label bar boxes
  res@lbTitleString    = "0=ocean, 1=land, 2=lake, 3=small island, 4=ice shelf"  ; labelbar title
  res@lbTitleFontHeightF = 0.0125             ; labelbar title font height
  
  plot = new(2,graphic)
  res@gsnCenterString = "land sea mask @T85 resolution"
  plot(0) = gsn_csm_contour_map_ce(wks,lsm_t85,res)

  res2 = True
  res2@mpFillOn         = False                ; do not color-fill the map
  res2@gsnTickMarksOn   = False                ; turn off all tick marks
  res2@mpPerimOn        = True                 ; turn the map perimeter on
  res2@mpPerimDrawOrder = "PostDraw"           ; draw the map perimeter last
  res2@gsnDraw          = False                ; do not draw the plot
  res2@gsnFrame         = False                ; do not advance the frame
  res2@cnLinesOn        = False                ; turn off the contour lines
  res2@cnLineLabelsOn   = False                ; turn off the contour line labels
  res2@cnFillOn         = True                 ; turn on color fill
  res2@gsnSpreadColors  = True                 ; calculate colors to be used for color fill across entire colormap
  res2@cnLinesOn        = False                ; turn the contour lines off
  res2@gsnCenterString  = "TS Field (ocean-masked)"
  res2@gsnLeftString    = ""
  plot(1) = gsn_csm_contour_map_ce(wks,t85,res2)
  
  panres = True                                ; create a panel resource list
  panres@gsnMaximize = True                    ; maximize the size of the paneled plots
  panres@gsnPanelYWhiteSpacePercent = 1.0      ; leave space between the 2 plots
  gsn_panel(wks,plot,(/2,1/),panres)
end
  
  
  
  
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-1-31 18:22:52 | 显示全部楼层
姚小娟 发表于 2013-1-31 11:17
请教大虾,偶在使用landsea_mask的时候,却出不了图,总是提示fatal:Number of dimensions in parameter  ...

数组不匹配,landsea_mask中的数据资料是二维的,但是你的数据是3维的
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-1-31 18:25:22 | 显示全部楼层
kongfeng0824 发表于 2013-1-28 12:12
请问ncl有脚本编辑器吗?应该如何想grads那样有一个gseditor。

可以使用VIM编辑器
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-1-31 22:05:24 | 显示全部楼层
尽头的尽头 发表于 2013-1-31 18:25
可以使用VIM编辑器

是ncl自带的还是需要另外安装呢?我是在windows下安装的cygwin。并安装了了ncl
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-2-1 09:44:22 | 显示全部楼层
kongfeng0824 发表于 2013-1-31 22:05
是ncl自带的还是需要另外安装呢?我是在windows下安装的cygwin。并安装了了ncl

VIM编辑器有windows下的版本,你百度下就出来啦,vim对于windows使用者来说开始有点难上手(都是命令编辑),windows下也可以用gedit
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-2-1 17:34:44 | 显示全部楼层
尽头的尽头 发表于 2013-1-31 18:22
数组不匹配,landsea_mask中的数据资料是二维的,但是你的数据是3维的

偶将这一行lsm_t85  = landsea_mask(b->land,t85&lat,t85&lon)  改成
lands = b->land(0,:,:)
lsm_t85 = landsea_mask(lands,t85&lat,t85&lon)
之后也是不行啊?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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