<p dir="ltr">I am new to ncl. I am to plot the vertical Height vs longitude but I got warning and I tried to a lot to find my error.</p>
<p dir="ltr">here is the wraning<br>
<br>
warning:ScalarFieldSetValues: 2d coordinate array sfXArray has an incorrect dimension size: defaulting sfXArray</p>
<p dir="ltr">here is my data information ncl_filedump and below alos my scrip<br></p>
<p dir="ltr">dimensions:<br>
x = 186<br>
y = 166<br>
pressure = 9<br>
time = 1 // unlimited<br>
nb2 = 2<br>
variables:<br>
float lon ( y, x )<br>
standard_name : longitude<br>
long_name : longitude<br>
units : degrees_east<br>
_CoordinateAxisType : Lon</p>
<p dir="ltr"> float lat ( y, x )<br>
standard_name : latitude<br>
long_name : latitude<br>
units : degrees_north<br>
_CoordinateAxisType : Lat</p>
<p dir="ltr"> float pressure ( pressure )<br>
standard_name : air_pressure<br>
long_name : pressure<br>
units : Pa<br>
positive : down<br>
axis : Z</p>
<p dir="ltr"> double time ( time )<br>
standard_name : time<br>
long_name : time<br>
bounds : time_bnds<br>
units : seconds since 2009-05-01 00:00:00<br>
calendar : proleptic_gregorian</p>
<p dir="ltr"> double time_bnds ( time, nb2 )<br>
units : seconds since 2009-05-01 00:00:00<br>
calendar : proleptic_gregorian</p>
<p dir="ltr"> float U ( time, pressure, y, x )<br>
standard_name : grid_eastward_wind<br>
long_name : U-component of wind<br>
units : m s-1<br>
coordinates : lon lat</p>
<p dir="ltr">;************************************************<br>
;load the graphic libraries <br>
;************************************************<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" <br>
;************************************************<br>
begin<br>
;************************************************<br>
;open file and read in data<br>
;************************************************<br>
f=addfile("u_2009_JJAS_mean.nc","r")<br>
;************************************************<br>
; get variables infromation and print them cclm <br>
;************************************************<br>
vars = getfilevarnames(f)<br>
print(vars)<br>
;************************************************<br>
var=f->U(0,:,15,:)        <br>
lon2d=f->lon<br>
lev=f->pressure</p>
<p dir="ltr">var@lon2d=lon2d<br>
var@lev=lev<br>
;*******************************<br>
;create plot<br>
;************************************************</p>
<p dir="ltr">;-- define workstation<br>
wks = gsn_open_wks("png","plot_slices")<br>
gsn_define_colormap(wks,"ncl_default") ;-- set the colormap to be used<br>
;-- set resources<br>
res = True<br>
res@tiMainString = "DKRZ NCL Tutorial Example: Slice plot at 40N"<br>
res@cnFillOn = True ;-- turn on color fill<br>
res@cnLineLabelsOn = False ;-- turns off contour line labels<br>
res@cnInfoLabelOn = False ;-- turns off contour info label<br>
res@lbOrientation = "vertical" ;-- vertical label bar<br>
res@tiYAxisString = var@long_name+" [hPa]"<br>
;-- append units to y-axis label<br>
;res@tfDoNDCOverlay = True<br>
res@sfXArray = lon2d ;-- uses lon_t as plot x-axis<br>
res@sfYArray = lev/100 ;-- uses lev_t in hPa as plot y-axis<br>
res@gsnYAxisIrregular2Linear = True ;-- converts irreg depth to linear<br>
res@trYReverse = True ;-- reverses y-axis</p>
<p dir="ltr">;-- generate the plot<br>
plot = gsn_csm_contour(wks,var,res)<br>
end</p>