Re: Hybrid to pressure coordinates

From: Adam Phillips (asphilli AT XXXXXX)
Date: Tue Dec 21 2004 - 15:02:12 MST


Hi Alex,

Dennis and I were just talking about your script, and I think I see what is
going on. The main issue is that the units of P0 is hPa/mb, and you are setting
it to 100000 Pa.. I slightly modified your script to provide consistency between
the 2 plots in the contours, Y-Axis... Try this out:

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"

begin
f = addfile ("b20.007.cam1.h0.1339-12.nc","r")
U=f->U
PS=f->PS ;Pascals
hyam=f->hyam
hybm=f->hybm

P0=1000.
interp = 2
extrap = False
lev = (/1000,990,980,965,950,930,900,870,840,800,750,700,600,500,400,200/)
lev@units = "hPa"
UonP = vinth2p(U,hyam,hybm,lev,PS,interp,P0,1,extrap)

wks = gsn_open_wks("ps","test")
gsn_define_colormap(wks,"BlWhRe")
res = True ; plot mods desired
res@cnFillOn = True ; turn on color
res@gsnSpreadColors = True
res@lbOrientation ="vertical"
res@trYReverse = True
res@trYMinF = 200.
res@trYMaxF = 1000.
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = fspan(-40.,40.,21)
plot = gsn_csm_contour(wks,dim_avg_Wrap(U(0,:,:,:)),res)
delete(res@trYReverse) ;
plot = gsn_csm_pres_hgt(wks,dim_avg_Wrap(UonP(0,:,:,:)),res)
end

Adam
>Hi
>Im trying to convert from cam1 hybrid vertical coordinates to pressure
>coordinates. Can you tell me is the vinth2p appropriate for this (as only
>CCM is mentioned in documentation)? If it is, any ideas why the following
>code wouldn't produce the correct results?
>Many thanks
>Alex
>
>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"
>f = addfile ("/u4/CCSM_FULL/b20.007.cam1.h0.1339-12.nc","r")
>U=f->U
>PS=f->PS ;Pascals
>hyam=f->hyam
>hybm=f->hybm
>
> P0=100000
>; type of interpolation: 1 = linear, 2 = log, 3 = loglog
> interp = 2
>
>; is extrapolation desired if data is outside the range of PS
> extrap = False
>
>; create an array of desired pressure levels:
> pnew =
>(/1000,990,980,965,950,930,900,870,840,800,750,700,600,500,400,200/)
>;************************************************
>; calculate T on pressure levels
>;************************************************
>UonP = vinth2p(U,hyam,hybm,pnew,PS,interp,P0,1,extrap)
>
>wks = gsn_open_wks("X11","test")
>gsn_define_colormap(wks,"BlWhRe")
>res = True ; plot mods desired
>res@cnFillOn = True ; turn on color
>res@gsnSpreadColors = True
>res@lbOrientation ="vertical"
>plot = gsn_csm_contour(wks,dim_avg_Wrap(U(0,:,:,:)),res)
>UonP&lev_p@units="PA"
>plot = gsn_csm_pres_hgt(wks,dim_avg_Wrap(UonP(0,:,:,:)),res)
>
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk AT ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------------------------------------------------------
Adam Phillips email: asphilli AT ucar.edu
Climate and Global Dynamics Division tel: (303) 497-1726
National Center for Atmospheric Research fax: (303) 497-1333
P.O. Box 3000
Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli

_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Wed Dec 22 2004 - 11:56:28 MST