[Thread Prev][Thread Next][Index]

[ferret_users] indefinite integral, axis, regrid and context

Hi Ferreters,

I've run into trouble with @iin indefinite integral but wasn't able to pin down the source of error. I wrote a script meant to give me a quick look at the Sverdrup streamfunction in the tropical Pacific from a given wind stress curl. My basic idea is to first mask out the wind stress curl outside the Pacific basin with zero, do the zonal indefinite integration westward, then mask out the resulting streamfunction in all basins except the Pacific. Here is the code using the publicly available wind data (Trenberth et al. 1990) and mask:

\can mode verify

can data/a
can region

! Load annual wind stress curl and basin mask files
use "http://iridl.ldeo.columbia.edu/SOURCES/.TRENBERTH/.Annual/dods"
use "http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA05/.Masks/.basin/dods"

! Mask out all basins but the Pacific
let curl_pac = if basin[d=2,gxy=curl[d=1]@nrst,k=1] eq 2 then curl[d=1]/1e8 else 0

! Calculate Rossby parameter \beta
let f = (2*7.29212e-5) * sin(y[gy=curl_pac]*(4*atan(1.)/180))
let beta = f[y=@ddc]

! Calculate Sverdrup streamfunction (in Sv)
let psi = (-1)*(curl_pac[x=0:360@din]-curl_pac[x=0:360@iin])/beta/1027/1e6

! Mask out all basin but the Pacific
let psi_pac = if basin[d=2,gxy=psi@nrst,k=1] eq 2 then psi

! Show me the result
sha/line/key/@t psi_pac

Things are still OK after psi is defined (try sha psi). However the masked variable psi_pac has become erroneous (try sha psi_pac). And the last command, with a specified context (@t), issues an error msg complaining inconsistent sizes. I found it tricky to figure out what goes wrong in such a script with indefinite integral, regridding between different axes (the x axis starts at 180E (-180) in curl[d=1] while 0.5E in basin[d=2]) and the interplay between indefinite integral and context. Does anyone has a clue please?

Thank you,

life grows, death doesn't.

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement