[Thread Prev][Thread Next][Index]

Re: Can we change vertical height from millibar to Km. in ferret



Hi Yogesh,
	You can convert between height in kilometers and pressure in mbar
using the "standard atmosphere", for which calculators and definitions are
available on the web (do a google search on standard atmosphere.)  For
example www.digitaldutch.com/atmoscalc/ or aero.stanford.edu/StdAtm.html .
>From the StdAtm.html site using "View / Page Source" you can acquire
the algorithms in Javascript.

I'll do a demo for HEIGHTS < 11,000m (Pressures > 220mbar approx)
*****************************************************************
	The standard atmosphere (as you probably know) is a series of
layers of linearly changing or constant temperature, from which the gas
law (P = rho*R*T) and the hydrostatic law (dP/dh = -rho*g) allow the
P vs h relationship to be derived. In the TROPOSPHERE (0 - 11,000m) the
temperature decreases linearly at 6.5 K/km and the P vs h relationship is

	P = 1013.25 * (1 - h/44.330)^5.255876

for P in mbar (hPa) and h in km.
Inverting this gives the relationship you want

	h = 44.330 * [1 - (P/1013.25)^0.1902632]

The simplest way to do plots is with plot/vs as in parts 1 and 2 of
the demo below.  It is possible using "def axis/from_data" to regrid
pressure <=> height as shown in part 3 of the demo.

!--------------------------------------------------------------
! PART 1: DATASET WITH A Z-AXIS CONSISTING OF PRESSURES IN MBAR
def axis/depth/z=250:1000:50/units=mbar zmb ; def grid/z=zmb gmb
let/title="Demo Variable" myvar = (z[g=gmb]/1000)^2
! compute "axis" values in kilometers
let/title="Height (km)" hkm = 44.330*(1 - (z[g=gmb]/1013.25)^0.1902632)
set view upper
plot/set myvar ; ppl xaxis,0,1,0.1 ; ppl plot
set view lower
plot/set/vs/line=1 myvar,hkm
ppl xaxis,0,1,0.1 ; ppl yaxis,0,11,1 ; ppl yfor,(i2) ; ppl plot
!------------------------------------------------------------------
message
!------------------------------------------------------------------
! PART 2: DATASET WITH A Z-AXIS CONSISTING OF HEIGHTS IN KILOMETERS
def axis/z=0:11:1/units=km zkm ; def grid/z=zkm gkm
let/title="Demo Variable" myvar = z[g=gkm]^2
let/title="Pressure (mbar)" pmb = 1013.25*(1-z[g=gkm]/44.330)^5.255876
set view upper
plot/set myvar ; ppl xaxis,0,120,10 ; ppl plot
set view lower
plot/set/vs/line=1 myvar,pmb
ppl yaxis,1013.25,220,-100 ; ppl yfor,(i4) ; ppl plot
!---------------------------------------------------------------
message
!---------------------------------------------------------------
! PART 3: THE 2nd DEMO BUT USING A REGRID RATHER THAN PLOT/VS
! This is a bit tricky because axes must be monotonic increasing.
! Start with (-1) * MillibarPressures ...
def axis/z/name=zax/units=mbar/from_data (-1)*pmb ; def grid/z=zax grd
set view lower
plot/set myvar[g=grd,gz=@asn]
! ... then use negative argument in "ppl axlsze" to remove minuses
ppl yaxis,-1013.25,-220,100 ; ppl axlsze,,-0.1 ; ppl plot
!---------------------------------------------------------------

Hope this helps. Perhaps ferret users in the atmospheric sciences
may have a better way (not limited to the troposphere). It would
be easy to extend the above to the top of the stratosphere (20km)
using for example
	let pmb = if (h le 11) then htropo else hstrato
where htropo is the P vs h relationship given above for h < 11km
and hstrato is the corresponding relationship for 11 < h < 20km.

Mick (mick.spillane@noaa.gov)



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement