From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Wed Apr 20 2005 - 10:00:20 MDT

>The function zonal_mpsi_Wrap will calculate the zonal mean
>stream function of atmosphere.

>I found the global zonal mean is give a good results. But when
>I do the zonal mean only in the Pacific ocean, say, between
>120E and 280E, I found the result doesn't seem right. Does
>this mean the function only calculates the global zonal
>mean streamfunction?

Yes: Notice the definition in the documentation:

/ PS
|
2 pi a cos(lat) |
ZONAL_MPSI(lev,lat) = --------------- | V(lev,lat) dp
g |
|
/ p

the [ 2 pi a ] is the circumference of the earth.
My guess is the following will work:

Let v(lev,lat,lon) and ps(lat,lon) and using coordinate subscripting:

lonE = 120.
lonW = 280.
zmpsi = zonal_mpsi(v(:,:,{lonE:lonW}),lat,p,ps(:,{lonE:lonW}))

ratio = (lonW-lonE)/360.
zmpsi = ratio*zmpsi

use the zonal_mpsi_Wrap if meta data retension is desired

http://www.ncl.ucar.edu/Document/Functions/Contributed/zonal_mpsi_Wrap.shtml
zmpsi = zonal_mpsi_Wrap(v(:,:,{lonE:lonW}),lat,p,ps(:,{lonE:lonW}))