爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
楼主: qdzwxz

[作图] 利用 ncl 自带海陆数据分别绘制海陆图

  [复制链接]
发表于 2011-9-16 21:12:48 | 显示全部楼层

呵呵,其实也不难。既然不愿意也不强人所难了,希望以后你能多出教程多分享经验
PS 软件已收到,感谢~
密码修改失败请联系微信:mofangbao
发表于 2011-9-17 10:39:52 | 显示全部楼层
江山备有人才出阿,我看版主就归lz了,支持,顶,赞一个
密码修改失败请联系微信:mofangbao
 成长值: 19710
发表于 2011-10-16 16:37:08 | 显示全部楼层
噢,完了,做了版主那么久才看到这个贴,什么事也没做过,表示非常惭愧!@天行健@qdzwxz
密码修改失败请联系微信:mofangbao
发表于 2012-4-20 22:09:37 | 显示全部楼层
支持!!
密码修改失败请联系微信:mofangbao
发表于 2012-4-24 14:41:17 | 显示全部楼层
除了对数据做处理来分别话陆地和海洋,还能完全不处理数据,单纯用mp的resource设置来达到单独画陆地和海洋的目的
密码修改失败请联系微信:mofangbao
发表于 2012-4-25 16:40:17 | 显示全部楼层
我之前是用过ncl的,为什么现在重新安装了之后脚本看不了了?图是可以看的。
我本科毕业的时候用ncl是连着学校的大型机的,我想请问不连大型机。把数据放在自己的电脑上是不上不能用啊?
密码修改失败请联系微信:mofangbao
发表于 2012-6-15 21:48:29 | 显示全部楼层
,感谢分享,正纠结着怎么把陆地的数据屏蔽掉呢, 一上论坛果然有所收获,
密码修改失败请联系微信:mofangbao
发表于 2012-7-25 08:49:03 | 显示全部楼层
很好,学习了!!!!
密码修改失败请联系微信:mofangbao
发表于 2012-10-11 16:54:56 | 显示全部楼层
不错啊,有收获,谢谢
密码修改失败请联系微信:mofangbao
发表于 2013-1-31 11:16:26 | 显示全部楼层
请教大虾,偶在使用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
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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