I calculated the Nino3.4 area averaged SST anomaly (variable name = nino34 and l=1:372). I want to know which are the El Nino and La Nina years, (Condition is define El Nino and La Nina episodes as exceeding the threshold of ±0.5°C for a minimum of five consecutive overlapping seasons).
Since I don't know the details of your problem, I just outline one strategy. It seems that you can achieve your goal by
- creating a mask, which is 1 when the "event" occurs and 0 when not: LET mask = IF <condition> then 1 else 0.
- summing the mask over the period: if the sum is equal to the number of the time steps within the period, then you have consecutive events.
For the sum, the boxcar smoother (@SBX) over L may be convenient:
Although it's called a "smoother", it just takes a simple average over an interval, so that you can use this relation to infer the sum