- 积分
- 189
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-3-1
- 最后登录
- 1970-1-1
|
楼主 |
发表于 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
|
|