I am having trouble writing a code for a condition that within every 20 consecutive days, find if a value greater than a defined threshold occurs at least 10 times. For example, I have a matrix called test_matrix (57x365; where each row represents a year and each column is a day). So for each of the 57 years, I want to find the values greater than a threshold (say value >5), and check whether they occur 10 or more times in every consecutive 20 days.
If the criteria is met, I'd like to know all the first days of the 20 day window (i.e., it may occur 3 times in a year, so I'd like to know those three days).
A bit hard to explain, so I am happy to clarify the question. Thanks!