[ncl-talk] vinth2p and vibeta commends

Huan Wang wangh1 at uchicago.edu
Mon Mar 21 10:45:25 MDT 2016


Hi,
In regard to this question,

I'm writing to ask if the values after doing 'vinth2p' which is used for transforming data from hybrid levels to pressure levels and 'vibeta' which is used for doing vertical integral on pressure levels should be the same of just doing vertical integral on pressure levels.

My results seem to be different, but I think they should be the same. So I want to know where I can see the description file of 'vinth2p' and 'vibeta'.

Also, my coomands are below:

;NCL tutorial script: vert_1.ncl
;************************************************
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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl" 
;************************************************
begin
;************************************************
; file handling
;************************************************  
fn  =systemfunc("ls /project/tas1/wangh1/cesm/output/con/atm/hist/6-8/con.cam.h0.*.nc"); define filename
   in  = addfiles(fn,"r")                         ; open netcdf file   
ListSetType(in, "join") 

;************************************************
; read needed variables from file
;************************************************
   UQ = in[:]->UQ 
   P0mb =10.
   hyam = in[1]->hyam                             ; get a coefficiants
   hybm = in[1]->hybm                              ; get b coefficiants
   PS   = in[:]->PS                                ; get pressure
   lat= in[1]->lat
   lon=in[1]->lon
pnew = (/975,950,925,900,875,850,800,775,750,700,650,600,550,500,450,400,350,300,200,150,100,70,50,30,20,10,4/) 
interp = 1 
extrap = False
UQonP = vinth2p(UQ(:,0,:,:,:),hyam,hybm,pnew,PS(:,0,:,:),interp,P0mb,1,extrap)
UQ1 = dim_avg_n(UQonP,0)
PS1= dim_avg_n(PS,0)
lev=pnew
lat=fspan(-90,90,96)
lon=fspan(0,357.5,144)
lon!0                 = "lon"
        lon at units         = "degrees_east"
        lat!0                 = "lat"
        lat at units         = "degrees_north"
        lev!0                = "lev"
        lev at units        = "hPa"
UQ1!0="lev"
        UQ1!1         = "lat"
        UQ1!2         = "lon"
        UQ1&lon = lon
        UQ1&lat = lat
        UQ1&lev = lev
time=1
QU1 = UQ1(lon|:, lat|:,lev|:)
PS1!0="time" 
PS1!1   = "lat"
PS1!2         = "lon"
PS1 &lon = lon
PS1 &lat = lat
PS1&time=time
PS11 = PS1(lon|:, lat|:, time|:)
linlog = 1  
data11=(vibeta(pnew,QU1,linlog,PS11(:,:,0),1050,4))/9.8
data11!0="lon"
data11!1         = "lat"
data11&lon = lon
data11&lat = lat
u= data11(lat|:,  lon|:)

; Doing vertical integral using my own commands
dp=dpres_plevel(pnew,P0mb,4,0)
Dp=dim_avg_n(dp,0)
fint1=dim_sum_n (UQ1*Dp,0)
 
end

u and fint1 should be the same, but they are not. 

Thank you so much for helping me solve the problem!



Huan





More information about the ncl-talk mailing list