[Thread Prev][Thread Next][Index]

Re: [ferret_users] count consecutive events



I see now. anyway, it is really easy after you follow me. Leave @loc function (the last line i wrote in my previous letter), then you only have to use some if-then cycles to get how many occurence are.

let s2=if conseq eq 2 then 1; let howmany2=s2[i=@sum] !and so on... so howmany2 will give you the number of events of 2 consecutive values.

or use the @evnt.


On Fri, Jun 20, 2008 at 3:21 PM, Brockmann Patrick <Patrick.Brockmann@xxxxxx> wrote:
Peter Szabo a écrit :
Hi Patrick,

try something like this in the beginning of your script (the leftover is not necessary):

let b = If a le 0.45 then 1
!i changed it intentionally. you will have missing values instead of 1 at the right points

let conseq=b[i=@cda:1] !with @cda you will have the data in a format like ,,5,4,3,2,1,,,, instead of ,,1,1,1,1,1,,,,

let whereis5=conseq[i=@loc:5]
!the @loc finds the start of the consecutive events. in this case 5.

Is this what you wanted?
Not at all.
I would like the result as follows

5 events of 1 consecutive values at 1
4 events of 2 consecutive values at 1
1 event  of 3 consecutive values at 1
3 events of 4 consecutive values at 1

Ok thank you anyway.
Good try.

Patrick

--
LSCE/IPSL, Laboratoire CEA-CNRS-UVSQ
Data Analysis and Visualization Engineer
IPSL Global Climate Modelling Group
--



[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement