x axis Major Tick Marks

From: Yi-Chih Huang <dscpln_at_nyahnyahspammersnyahnyah>
Date: Sun Nov 10 2013 - 18:48:44 MST

Hello,

    I am trying to give 1986, 1987, and 1988 on x axis. But I got the
warning below. There is no tick mark or any labeling on x axis. Is there
anyone knowing what is wrong with my script?

    Thanks much,

                Yi-Chih

#####
yhuang@arc-env:/fs3/yhuang/scripts$ ncl dipoleMth.ncl
 Copyright (C) 1995-2013 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.1.2
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct
warning:ManualComputeMajorTickMarks: The precision specified is smaller
than the precision needed tick mark labels may not be correct

#####
begin
  dirSst= "/fs3/SysE_DB/saji/OISST/Monthly/Mean/"
  dirU= "/fs3/SysE_DB/nmm/CFSR/Monthly/Mean/"
; dir2= (/"1981/","1982/","1983/"/)
  dir2= (/"1986/","1987/","1988/"/)
; dir2= (/"1996/","1997/","1998/"/)
  mth=
(/198601,198602,198603,198604,198605,198606,198607,198608,198609,198610,198611,198612,\

 198701,198702,198703,198704,198705,198706,198707,198708,198709,198710,198711,198712,\

 198801,198802,198803,198804,198805,198806,198807,198808,198809,198810,198811,198812/)
  varName= (/"sst","us"/)
  nyr= dimsizes(dir2)

  dim= dimsizes(mth)
  yrF= new (dim, float)
  do nd=0,dim-1
     yyyy = mth(nd)/100
     mon = mth(nd)-yyyy*100
     yrF(nd) = yyyy + (mon-1)/12.
  end do

  xx= new((/nyr*12/),float,"No_FillValue")
  yy= new((/nyr*12/),float,"No_FillValue")
  zz= new((/nyr*12/),float,"No_FillValue")

  do ny= 0,nyr-1
    dir = str_concat(dirSst+dir2(ny))
    fil= systemfunc("cd "+dir+" ; ls sst.nc")
    f= addfile (dir+fil, "r")
    x= f->$varName(0)$
    dims = getfilevardims(f,varName(0))

    x1= x($dims(0)$|:,{$dims(1)$|10:-10},{$dims(2)$|50:70}) ; first domain
    xs= dim_avg_n_Wrap( x1, (/1,2/) )

    y1= x($dims(0)$|:,{$dims(1)$|0:-10},{$dims(2)$|110:90}) ; second domain
    ys= dim_avg_n_Wrap( y1, (/1,2/) )

    do i= 0,11
      m= ny*12 +i
      xx(m)= xs(i)
      yy(m)= ys(i)
    end do
  end do

  dt= xx - yy
  dt= dim_standardize(dt, 0)

  do ny= 0,nyr-1
    dir = str_concat(dirU+dir2(ny))
    fil= systemfunc("cd "+dir+" ; ls us.nc")
    f= addfile (dir+fil, "r")
    y= f->$varName(1)$
    dims = getfilevardims(f,varName(1))

    y1:= y($dims(0)$|:,{$dims(1)$|5:-5},{$dims(2)$|70:90})
    ys= dim_avg_n_Wrap( y1, (/1,2/) )

    z1:= y($dims(0)$|:,{$dims(1)$|5:-5},{$dims(2)$|:})
    zs= dim_avg_n_Wrap( z1, (/1,2/) )

    do i= 0,11
      m= ny*12 +i
      yy(m)= ys(i)
      zz(m)= zs(i)
    end do
  end do

  du= yy - zz
  du= dim_standardize(du, 0)

  wks = gsn_open_wks ("X11", "dipoleMth87" )
  res = True
  res@gsnScale = True

; these four resources allow the user to stretch the plot size, and
; decide exactly where on the page to draw it.

  res@vpXF = 0.10 ; In page coordinates, where to start
  res@vpYF = 0.75 ; the plot
  res@vpHeightF = 0.43 ; Changes the aspect ratio
  res@vpWidthF = 0.85

  res@trYMinF = -3.0 ; min value on y-axis
  res@trYMaxF = 3.0 ; max value on y-axis

  res@tiYAxisString = "Anomalies" ; y-axis label
; res@tiMainString = "Dipole Mode Index and

  res@gsnYRefLine = 0. ; reference line
  res@gsnXYBarChart = True ; create bar chart
  res@gsnXYBarChartColors2 = (/"blue"/)

  res@tmXBMode = "Manual"
  res@tmXBTickStartF = 1986
  res@tmXBTickEndF = 1988
  res@tmXBTickSpacingF= 1
  res@tmXBPrecision = 4

  res@gsnDraw = False
  res@gsnFrame = False

  plot1= gsn_csm_xy (wks,yrF,dt,res)
  res@gsnXYBarChartColors2 =(/"red"/)
  plot2= gsn_csm_xy (wks,yrF,du,res)

  lbres = True
  lbres@vpWidthF = 0.2 ; labelbar width
  lbres@vpHeightF = 0.1 ; labelbar height
  lbres@lbBoxMajorExtentF = 0.36 ; puts space between color boxes
  lbres@lbFillColors = (/"blue","red"/)
  lbres@lbMonoFillPattern = True ; Solid fill pattern
  lbres@lbLabelFontHeightF = 0.020 ; font height. default is small
  lbres@lbLabelJust = "CenterLeft" ; left justify labels
  lbres@lbPerimOn = False
  lbres@lgPerimColor = "white"
  labels = (/"Dipole Mode Index","Equitorial Zonal Wind Anomaly"/)
  gsn_labelbar_ndc(wks,2,labels,0.10,0.25,lbres) ; draw right
labelbar column

  overlay(plot1,plot2)
  maximize_output(wks,True)
  frame(wks)
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Nov 10 18:48:56 2013

This archive was generated by hypermail 2.1.8 : Mon Nov 11 2013 - 09:45:33 MST