- 积分
- 443
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-8-13
- 最后登录
- 1970-1-1

|
NCL
系统平台: |
|
问题截图: |
- |
问题概况: |
NCL 矢量图
关于warning:ScalarFieldSetValues: irregular coordinate array sfYArray non-monotonic: defaulting sfYArray
warning:VectorFieldSetValues: irregular coordinate array vfYArray non-monotonic: defaulting vfYArray报错 |
我看过提问的智慧: |
看过 |
自己思考时长(天): |
5 |
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
最近在画风应力,遇到了一个很棘手的问题,数据是CESM海洋模块的output。和一般的nc文件有点不同。直接printMaxMin 得到lat的范围是在-79~89.如果是lat(:,0)范围只有在-79~78.但是lat(:,159)范围刚好可以满足-79~89.所以我选取的是第159列
但是,一直在报以下错误:
报错信息
红色框 一直都有但是也能画出图 我就没有管。主要是黄色框的错误
出图效果:
不增加sqort(lat)
增加sqort(lat)以及res@trGridType = "TriangularMesh"
箭头只在北半球有!!!
之后我把换成lat(:,0) 只有红色框的报错信息
出图效果:
箭头和map都吻合了,但是北极缺一截啊!!!
实在不知道怎么办了,希望能够得到大家的帮助!
主要报错信息:
warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for Y axis failed: consider adjusting trYTensionF value
warning:IrTransInitialize: error creating spline approximation for trYCoordPoints; defaulting to linear
以下是我的代码:
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
fils = systemfunc("ls taux.feedback*.nc")
f = addfiles(fils,"r")
dsizes = getfiledimsizes(f[0])
ListSetType (f, "cat")
bu = f[:]->TAUX({757375:764644},:,:)
u0 = dim_avg_n_Wrap(bu, 0)
;;;;
lat=f[0]->ULAT(:,0)
lon0=f[0]->ULONG(0,:)
nlat=dimsizes(lat)
nlon=dimsizes(lon0)
qsort(lat)
lon=new(nlon,double)
u=new((/nlat,nlon/),double)
lon(0:284)=lon0(35:319)
lon(285:319)=lon0(0:34)
u(:,0:284)=u0(:,35:319)
u(:,285:319)=u0(:,0:34)
u!0 = "lat"
u&lat = lat
u&lat@units = "degrees_north"
u!1 = "lon"
u&lon = lon
u&lon@units = "degrees_east"
;u = lonFlip(u)
;;;;;;;;;;;;;;;;;;;;;control;;;;;;;
fils_c = systemfunc("ls *.TAUX.201001-203012.nc ")
f_c = addfiles(fils_c,"r")
ListSetType (f_c, "cat")
dsizes = getfiledimsizes(f_c[0])
bu_c = f_c[:]->TAUX({733681:740950},:,:)
u_c = dim_avg_n_Wrap(bu_c, 0)
;;;
zz1_c=new(((/nlat,nlon/)),double)
zz1_c(:,0:284)=u_c(:,35:319)
zz1_c(:,285:319)=u_c(:,0:34)
;;;
zz1_c!0 ="lat"
zz1_c!1 ="lon"
zz1_c&lat = lat
zz1_c&lon = lon
zz1_c&lat@units = "degrees_north"
zz1_c&lon@units = "degrees_east"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mius;;;;;
z = (u - zz1_c)*10
z!0 ="lat"
z!1 ="lon"
z&lat = lat
z&lon = lon
z&lat@units = "degrees_north"
z&lon@units = "degrees_east"
;;;;;;;TAUY case
;;;;TAUY feedback
tauy_fils = systemfunc("ls tauy.feedback*.nc")
tauy_f = addfiles(tauy_fils, "r")
dsizes = getfiledimsizes(tauy_f[0])
ListSetType(tauy_f, "cat")
tauy_bu = tauy_f[:]->TAUY({757375:764644},:,:)
tauy_u = dim_avg_n_Wrap(tauy_bu, 0)
v_tauy=new((/nlat,nlon/),double)
v_tauy(:,0:284)=tauy_u(:,35:319)
v_tauy(:,285:319)=tauy_u(:,0:34)
v_tauy!0 = "lat"
v_tauy&lat = lat
v_tauy!1 = "lon"
v_tauy&lon = lon
v_tauy&lat@units = "degrees_north"
v_tauy&lon@units = "degrees_east"
;;;;control case
con_tauy_fils = systemfunc("ls *.TAUY.201001-203012.nc")
con_tauy_f = addfiles(con_tauy_fils,"r")
dsizes = getfiledimsizes(con_tauy_f[0])
ListSetType (con_tauy_f, "cat")
con_tauy_bu = con_tauy_f[:]->TAUY({733681:740950},:,:)
con_tauy_u = dim_avg_n_Wrap(con_tauy_bu, 0)
v_tauy_rcp=new((/nlat,nlon/),double)
v_tauy_rcp(:,0:284)=con_tauy_u(:,35:319)
v_tauy_rcp(:,285:319)=con_tauy_u(:,0:34)
v_tauy_rcp!0 = "lat"
v_tauy_rcp&lat = lat
v_tauy_rcp!1 = "lon"
v_tauy_rcp&lon = lon
v_tauy_rcp&lat@units = "degrees_north"
v_tauy_rcp&lon@units = "degrees_east"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mius;;;;;
tauy_geo = (v_tauy - v_tauy_rcp)*10
tauy_geo!0 ="lat"
tauy_geo!1 ="lon"
tauy_geo&lat = lat
tauy_geo&lon = lon
tauy_geo&lat@units = "degrees_north"
tauy_geo&lon@units = "degrees_east"
;;;U,V
;;;feedback
spd_geo = sqrt(z^2+tauy_geo^2)
spd_geo!0 ="lat"
spd_geo!1 ="lon"
spd_geo&lat = lat
spd_geo&lon = lon
spd_geo&lat@units = "degrees_north"
spd_geo&lon@units = "degrees_east"
copy_VarMeta(z, spd_geo)
;----------------------------------------------------------------------
; Set some resources common to all map projections.
;----------------------------------------------------------------------
wks = gsn_open_wks("png","feedback")
gsn_define_colormap(wks,"cmocean_curl")
res = True
res@gsnDraw = False
res@gsnFrame = False ; don't advance frame
res@cnInfoLabelOn = False ; turn off cn info label
res@cnFillOn = True ; turn on color
res@lbLabelBarOn = True
res@mpGeophysicalLineColor = "Grey18"
res@mpGeophysicalLineThicknessF = 1.5
;;;;;;;
res@gsnMaximize = True ; maximize plot in frame
res@cnFillMode = "RasterFill"
res@cnRasterSmoothingOn = True
res@cnFillOn = True ; turn on contour fill
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; turn off contour labels
res@mpDataBaseVersion = "MediumRes" ; better map outlines
res@mpPerimOn = False ; turn off map perimeter
res@mpFillDrawOrder = "PostDraw" ; draw map fill last
res@mpOutlineOn = True ;打开地图大陆轮廓
res@mpFillOn = False
res@tiMainFontHeightF = 0.02 ; change size of main title
res@gsnRightString = "N/m^2"
res@gsnLeftString = "Wind stress"
res@cnLevelSelectionMode = "AutomaticLevels"
res@gsnAddCyclic = True
res@trGridType = "TriangularMesh"
res@mpProjection = "CylindricalEquidistant"
res@gsnCenterString = "GEO(2075~~2095) minus RCP8.5(2010~~2030)"
vcres = True
vcres@gsnDraw = False
vcres@gsnFrame = False
vcres@gsnAddCyclic =True
vcres@vcFillArrowsOn = True
vcres@gsnRightString = ""
vcres@gsnLeftString = ""
vcres@vcRefMagnitudeF = 5 ; define vector ref mag
vcres@vcRefLengthF = 0.02 ; define length of vec ref
vcres@vcMinFracLengthF = 0.03
vcres@vcMinDistanceF = 0.02
vcres@vcRefAnnoOrthogonalPosF = -0.45
vcres@vcRefAnnoFontHeightF = 0.005
;---This time make vectors partially transparent
vcres@vcGlyphOpacityF = 0.3
res@tiMainString = "GEO(2075~~2095) minus RCP8.5(2010~~2030)"
uv_plot = gsn_csm_vector(wks,z,tauy_geo,vcres)
spd_plot = gsn_csm_contour_map(wks,spd_geo,res)
overlay(spd_plot,uv_plot)
draw(spd_plot)
frame(wks)
end
|
|