爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5350|回复: 2

RegCM结果绘图NCL报错。请大神指点!

[复制链接]
发表于 2016-11-3 10:46:48 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 樱桃小王子 于 2016-11-3 11:45 编辑

刚开始用NCL,请大神指点。
RegCM output,有Lambert投影。想在NCL绘图中转成CylindricalEquidistant。用了rcm2rgrid() 画出来还是和原来一样。。。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
上代码
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

; read file
   fin = addfile("/xx/CN_ATM.201001.mon.xy.nc","r")

; set env
   fig_path = getenv("fig_out_path")
   variable = getenv("variable")
   level    = toint(getenv("level"))

; read var
    time  = fin->time
    pr  = fin->pr

   printVarSummary(pr)

;grab lat2d and lon2d

     lat2d = fin->xlat(y|:,x|:)
     lon2d = fin->xlon(y|:,x|:)

;get the number of latitudes and logitudes

      dvar = dimsizes(lat2d)
      nlat = dvar(0)
      nlon = dvar(1)

; get the number of time

       ntime = dimsizes(time)

      pr@lat2d =  fin->xlat(y|:,x|:)
      pr@lon2d =  fin->xlon(y|:,x|:)

     iy = lat2d(:,0)
     ix = lon2d(0,:)
     
     lat = fspan(0,55,247)

    lon = fspan(75,135, 381)

             xgrd = rcm2rgrid_Wrap(lat2d,lon2d,pr,lat,lon,0)

     printVarSummary(xgrd)

     pr_new = new((/ntime,nlat,nlon/),float)
     pr_new(0,:,:)=xgrd

  printVarSummary(pr_new)

    ; give pr_new the grid coordinate

     pr_new!0 = "time"
     pr_new!1 = "xlat"
     pr_new!2 = "xlon"

     pr_new&time = pr&time
     pr_new&xlat = iy
     pr_new&xlon = ix

   
        wks_type = "png"
        wks = gsn_open_wks(wks_type,"pr")
        gsn_define_colormap(wks,"gui_default")

      res = True

res@cnFillOn              = True    ; turn on color fill
res@cnLinesOn             = False   ; turn of contour lines
res@cnLevelSpacingF       = 0.5      ; contour spacing
res@cnFillPalette         = "BlAqGrYeOrRe"
res@mpDataBaseVersion      = "MediumRes"        ; better map outlines
res@tfDoNDCOverlay = True
res@gsnAddCyclic          = False

    ;set map information
res@mpDataSetName         = "Earth..4"
res@pmTickMarkDisplayMode = "Always"

res@mpOutlineOn           = True
res@mpOutlineBoundarySets = "National"

res@mpProjection          = "CylindricalEquidistant"
res@pmTickMarkDisplayMode = "Always"
res@mpOutlineDrawOrder    = "PostDraw"      ; draw continental outline last
res@mpMinLatF       = 0   
res@mpMinLonF       = 75   
res@mpMaxLatF       = 60
res@mpMaxLonF       = 140
res@mpCenterLonF    = 120


plot = gsn_csm_contour_map(wks,pr_new(0,:,:),res)

end











密码修改失败请联系微信:mofangbao
发表于 2016-11-3 11:08:19 | 显示全部楼层
应该是gsn_csm_contour_map,你好像写错了
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-11-3 11:39:24 | 显示全部楼层
Sebastian 发表于 2016-11-3 11:08
应该是gsn_csm_contour_map,你好像写错了

是呢!非常感谢!
不过图画出来之后还是带投影的。。。这个rcm2rgrid怎么没什么作用。。。。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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