All,.
I have been trying to make a simple plot of temp in the vertical vs
time for a single point. The 2d array that I have has temp in the y at the
following pressure levels: 1000.,975.,950.,925.,850.,700.,500.,400.(the
hotter temps are at the higher pressure). When I do a plot I get the
contour but the labeling is not on the log scale...I also do not think the
contour plot is in the log...I think the "layers" of the plot are also
equidistant. I am using a python wrapper around NCL.
Any help would be appreciated.
ny = 8
nx = 9
levels = Numeric.array([1000.,975.,950.,925.,850.,700.,500.,400.])
levels = levels[::-1]
grid = Numeric.array([ 61, 59, 62, 68, 70, 68, 65, 62, 59,
66, 65, 65, 66, 66, 64, 62, 61, 59,
70, 69, 68, 68, 67, 67, 67, 65, 63,
68, 68, 67, 67, 67, 67, 67, 66, 65,
62, 62, 61, 61, 60, 60, 59, 58, 58,
39, 39, 40, 40, 40, 40, 39, 38, 38,
9, 9, 9, 8, 8, 6, 5, 4,
4,
-14,-14,-14,-15,-15,-15,-15,-14,-14,])
grid = Numeric.reshape(grid,(ny,nx))
# create cdms transient variable.
x_axis =cdms.createAxis(nx)
y_axis =cdms.createAxis(ny)
levels = cdms.createVariable(levels)
grid = cdms.createVariable(grid)
grid.long_name = 'contour'
grid.units = 'Deg_F'
# create Ncl instance, add variable to ncl variable dictionary,
# NCARG_ROOT only needs to be set by first class instance.
plot2 = Ncl()
# cdms slicing is used to extract only NH extratropics.
plot2['grid']=grid
plot2['levels']=levels
#plot2.plotdev = "png"
plot2.plotdev = "x11"
plot2.plotname = "pyncl_ex2"
plot2.xsize = 500
plot2.ysize = 600
cint = 10.0 # contour interval for plot.
# create the NCL script.
plot2("""
; the ncl script commands are one big multi-line string
; all the gsn scripts are loaded and the data is read in automatically.
; No "begin" or "end" statements are needed.
; the data is accessed using the name defined by the data dictionary key.
printVarSummary(grid)
smothgrid = smth9(grid, 0.50, -0.25, False)
gsn_define_colormap(wks,"BlueRed") ; choose colormap
res = True
res@tiYAxisString = "Pressure (mb)" ; Y axes label.
res@sfYArray = levels
res@tmYLMode = "Explicit" ; Define own tick mark labels.
res@tmYLLabelFont = 25 ; Change the font.
res@tmYLValues = levels
res@tmYLLabels = (/"1000","975","950","925","850","700","500","400"/)
res@tmYLMinorOn = False ; No minor tick marks.
res@trYReverse = True ; Reverse the Y values.
res@trYLog = True ; Use log scale.
; contour = gsn_contour(wks, smothgrid, res) ; Create a contour plot.
; getvalues contour ; Retrieve contour levels.
; "cnLevels" : levels
; end getvalues
res@gsnSpreadColors = True
res@cnFillOn = True ; turns on the color
; res@mpFillOn = False ; turns off continent gray
res@cnLineLabelsOn = True ; no contour labels
res@cnLevelSpacingF = %(cint)s
res@tiMainString = "contour"
plot = gsn_csm_contour(wks,smothgrid,res)
; draw(contour) ;Draw the contour plot.
""" % locals()) # local variables 'cint' is substituted.
# execute NCL script - 600x600 pixel plot will display in an X window
print plot2
plot2.nclrun()
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Wed Mar 10 2004 - 13:41:09 MST