Is there a way to detect when a gridpoint meets a condition and set the time index as the value inplace? #6117
-
I have data set with daily sea ice concentration values, I am trying to return one time slice with the same length of lat and lon points which meet the conditions. The condition being: if a cell is =< 15% for three consecutive days, the cell value should be the time index. I have managed to write something, but have only gotten it to return the results in the form of a list.
I would like to deal with this analysis using xarray. I have tried using the rolling window and running a condition on the binary output, but still haven't managed to get just one slice as the output. Is there a 'quicker' way to do this with xarray? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Those isn't a full answer, but have you tried evaluating the condition at every point, then using a rolling count with a window of 3 to assess where it exists for 3 consecutive points? |
Beta Was this translation helpful? Give feedback.
-
The xclim package may implement some algorithms relevant for your query (you may have to look in the source code for functions related to "at least n consecutive days"). |
Beta Was this translation helpful? Give feedback.
Those isn't a full answer, but have you tried evaluating the condition at every point, then using a rolling count with a window of 3 to assess where it exists for 3 consecutive points?