[Thread Prev][Thread Next][Index]

Re: How can I calculate stream function from the ocean currents(u&v)



! Ferret streamfunction script
! pass arguments:
! arg1 = x0 (must be on a gridpoint or set mode interp)
! arg2 = y0 (likewise)
! arg3 = variable name for u
! arg4 = variable name for v

! Psi = Int{y0:y}u dy - Int{x_0:x}v(x,y_0) dx
! u=d(Psi)/dy, v=-d(Psi)/dx

! (x0,y0) (also (x1,y1) in case chosen (x0,y0) is not first gridpoint)
def sym y1 `y[g=$3,j=1]`        ! furthest south gridpoint
def sym y0 `$2`
def sym x1 `x[g=$3,i=1]`        ! furthest west gridpoint
def sym x0 `$1`

! @iin can't have blanks: make 'em zeroes.
let ub=if $3 then $3 else 0
let vb=if $4 then $4 else 0

! second term (Int v*dx)
let t2a = vb[y=($y0),x=@iin]
let t2b = if `($x0)-($x1)` ne 0 then vb[y=($y0),x=($x1):($x0)@din] else 0
let t2 = t2a - t2b

! first term (Int u*dy)
let t1a = ub[y=@iin]
let t1b = if `($y0)-($y1)` ne 0 then ub[y=($y1):($y0)@din] else 0
let t1 = t1a - t1b

! streamfunction
let strmfnxy = t1-t2

! recover u and v for checking
! should be the same as originals except for wider derivatives (@ddc).
let usf = strmfnxy[y=@ddc]
let vsf = strmfnxy[x=@ddc]*(-1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
William S. Kessler

E-mail: kessler@pmel.noaa.gov (will be forwarded)

Mailing address through mid-May 2002:
CSIRO Marine Research    or   CSIRO Marine Research Laboratories
GPO Box 1538                  1 Castray Esplanade
Hobart TAS 7001               Hobart TAS 7000
Australia                     Australia

Tel: 61-3-6232-5069    Fax: 61-3-6232-5123
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Permanent address:
NOAA / Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle Wa 98115 USA
Tel: 206-526-6221      Fax: 206-526-6744

Home page: http://www.pmel.noaa.gov/~kessler





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement