[Thread Prev][Thread Next][Index]

integrals on depth from sigma coordinates



I have model output on a sigma vertical coordinate.
I want to find the vertical integral of one of these
quantities (v) as a function of z, not sigma. The
thickness (h) of the sigma layers is a function of 
(x,y,t).

For z values within layer 1, the integral is just v1*z.

Within layer 2 the integral is: v1*h1 + v2*(z-h1).

Within layer 3 it is: v1*h1 + v2*h2 + v3*(z-(h1+h2)).

And so on. I have a reasonably small number of layers
(9), so it is feasible to write 9 statements. However,
I can't figure out how to do this:

define axis/z=0:400:10/depth zdep       ! depth axis in 10m intervals
let zz = z[gz=zdep]			! values of z-axis

let htot = h[z=@rsum]			! depth of sigma interfaces

! build up the integral layer by layer
let vonz1 = if zz le htot[k=1] then v[k=1]*zz else 0	    ! layer 1
let vonz2 = if zz gt htot[k=1] and zz le htot[k=2] then 
            v[k=1]*h[k=1] + v[k=2]*(zz-h[k=1]) else vonz1   ! layer 2
let vonz3 = if zz gt htot[k=2] and zz le htot[k=3] then 
            v[k=1]*h[k=1] + v[k=2]*h[k=2] + 
            v[k=3]*(zz-htot[k=2]) else vonz2	            ! layer 3
 ... etc ....

This does not work. The first definition produces correct
results, but all the rest are blank. It seems conceptually
simple but I'm not getting anywhere. Any ideas appreciated.

Thanks ..... Billy K


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement