[ncl-talk] problem with prcwater_dp example 3 (use with dpres_hybrid_ccm)

Andrea Jenney andrea at atmos.colostate.edu
Tue Oct 16 13:56:55 MDT 2018


The third example in the documentation <https://www.ncl.ucar.edu/Document/Functions/Built-in/prcwater_dp.shtml> for the function "prcwater_dp" does not work as written (copied below):

  q    = f->Q    ; specific humidity [kg/kg]
  hyai = f->hyai ; read from a file the interface hybrid coefficients (size = nlev)
  hybi = f->hybi ; read from a file
  ps   = f->PS   ; surface pressure [Pa]
  p0   = 100000. ; since ps is in Pa 

  dp   = dpres_hybrid_ccm <https://www.ncl.ucar.edu/Document/Functions/Built-in/dpres_hybrid_ccm.shtml>(ps,p0,hyai,hybi)   
; dp(ntime,nlev-1,nlat,nlon)
  dp!0 = "time"
  dp!1 = "lev"
  dp!2 = "lat"
  dp!3 = "lon"

  pw = prcwater_dp(q(time|:,lat|:,lon|:,lev|:),dp(time|:,lat|:,lon|:,lev|:))    
; pw [kg/m2]
  pw at long_name = "total column precipitable water"
  pw at units     = "kg/m2"

This is because the level dimension that "dpres_hybrid_ccm" outputs has size nlev-1 (which is noted in the example code), and the "prcwater_dp" function requires that the level dimensions be the same length. 

I can work around this by subsetting the specific humidity, q, to leave out the highest level (so that its level dimension now has size nlev-1), but I just wanted to make a note that the example is not sufficient. 

---
Andrea Jenney
PhD Student | Randall & Barnes Groups
Colorado State University | Dept. of Atmospheric Science 







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181016/03e10910/attachment.html>


More information about the ncl-talk mailing list