Help with cross-section Y-axis labels

From: Chris Klich <caklich_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 14 2012 - 08:46:08 MST

Hi all, I am currently plotting a cross-section of vertical velocity from a
WRF output file. However, it seems no matter what I try to do the Y-axis
labels are odd numbers. For example, in my current script, they are in
increments of about 2.2km, when in the end I would like them every 2 or 3
kilometers. I am fairly new at making cross-section plots in NCL, and I
have used the sample scripts to help build my current code (which is not
done formatting). However, I cannot seem to figure out how to make the
labels "nicer" numbers.

Any help will be appreciated! I've attached the code I'm using, as well as
pasted below the section of the code that makes the height labels.

      if ( FirstTime ) then ; get height info for
labels
         zmin = 0.
         zmax = max(z)/1000.
         nz = floattoint(zmax/2 + 1)
         FirstTime = False
      end if

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ; Use the built in latlon to ij function to convert the
specified ;
      ; latitudes and longitudes to the closest i/x and j/y points in the
domain ;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

      loc_xy = wrf_user_latlon_to_ij(a,lats,lons)
      ys = loc_xy(0,0) ; Starting y (j)
location
      ye = loc_xy(1,0) ; Ending y (j) location
      xs = loc_xy(0,1) ; Starting x (i)
location
      xe = loc_xy(1,1) ; Ending x (i) location

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ; Specify the start and end points of the cross section after
creating a ;
      ; plane to store these start and end locations ;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

      plane = new(4,float) ; Create a float plane with
4 dimension sizes
      plane = (/ xs,ys , xe,ye /) ; Approx. start x,y
and end x,y point

      opts = True ; Set options for the
wrf_user_intrp3d below to True
      w_plane = wrf_user_intrp2d(w,plane,0.,opts) ; Use the
wrf_user_intrp2d to create a vertical cross section plane of W with
interpolated heights
      dim = dimsizes(w_plane) ; Find the data span
- for use in labels
      zspan = dim(0)

      opts_xy = res
      opts_xy@tiYAxisString = "Height (km)"
      opts_xy@AspectRatio = 0.75
      opts_xy@cnMissingValPerimOn = True
      opts_xy@cnMissingValFillColor = 0
      opts_xy@cnMissingValFillPattern = 11
      opts_xy@tmYLMode = "Explicit"
      opts_xy@tmYLValues =
fspan(0,zspan,nz) ; Create tick marks
      opts_xy@tmYLLabels =
sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels
      opts_xy@tiXAxisFontHeightF = 0.020
      opts_xy@tiYAxisFontHeightF = 0.020
      opts_xy@tmXBMajorLengthF = 0.02
      opts_xy@tmYLMajorLengthF = 0.02
      opts_xy@tmYLLabelFontHeightF = 0.015

Thank you,
Chris Klich

-- 
Christopher Klich
Graduate Student
Florida State University
(908) 208-9743


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Feb 14 08:46:25 2012

This archive was generated by hypermail 2.1.8 : Fri Feb 17 2012 - 08:50:10 MST