[ncl-talk] slice plot
Bedassa Regassa
beregassa at gmail.com
Wed Oct 1 16:24:09 MDT 2014
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.
here is the wraning
warning:ScalarFieldSetValues: 2d coordinate array sfXArray has an incorrect
dimension size: defaulting sfXArray
here is my data information ncl_filedump and below alos my scrip
dimensions:
x = 186
y = 166
pressure = 9
time = 1 // unlimited
nb2 = 2
variables:
float lon ( y, x )
standard_name : longitude
long_name : longitude
units : degrees_east
_CoordinateAxisType : Lon
float lat ( y, x )
standard_name : latitude
long_name : latitude
units : degrees_north
_CoordinateAxisType : Lat
float pressure ( pressure )
standard_name : air_pressure
long_name : pressure
units : Pa
positive : down
axis : Z
double time ( time )
standard_name : time
long_name : time
bounds : time_bnds
units : seconds since 2009-05-01 00:00:00
calendar : proleptic_gregorian
double time_bnds ( time, nb2 )
units : seconds since 2009-05-01 00:00:00
calendar : proleptic_gregorian
float U ( time, pressure, y, x )
standard_name : grid_eastward_wind
long_name : U-component of wind
units : m s-1
coordinates : lon lat
;************************************************
;load the graphic libraries
;************************************************
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
;************************************************
;open file and read in data
;************************************************
f=addfile("u_2009_JJAS_mean.nc","r")
;************************************************
; get variables infromation and print them cclm
;************************************************
vars = getfilevarnames(f)
print(vars)
;************************************************
var=f->U(0,:,15,:)
lon2d=f->lon
lev=f->pressure
var at lon2d=lon2d
var at lev=lev
;*******************************
;create plot
;************************************************
;-- define workstation
wks = gsn_open_wks("png","plot_slices")
gsn_define_colormap(wks,"ncl_default") ;-- set the colormap to be used
;-- set resources
res = True
res at tiMainString = "DKRZ NCL Tutorial Example: Slice plot at 40N"
res at cnFillOn = True ;-- turn on color fill
res at cnLineLabelsOn = False ;-- turns off contour line labels
res at cnInfoLabelOn = False ;-- turns off contour info label
res at lbOrientation = "vertical" ;-- vertical label bar
res at tiYAxisString = var at long_name+" [hPa]"
;-- append units to y-axis label
;res at tfDoNDCOverlay = True
res at sfXArray = lon2d ;-- uses lon_t as plot x-axis
res at sfYArray = lev/100 ;-- uses lev_t in hPa as plot y-axis
res at gsnYAxisIrregular2Linear = True ;-- converts irreg depth to linear
res at trYReverse = True ;-- reverses y-axis
;-- generate the plot
plot = gsn_csm_contour(wks,var,res)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141002/bc071a08/attachment.html
More information about the ncl-talk
mailing list