- 积分
- 362
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-2-25
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 hxyj 于 2013-4-28 23:25 编辑
这是我使用的脚本,采用NCL6.1.2自带的脚本和数据。
; - Using "overlay" to overlay contours and vectors on separate maps
; - Paneling two plots vertically on a page
;
;************************************************
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"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")
u = a->U(1,:,:)
v = a->V(1,:,:)
speed = sqrt(u^2+v^2)
copy_VarCoords(u,speed) ; copy coord vars to speed
;************************************************
; create plots
;************************************************
wks = gsn_open_wks("X11","panel") ; open a ps file
gsn_define_colormap(wks,"gui_default") ; choose colormap
plot = new(2,graphic) ; create a plot array
;************************************************
; create plots
;************************************************
res = True
res@gsnDraw = False ; don't draw
res@gsnFrame = False ; don't advance frame
res@gsnLeftString = "Speed" ; change left string
res@gsnRightString = u@units ; assign right string
res@mpFillOn = False ; no map fill
vecres = True ; vector only resources
vecres@gsnDraw = False ; don't draw
vecres@gsnFrame = False ; don't advance frame
vecres@vcRefMagnitudeF = 20 ; define vector ref mag
vecres@vcRefLengthF = 0.045 ; define length of vec ref
vecres@vcRefAnnoOrthogonalPosF = -.535 ; move ref vector into plot
vecres@vcFillArrowsOn = True
vecres@vcFillArrowEdgeColor = "black"
vecres@vcFillArrowFillColor = "green"
plotA = gsn_csm_vector_map_ce(wks,u(::4,::4),v(::4,::4),res)
plotB = gsn_csm_vector(wks,u(::4,::4),v(::4,::4),vecres)
overlay(plotA,plotB) ; result will be plotA
plot(0) = plotA ; now assign plotA to array
plotC = gsn_csm_vector_map_ce(wks,u(::4,::4),v(::4,::4),res)
plotD = gsn_csm_vector(wks,u(::4,::4),v(::4,::4),vecres)
overlay(plotC,plotD) ; result is plotC
plot(1) = plotC ; now assign plotC to array
resP = True ; panel only resources
resP@gsnMaximize = True ; maximize plots
gsn_panel(wks,plot,(/2,1/),resP) ; now draw as one plot
end
++++++++++++++++++++++++++++++++++++++++++++++++
运行之后,出现如下错误。
++++++++++++++++++++++++++++++++++++++++++++++++
Copyright (C) 1995-2013 - All RightsReserved University Corporation for AtmosphericResearch NCARCommand Language Version 6.1.2 Theuse of this software is governed by a License Agreement. Seehttp://www.ncl.ucar.edu/ for more details.fatal:Variable (vc_monofillarrowcolor) isundefinedfatal:["Execute.c":8128]:Execute:Error occurred at or near line 1811 infile $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.nclfatal:["Execute.c":8128]:Execute:Error occurred at or near line 5503 infile $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.nclfatal:["Execute.c":8128]:Execute:Error occurred at or near line 6201 infile $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.nclfatal:["Execute.c":8128]:Execute:Error occurred at or near line 63 infile wind6.ncl
如果把红色部分改为: gsn_csm_contour_map_ce, 就不会出错,可以运行下去。求高手帮忙解决,谢谢。
|
-
|