[ncl-talk] Pressure Vertical Axis

MELISSA KAZEMI RAD mk1369 at scarletmail.rutgers.edu
Wed Jul 25 12:58:27 MDT 2018


Hi,

I am trying to create a vertical cross_section plot from a wrf output file.
I have spent a lot of time looking through all example ncl codes, trying to
figure out how to have the y-axis, representing the vertical height show
pressure values in pa, rather than the number of eta-levels.

Here is my NCL code:

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/wrf/WRFUserARW.ncl"
;----------------------------------------------------------------------
 ; Main code
 ;----------------------------------------------------------------------
 begin
  a = addfile("wrfout_d03_2017-07-17_06_00_00.nc","r")

;   type = "x11"
;   type = "pdf"
;   type = "ps"
    type = "png"

   wks = gsn_open_wks(type,"EQTemp_Press_Cross_166")

   time = 166

    p    = wrf_user_getvar(a, "pressure", time)    ; Total Pressure
    P    = wrf_user_getvar(a, "P", time)
    PB   = wrf_user_getvar(a, "PB",time)
    T    = wrf_user_getvar(a,"T",time)
    U    = wrf_user_getvar(a, "ua", time)
    V    = wrf_user_getvar(a, "va", time)
;   z    = wrf_user_getvar(a,"z",time)
    qv   = wrf_user_getvar(a, "QVAPOR", time)


    T_t  = T + 290.        ; potential temperature in K.
    P_t  = P + PB
    tk   = wrf_tk(P_t, T_t)
    eth  = wrf_eth(qv, tk, P_t)
    plane = (/342, 1387/)
    t_plane = wrf_user_intrp3d(eth,p,"v",plane,50.,False)
    P_plane = wrf_user_intrp3d(P,p,"v",plane,50.,False)

    printVarSummary(t_plane)

    res                     = True
    res at MainTitle           = "Vertical Cross-Section of Potential
Temperature"
    res at InitTime            =  False
    res at TimePos             = "Left"
    res at Footer              = False
    res at lbTitleOn           = True
    res at lbTitleString       = "Temperature"
    res at tmYLMode            = "Explicit"
    res at tmYLValues          = (/1000, 850, 700, 500, 400, 300, 250,\
                                   200,  150, 100, 50, 10/)
    res at tmYLLabels          = "" + res at tmYLValues
    res at tmXBLabelFontHeightF = 0.015
    res at tmYLLabelFontHeightF = 0.015


    tres                     = res
    tres at cnFillOn            = True
    tres at cnFillPalette       = "BlWhRe"
    tres at cnSpreadcolor       = True


    pres                         = res
    pres at cnFillOn               = False
    pres at ContourParameters      = (/ 2. /)
    pres at cnInfoLabelFontHeightF = 0.01




    T_contour =  wrf_contour(a,wks,t_plane,tres)
    P_contour = wrf_contour(a,wks,P_plane,pres)

    pltres             = True
    pltres at gsnMaximize = True

   plot  = wrf_overlays(a,wks,(/T_contour, P_contour/), pltres)

end

I'd really appreciate your help.

Bests,
Melissa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180725/ea31547f/attachment.html>


More information about the ncl-talk mailing list