Hi all,
I am using the vert_1.ncl to convert CCSM data (for WRF) from hybrid to
pressure.
Although, T, U, V and Humidity were successful, there is a problem with
conversion of geopotential heights, despite using surface geopotential
and surface pressure.
I use vinth2p_ecmwf, since I need values upto 1000mb .( ie
extrapolation).
My code is below
Any help in conversion please..
Thanks a lot
Sri
---------------------------
;*************************************************
; 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"
;************************************************
begin
Ntime = 1
;************************************************
; file handling
;************************************************
fn1 =
"b30.042e.cam2.h3.Z3.60E-150E_50S-50N.2000-01-01_cat_2000-12-31.nc" ;
define filename
in1 = addfile(fn1,"r") ; open netcdf file
Z3 = in1->Z3 ; select variable to
ave
P0mb =1000.
hyam = in1->hyam ; get a coefficiants
hybm = in1->hybm ; get b coefficiants
fn2 =
"b30.042e.cam2.h3.PS.60E-150E_50S-50N.2000-01-01_cat_2009-12-31.nc" ;
define filename
in2 = addfile(fn2,"r") ; open netcdf file
PS = in2->PS
fn3 =
"b30.042e.cam2.h3.PHIS.60E-150E_50S-50N.2000-01-01_cat_2009-12-31.nc" ;
define filename
in3 = addfile(fn3,"r") ; open netcdf file
PHIS = in3->PHIS
fn4 =
"b30.042e.cam2.h3.TS.60E-150E_50S-50N.2000-01-01_cat_2009-12-31.nc" ;
define filename
in4 = addfile(fn4,"r") ; open netcdf file
TS = in4->TS
;************************************************
; define other arguments required by vinth2p
;************************************************
; type of interpolation: 1 = linear, 2 = log, 3 = loglog
interp = 2
; is extrapolation desired if data is outside the range of PS
extrap = True
; create an array of desired pressure levels:
pnew =
(/1000,950,900,850,800,750,700,650,600,550,500,450,400,350,300,250,200,1
50,100/)
;************************************************
; calculate T on pressure levels
;************************************************
; note, the 7th argument is not used, and so is set to 1.
;************************************************
; VARonP =
vinth2p(Z3(0:Ntime,:,:,:),hyam,hybm,pnew,PS(0:Ntime,:,:),interp,P0mb,1,e
xtrap)
VARonP =
vinth2p_ecmwf(Z3(0:Ntime,:,:,:),hyam,hybm,pnew,PS(0:Ntime,:,:),interp,P0
mb,1,extrap,-1,TS(0:Ntime,:,:),PHIS(0:Ntime,:,:))
;output in nc file
system("/bin/rm -f ./Z3_pressure.nc") ; remove any pre-existing
file
ncdf = addfile("./Z3_pressure.nc" ,"c") ; open output netCDF file
filedimdef(ncdf,"time",-1,True)
VARonP!0 = "time" ; assign named dimensions
VARonP!1 = "lev"
VARonP!2 = "lat"
VARonP!3 = "lon"
VARonP&time = in1&time(0:Ntime)
VARonP&lev = pnew
VARonP&lat = in1&lat
VARonP&lon = in1&lon
VARonP@long_name = "Geopotential Height on plevel" ; assign
name
VARonP@units = "m"
ncdf->Z3_pres = VARonP
print("finish convert Z3 to pressure level")
print("output .nc: ./Z3_pressure.nc")
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 2 02:27:59 2010
This archive was generated by hypermail 2.1.8 : Sun Feb 07 2010 - 15:37:25 MST