[Thread Prev][Thread Next][Index]

Re: [ferret_users] Repetitive execution and Integral time scale calculation in Ferret



Hi Alejandro,
Ferret has functions and transformations to do auto-correlations, integrals, and summations.  I'll point out some of the tools; why don't you make a start at working out the commands and then ask again if you have questions.

yes? show function tauto_cor  ! and see the documentation on this function.

Also look at the transformations @SUM, and the integral transformations @IIN, @DIN. 

Ansley

On 5/3/2012 1:28 PM, Alejandro Ludert wrote:
Dear Ferret community:

I am trying to calculate the integral time scale of a cross correlation analysis to calculate the Effective Degrees Of Freedom of two time series. I am trying to follow the method proposed by Chen 1982 (Monthly Weather Review) in which the integral time scale is calculated as

tau = Sum(i = from -inf to inf) { Cxx(i dt) Cyy(i dt) dt}  where each Cxx and Cyy are the auto correlation of each time series at each lag time.

I have tried using the repeat command in the form

let n=22
let lag = 0
let tau = 0
let term = 0
let cseof = 0
let cobs = 0

repeat/range=1:22 (\
let p=-1*ts[d=1,i=1,j=1,k=1,l=1:22]; let q=-1*ts[d=1,i=1,j=1,k=1,l=1:22@shf:lag]; go variance; let cseof = correl; list/clobber/file=tau.dat cseof \
let p=u_son[d=2,k=1,l=1:22]; let q=u_son[d=2,k=1,l=1:22@shf:lag]; go variance; let cobs = correl; list/append/file=tau.dat  cobs\
let term = cseof * cobs; list/append/file=tau.dat term; let tau1 = tau + term; list/append/file=tau.dat  tau; lag = lag +1)

let nedof = n/tau

Which has not worked at all for me.

I have also tried to brute force my way through, because the summation in my case has only 20 terms using something like

let lag = 0
let tau = 0
let term = 0
let cseof = 0
let cobs = 0

step 0
let p=-1*ts[d=1,i=1,j=1,k=1,l=1:22]; let q=-1*ts[d=1,i=1,j=1,k=1,l=1:22]; go variance; let cseof = correl; list/clobber/file=tau.dat cseof 
let p=u_son[d=2,k=1,l=1:22]; let q=u_son[d=2,k=1,l=1:22]; go variance; let cobs = correl; list/append/file=tau.dat  cobs
let term = cseof * cobs; list/append/file=tau.dat term; let tau1 = tau + term; list/append/file=tau.dat  tau1

save/file=tau1.nc  tau1


!step 1 
let cseof = 0; let cobs = 0
let p=-1*ts[d=1,i=1,j=1,k=1,l=1:22]; let q=-1*ts[d=1,i=1,j=1,k=1,l=1:22@shf:1]; go variance; let cseof = correl; list/file=tau1.dat cseof
let p=u_son[d=2, k =1, l=1:22]; let q=u_son[d=2, k =1, l=1:22@shf:1]; go variance; let cobs = correl; list/append/file=tau1.dat cobs
let term = cseof * cobs; list/append/file=tau1.dat term; let tau2 = tau1[d=3] + term; list/append/file=tau1.dat tau2

and repeating this for each term in the sum. In this last case I have that for lag 0, the tau.dat file has values that are acceptable, all 1 at every grid point, but for the lag 1 step, even the multiplication of cseof * cobs that is listed when I do the list/append/file=tau1.dat term command does not seem to work correctly. 
Like the values of cseof and cobs are being discarded as soon as they are listed and do not make it to the third line of computations.

I would appreciate any help with any part of this questions. My gratitude in advance.

Ps: I attach the paper I am trying to follow, as well as my poorly written .jnl file and my data sets.

Alejandro Ludert.



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement