# [ncl-talk] Cross section vertical coordinate and tick mark labeling

Evelyn Grell - NOAA Affiliate evelyn.grell at noaa.gov
Mon May 9 09:28:35 MDT 2016

```Ryan,

Your dbz array has been vertically interpolated, using wrf_user_intrp3d.
This routine has a hard-wired number of vertical levels set to 100.

Since you want to plot from 0-10 km, you should follow the example for a
limited vertical extent:
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/CROSS_SECTION/wrf_CrossSection4.htm
<http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/CROSS_SECTION/wrf_CrossSection4.htm>
in which your height (z) is also vertically interpolated to these 100
levels.  If you follow what happens to zz in the online example, I think
you will get what you want.  I have extracted the required lines and added

; get height info for labels
zmin = 0.
zmax = 10.                         ; We are only interested in
the first 10km
nz   = floattoint(zmax/2 + 1)        ; nz = # of tick marks (you want 6)

; Find the index where 10km is - only need to do this once

zz = wrf_user_intrp3d(z,z,"v",plane,angle,opts)    ;
interpolate z -> zz
b = ind(zz(:,0) .gt. zmax*1000. )                  ; get 1st
index above zmax
zspan = b(0) - 1                                         ;
level index to use

delete(zz)

delete(b)

.....

opts_xy at tmYLValues      = fspan(0,zspan,nz)         ; Create tick marks

opts_xy at tmYLLabels        =
sprintf("%.1f",fspan(zmin,zmax,nz))  ; Create labels

Then when you actually do the plotting, you must set the max index to
limit the vertical dimension:

contour_dbz = wrf_contour(a,wks,dbz_plane(0:zspan,:),opts_xy)

Good luck,

Evelyn

On Sun, May 8, 2016 at 8:22 PM, Ryan Connelly <rconne01 at gmail.com> wrote:

> Hi,
>
> I produce a vertical plane of, in this case, simulated reflectivity.  I
> want to then manually define the y axis (in this case z) to have tick marks
> every 2 km from 0 to 10 km.  This is proving surprisingly difficult.
>
> This WRF run has 39 vertical levels, yet somehow a PrintVarSummary of the
> newly-created plane (below) reveals that its vertical extent is "100".  100
> whats?  Not 100 vertical levels, not 100 meters or 100 km, not 100 hPa...
>
> I figured out how to use the tmYLValues and tmYLLabels options in xy
> plotting resources (also below) to define where to put tick marks and what
> to label them, to get me the 2-4-6-8-10 that I want, *but my problem is:
> how do I get them to match the actual vertical coordinate of the data
> (meters or km)?*  Right now, I can put in any numbers I want and it'll
> put them there, but the contours don't move, so the actual height of the
> data is not changing, and remains unknown.
>
> Variable: dbz_plane
> Type: float
> Total Size: 60400 bytes
>             15100 values
> Number of Dimensions: 2
> Dimensions and sizes:   [Vertical | 100] x [Horizontal | 151]
> Coordinates:
> Number Of Attributes: 4
>   _FillValue :  9.96921e+36
>   units :       dBZ
>   description : Reflectivity
>   Orientation : Cross-Section: (27,254) to (142,156)
>
> ****************************************************
>
>  ; Options for XY Plots
>         opts_xy                         = res
>         opts_xy at tiYAxisString           = "Height (km)"
>         opts_xy at cnMissingValPerimOn     = True
>         opts_xy at cnMissingValFillColor   = 0
>         opts_xy at cnMissingValFillPattern = 11
>         opts_xy at tmYLMode                = "Explicit"
>         ;opts_xy at tmYLValues              = fspan(0,100,6)
>    ; Create tick marks
>         ;opts_xy at tmYLLabels              = fspan(0,10,6)  ; Create labels
>         opts_xy at tiXAxisFontHeightF      = 0.020
>         opts_xy at tiYAxisFontHeightF      = 0.020
>         opts_xy at tmXBMajorLengthF        = 0.02
>         opts_xy at tmYLMajorLengthF        = 0.02
>         opts_xy at tmYLLabelFontHeightF    = 0.015
>         opts_xy at PlotOrientation         = dbz_plane at Orientation
>
>
> Thanks,
> Ryan
>
> --
> Ryan Connelly
> M.S. Student in Atmospheric Sciences, Stony Brook University
> B.S. in Meteorology with Minors in Mathematics and GIS, Valparaiso
> University
> rconne01 at gmail.com
> ryan.connelly at stonybrook.edu
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160509/25c928c0/attachment.html
```