Hello,
To understand how much heat stress corals are exposed to, we calculate what is known as a "degree-heating week:" this is the amount of time a temperature is above a known threshold (typically the mean monthly maximum or the bleaching threshold). Basically, I need to integrate the amount of time that the temperature has surpassed 31C in my dataset (attached). Temperature was measured four times/day. I can have a simple script in which every 6-hr period in which temperature is above 31C is recoded as 0.25, with <31C = 0. I could then have a trailing sum in another column and then divide by seven to convert to weeks. Basically, the DHW is only considered over the highest 3-month period over the year (typically the summer), and we know that DHW of 4 to 8 in a 3-month window results in coral bleaching.
This is basically giving me what I want because, since I told it to evaluate the formula when the trailing mean was over 30C, it won't keep trying to calculate it in the winter. What I want to know is whether you can enter an argument to where each year in a multi-year dataset is analyzed individually (e.g. "by year")? I guess you could simply recreate this formula for each year (2013-2020 in this case), then subset by year, but I did want to know if you could actually do any sort of "formula reset by year" or anything like that within a single column. What I really want to do is have the formula reset to 0 after a certain period has transpired during which no additional 31C temperatures are logged, but I actually think this isn't possible!
https://coralreefwatch.noaa.gov/satellite/methodology/methodology.php#dhw
Anderson B. Mayfield