- 积分
- 57
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-3-4
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
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
in = addfile("200310.nc","r")
T = in->t
FT = short2flt(T)-273.15
copy_VarCoords(T,FT)
;************************************
; calculate great circle along transect
;************************************
leftlat = 40
rightlat = 42.7
leftlon = -71.3
rightlon = -70
npts = 10 ; number of points in resulting transect
dist = gc_latlon(leftlat,leftlon,rightlat,rightlon,npts,2)
points = ispan(0,npts-1,1)*1.0
;********************************
; interpolate data to great circle
;********************************
trans = linint2_points(T&longitude,T&latitude,T,True,dist@gclon,dist@gclat,2)
copy_VarAtts(T,trans) ; copy attributes
;trans!0 = "z_T" ; create named dimension and assign
;trans&z_T = T&time ; coordinate variable for 0th dimension only
trans!1 = "level"
trans&level =T&level
trans@_FillValue = T@missing_value
trans@scale_factor = T@scale_factor
;trans = trans*trans@scale_factor
;********************************
; create plot
;********************************
wks = gsn_open_wks("png","trans") ; send graphics to PNG file
gsn_define_colormap(wks,"rainbow")
res = True ; plot mods desired
res@tmXBMode = "Explicit" ; explicitly label x-axis
res@tmXBValues = (/points(0),points(npts-1)/) ; points to label
; label values
res@tmXBLabels = (/leftlat +", "+leftlon,rightlat+", "+rightlon/)
res@cnFillOn = True ; turn on color
res@lbLabelAutoStride = True ; nice label bar label stride
res@gsnSpreadColors = True ; use full range of colormap
res@cnLinesOn = True ; turn off countour lines
res@lbOrientation = "vertical" ; vertical label bar
res@pmLabelBarOrthogonalPosF = -0.05 ; move label bar closer to plot
res@tiMainString = "Transect" ; add title
res@tiXAxisString = "lat/lon along transect"
res@trYReverse = True ; reverse y axis
; res@trXReverse = True ; reverse x axis (neg longitudes)
; res@cnLevelSpacingF = 1.0 ; set contour spacing
plot = gsn_csm_contour(wks,trans,res) ; create plot
end
这是我参照ncl官网的例子写的脚本,但是出现报错,不知道这个报错是什么意思?
gsn_csm_contour: Fatal: the input data array must be 1D or 2D
fatal:Illegal right-hand side type for assignment
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 61 in file V-profile.ncl
|
|