Dear Veronica
thank you for your answer
I understand your point but I still believe that the code is not working properly for my aims
I try to explain myself with an example.
According to the example in the tutorial:
the first command creates a weekly mask based on my data (daily precipitation in 2021):
t.rast.aggregate input=test2021 output=weekly_mask basename=mask_week granularity=“1 week” method=count nprocs=10
The second command add to the weekly value (7) the value of the consecutive days in the week period
t.rast.algebra base=test_rr_maggiore_1mm expression=“test_consecutive_days_rr_maggiore_1mm = weekly_mask {+,contains,l} if(test2021 < 1 && test2021[-1] < 1 || test2021[1] < 1 && test2021 < 1, 1, 0)” nprocs=10
In the attached file
https://drive.google.com/file/d/1eusufL8JLysac0wLfWC6oub0IM79e-KO/view?usp=sharing
I show an extract of the the values of a given pixel in the study area.
In the first week the value of the map "test_consecutive_days_rr_maggiore_1mm is 10 (7 + 3). 7 is the weekly base. 3 is the number of times in which a rainy day is preceded [-1] or followed [+1] by another rainy day. This happen in 2021-01-05, 2021-01-09, 2021-01-10 (in fact 3 days).
What is not fitting my needs here is the fact that between the 2021-01-05 and 2021-01-09 there are other days without rainfall. Actually we have not 3 consecutive days in this week!! We have 2 consecutive days: 2021-01-09, 2021-01-10 and another rainfall day at the start of the week.
I would like to have, in this first week, the value of 9 (7+2) not 10 (7+3), because I’m interested in the annual maximum length of wet spell, in days.
I hope I was able to explain myself
Thank you again
Ivan
···
On 18/08/22 15:36, Veronica Andreo wrote:
Hi Ivan,
It does indeed count consecutive days meeting a condition per week. That’s what the [-1] means in the t.rast.algebra command, i.e., it is the temporal neighbourhood modifier. If you then want to get the largest weekly consecutive days meeting the condition within a month you can aggregate the “weekly_consecutive” time series with t.rast.aggregate granularity=“1 month” method=“maximum”
HTH,
Vero
El jue, 18 ago 2022 a las 14:42, Ivan Marchesini (<ivan.marchesini@gmail.com>) escribió:
Hi Markus
thank you
Yes I saw that algorithm but, if I’m not wrong, it does not fit with my
needs. The calculation made returns the number of days, in a given
interval (here week), that meets a certain condition. Not sure they are
consecutive. As an example: if negative temperature occur in monday and
thuesday and then in friday, saturday and sunday then the code count 5
for that week. In my opinion what we need is 3.
I hope I was enough clear
In any case it would be good to find a solution for this type of problem
because these type of indexes are used for climate data analysis (e.g.:
https://www.ecad.eu/download/millennium/millennium.php
https://www.climdex.org/learn/indices/ )
thank you
Ivan
On 17/08/22 20:04, Markus Neteler wrote:
Hi Ivan,
On Wed, Aug 17, 2022 at 9:07 AM Ivan Marchesini
<ivan.marchesini@gmail.com> wrote:
Dear grass user
I have daily rainfall strds
I would like to obtain a layer of the largest number of consecutive days
where rainfall >1 mm
May this script code help?
https://grasswiki.osgeo.org/wiki/Temporal_data_processing#How_to_count_consecutive_days_that_meet_a_certain_condition?
Markus
Do you have any suggestions on how to calculate this climate index using
grass’s time modules?
thank you very much
Ivan
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user