<div dir="ltr"><div dir="auto"><div><div dir="ltr">Hi Sajid,<div><br></div><div>The example uses a weekly mask because I was interested in consecutive freezing days per week. The idea, as explained to me by Thomas was to use this weekly mask (a strds with zero value all over the region) as a placeholder to add 1 only if the day after or before the current one also met the condition being evaluated. So, this resulting consecutive-days time series had 0, 2, 3, etc per pixel per week and that made sense to me for mosquitoes.</div><div dir="auto"><br></div><div dir="auto">For your problem, perhaps you could either create a zeroes strds with monthly granularity and using the same command you would get consecutive days of no rain per month, then add that into years and such... or create a daily zeroes strds and add one every time the condition is met, i.e., current day without rain and previous or posterior day without rain. But then again, you will need some granularity to count how many times you have 10+ days without rain. You could iterate the counts with increasing granularities, i.e., do the counting for granularities of 10, 15, 20 days and so on. But that seems a bit too much. Maybe, you can either try lower level functions in the temporal framework combined with pygrass and python or create your own function (?) and contribute it :)</div></div></div><div dir="auto"><br></div><div dir="auto">There was a question about consecutive days last year: <a href="https://lists.osgeo.org/pipermail/grass-user/2022-August/083037.html">https://lists.osgeo.org/pipermail/grass-user/2022-August/083037.html</a>. </div><div dir="auto"><br></div><div dir="auto">Perhaps others can share their insight and ideas</div><div dir="auto"><br></div><div>I wish I could be of more help!</div><div>Cheers,</div><div>Vero</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">El vie, 13 oct 2023 a las 6:37, Sajid Pareeth via grass-user (<<a href="mailto:grass-user@lists.osgeo.org" rel="noreferrer" target="_blank">grass-user@lists.osgeo.org</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear all<div><br></div><div>I have a temporal database of daily gridded rainfall for the last 40 years.</div><div><br></div><div>I want to find:</div><div>1. Number of times (count) the rainfall was 0 for 'atleast' <b>continuous </b>10 days in each year, in 5 years etc.</div><div>2. Max number of continuous (> 10days) dry days (rainfall=0) per year, per 5 years etc. In this I want to exclude continuous dry spells less than 10 days.</div><div><br></div><div>I am trying to use the `t.rast.algebra` following the example given <a href="https://grasswiki.osgeo.org/wiki/Temporal_data_processing#How_to_count_consecutive_days_that_meet_a_certain_condition.3F" rel="noreferrer" target="_blank">here</a>.</div><div><pre style="line-height:1.3;font-family:monospace,monospace;background-color:rgb(248,249,250);color:rgb(0,0,0);border:1px solid rgb(234,236,240);padding:1em;overflow-x:hidden;font-size:14px"><span style="color:rgb(64,128,128);font-style:italic"># Create weekly mask to which we will add 1 or 0 according to temperature in the days within it (each map in this week mask will have a value of 7)</span>
t.rast.aggregate <span style="color:rgb(25,23,124)">input</span><span style="color:rgb(102,102,102)">=</span>temperature_daily <span style="color:rgb(25,23,124)">output</span><span style="color:rgb(102,102,102)">=</span>weekly_mask <span style="color:rgb(25,23,124)">basename</span><span style="color:rgb(102,102,102)">=</span>mask_week <span style="color:rgb(25,23,124)">granularity</span><span style="color:rgb(102,102,102)">=</span><span style="color:rgb(186,33,33)">"1 weeks"</span> <span style="color:rgb(25,23,124)">method</span><span style="color:rgb(102,102,102)">=</span>count
<span style="color:rgb(64,128,128);font-style:italic"># Calculate consecutive days with negative temperatures</span>
t.rast.algebra <span style="color:rgb(25,23,124)">base</span><span style="color:rgb(102,102,102)">=</span>neg_temp_days <span style="color:rgb(25,23,124)">expression</span><span style="color:rgb(102,102,102)">=</span><span style="color:rgb(186,33,33)">"consecutive_days = weekly_mask {+,contains,l} if(temperature_daily < 0 && temperature_daily[-1] < 0 || temperature_daily[1] < 0 && temperature_daily < 0, 1, 0)"</span></pre></div><div><br></div><div>The example works, but the above code counts every consecutive day in a week even if there is a break in between.</div><div>I also didn't understand why the consecutive days are added to the total number of days (+7) in the week in 'mask_week' strds. </div><div><br></div><div>I tried modifying the aggregate expression, but could not make it work to my requirement as stated above.</div><div><br></div><div>Could anyone give a hint on how to go about this.</div><div><br></div><div>Many thanks in advance,</div><div><br></div><div>Best Regards</div><div><br></div><div>Sajid</div><div><br></div></div>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" rel="noreferrer" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</blockquote></div>
</div></div>
</div>