- 积分
- 18
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-10-24
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
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
|
|