Thanks for highlighting the variable. I also learn it.
Yonngzuo
________________________________
From: Claiborne Tompkins [tompkinc@my.fit.edu]
Sent: Tuesday, February 02, 2010 4:06 PM
To: Li, Yongzuo
Cc: ncl-talk@ucar.edu
Subject: Re: Cross Section setting "z" range (Claiborne Tompkins)
I altered your suggestion from earlier slightly, and was able to get the result I was looking for..
By establishing
if ( FirstTime ) then ; get height info for labels
;
; height
;
zmin = 0.
zmax = 4. ; top
nz = floattoint(zmax + 1) ; interval. has to go with this setting
end if
----------------------------------------
and then
; Find the index where 4km is - only need to do this once
if ( FirstTime ) then
zz = wrf_user_intrp3d(z,z,"v",plane,0.,opts)
b = ind(zz(:,0) .gt. zmax*1000. )
zmax_pos = b(0) - 1
if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then
zspan = b(0) - 1
else
zspan = b(0)
end if
delete(zz)
delete(b)
FirstTime = False
end if
-------------------------------------------
I later got the contour info by
contour_pv = wrf_contour(a,wks,pv_plane(0:zmax_pos,:),opts_pv)
---------------------------------------------------------
The highlighted red is the variation of the advice you gave me (Yongzuo) earlier. This plotted only the height from 0 -> 4km within the cross section.
Thanks for the help!
F. Tompkins
On Tue, Feb 2, 2010 at 4:16 PM, Li, Yongzuo <yongzuo.li<http://yongzuo.li>@ou.edu<http://ou.edu>> wrote:
Print the variable at one point to see if this variable contains
entire vertical data.
Yongzuo
________________________________
From: Claiborne Tompkins [tompkinc@my.fit.edu<mailto:tompkinc@my.fit.edu>]
Sent: Tuesday, February 02, 2010 12:14 PM
To: Li, Yongzuo
Cc: ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
Subject: Re: Cross Section setting "z" range (Claiborne Tompkins)
Thanks for the suggestion. Although the script runs with that adjustment, the script still plots PV through the entire vertical scale. WRF_HELP supplied me with the example script wrf_CrossSection4.ncl, which allows for the vertical range to be set, but has the cross section based on a center pivot point that extends the cross section through the entire x,y domain. For the plots I'm trying to generate, I need something along the lines of being able to create a cross section between 7N, 16W - 12N, 12W. Mix and matching the two is what is causing me trouble at the moment. The wrf_CrossSection4.ncl script...
http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/CROSS_SECTION/wrf_CrossSection4.htm
F. Tompkins
On Tue, Feb 2, 2010 at 12:51 PM, Li, Yongzuo <yongzuo.li<http://yongzuo.li/>@ou.edu<http://ou.edu/>> wrote:
Use z(:,:,0:4000)
Yongzuo
________________________________
From: Claiborne Tompkins [tompkinc@my.fit.edu<mailto:tompkinc@my.fit.edu>]
Sent: Tuesday, February 02, 2010 9:29 AM
To: Li, Yongzuo
Cc: ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
Subject: Re: Cross Section setting "z" range (Claiborne Tompkins)
That was my attempt of trying to set the range of "Z" from 0 -> 4,000 m.
F. Tompkins
On Tue, Feb 2, 2010 at 9:38 AM, Li, Yongzuo <yongzuo.li<http://yongzuo.li/>@ou.edu<http://ou.edu/>> wrote:
What is the meaning for
Z(0,4000)
Yongzuo
________________________________________
From: ncl-talk-bounces@ucar.edu<mailto:ncl-talk-bounces@ucar.edu> [ncl-talk-bounces@ucar.edu<mailto:ncl-talk-bounces@ucar.edu>] on behalf of ncl-talk-request@ucar.edu<mailto:ncl-talk-request@ucar.edu> [ncl-talk-request@ucar.edu<mailto:ncl-talk-request@ucar.edu>]
Sent: Tuesday, February 02, 2010 8:25 AM
To: ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
Subject: ncl-talk Digest, Vol 75, Issue 4
Send ncl-talk mailing list submissions to
ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
To subscribe or unsubscribe via the World Wide Web, visit
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
or, via email, send a message with subject or body 'help' to
ncl-talk-request@ucar.edu<mailto:ncl-talk-request@ucar.edu>
You can reach the person managing the list at
ncl-talk-owner@ucar.edu<mailto:ncl-talk-owner@ucar.edu>
When replying, please edit your Subject line so it is more specific
than "Re: Contents of ncl-talk digest..."
Today's Topics:
1. Cross Section setting "z" range (Claiborne Tompkins)
2. CCSM conversion of Geoptential Height (Vijayaraghavan Srivatsan)
3. Re: CCSM conversion of Geoptential Height (Dennis Shea)
----------------------------------------------------------------------
Message: 1
Date: Tue, 2 Feb 2010 01:49:46 -0500
From: Claiborne Tompkins <tompkinc@my.fit.edu<mailto:tompkinc@my.fit.edu>>
Subject: Cross Section setting "z" range
To: ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
Message-ID:
<e5e8b7c61002012249j241a541fyf26588133411fb5@mail.gmail.com<mailto:e5e8b7c61002012249j241a541fyf26588133411fb5@mail.gmail.com>>
Content-Type: text/plain; charset="iso-8859-1"
I've been making cross sections and wanted to put a limit on "z" instead of
plotting up to the vertical max within my WRF output, but have been
unsuccessful when trying to set a range for z. Right now I read "z" in
through
z = wrf_user_getvar(a, "z",it) ; grid point height
and tried to set a range when creating my pv_plane
pv_plane = wrf_user_intrp3d(pvo,z(0,4000),"v",plane,0,opts)
but keep receiving the error
fatal:Number of subscripts do not match number of dimensions of variable,(2)
Subscripts used, (3) Subscripts expected
fatal:Execute: Error occurred at or near line 110 in file PotVort_CrossS.ncl
Does anyone know the proper format for declaring the range of "z"?
Thanks,
F. Tompkins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100202/afe8dcfa/attachment.html
------------------------------
Message: 2
Date: Tue, 2 Feb 2010 17:27:53 +0800
From: "Vijayaraghavan Srivatsan" <tmsvs@nus.edu.sg<mailto:tmsvs@nus.edu.sg>>
Subject: CCSM conversion of Geoptential Height
To: <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Message-ID:
<82D169AB2230FA459E2832C4BD0C7A590AFCFBD0@MBX03.stf.nus.edu.sg<mailto:82D169AB2230FA459E2832C4BD0C7A590AFCFBD0@MBX03.stf.nus.edu.sg>>
Content-Type: text/plain; charset="us-ascii"
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<http://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<http://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<http://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<http://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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100202/3c0f75ff/attachment.html
------------------------------
Message: 3
Date: Tue, 02 Feb 2010 07:25:24 -0700
From: Dennis Shea <shea@ucar.edu<mailto:shea@ucar.edu>>
Subject: Re: CCSM conversion of Geoptential Height
To: Vijayaraghavan Srivatsan <tmsvs@nus.edu.sg<mailto:tmsvs@nus.edu.sg>>
Cc: ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
Message-ID: <4B6835D4.8030607@ucar.edu<mailto:4B6835D4.8030607@ucar.edu>>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
You do not indicate what the
"problem with conversion of geopotential heights"
actually is.
*Extrapolation is always dangerous.*
EG: over the Himalaya the function uses the sfc T
and assumes a constant lapse rate. The (say) 1000hPa
hgt is based on the assumed lapse rate and the
hydrostatic equation. Sometimes this yields non realistic values.
See Example 3 at
http://www.ncl.ucar.edu/Applications/grid_fill.shtml
This does not use geopotential heights but I might suggest
using vinh2p or vinth2p_ecmwf *without* extrapolation.
Then use poisson_grid_fill to file out the levels.
Good luck
Vijayaraghavan Srivatsan wrote:
> 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<http://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<http://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<http://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<http://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,150,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,extrap)
>
>
>
> VARonP =
> vinth2p_ecmwf(Z3(0:Ntime,:,:,:),hyam,hybm,pnew,PS(0:Ntime,:,:),interp,P0mb,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
------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
End of ncl-talk Digest, Vol 75, Issue 4
***************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 2 15:28:08 2010
This archive was generated by hypermail 2.1.8 : Sun Feb 07 2010 - 15:37:25 MST