<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Dear Veronica</p>
    <p>thank you for your answer</p>
    <p>I understand your point but I still believe that the code is not
      working properly for my aims</p>
    <p>I try to explain myself with an example.</p>
    <p>According to the example in the tutorial: <br>
    </p>
    <p>the first command creates a weekly mask based on my data (daily
      precipitation in 2021):<br>
    </p>
    <p>t.rast.aggregate input=test2021 output=weekly_mask
      basename=mask_week granularity="1 week" method=count nprocs=10</p>
    <p>The second command add to the weekly value (7) the value of the
      consecutive days in the week period<br>
    </p>
    <p>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<br>
    </p>
    <p>In the attached file <br>
    </p>
    <p><a class="moz-txt-link-freetext" href="https://drive.google.com/file/d/1eusufL8JLysac0wLfWC6oub0IM79e-KO/view?usp=sharing">https://drive.google.com/file/d/1eusufL8JLysac0wLfWC6oub0IM79e-KO/view?usp=sharing</a><br>
    </p>
    <p>I show an extract of the the values of a given pixel in the study
      area. <br>
    </p>
    <p>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).<br>
    </p>
    <p>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.</p>
    <p>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.</p>
    <p>I hope I was able to explain myself</p>
    <p>Thank you again</p>
    <p>Ivan<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 18/08/22 15:36, Veronica Andreo
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAMki4G1AKRbf_cnuZX6Ht2nweWOW5p+5ONnhVY3DGfFd+hNMg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi Ivan, <br>
        </div>
        <div><br>
        </div>
        <div>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"</div>
        <div><br>
        </div>
        <div>HTH, <br>
        </div>
        <div>Vero<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">El jue, 18 ago 2022 a las
          14:42, Ivan Marchesini (<<a
            href="mailto:ivan.marchesini@gmail.com"
            moz-do-not-send="true" class="moz-txt-link-freetext">ivan.marchesini@gmail.com</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">Hi
          Markus<br>
          <br>
          thank you<br>
          <br>
          Yes I saw that algorithm but, if I'm not wrong, it does not
          fit with my <br>
          needs. The calculation made returns the number of days, in a
          given <br>
          interval (here week), that meets a certain condition. Not sure
          they are <br>
          consecutive. As an example: if negative temperature occur in
          monday and <br>
          thuesday and then in friday, saturday and sunday then the code
          count 5 <br>
          for that week. In my opinion what we need is 3.<br>
          <br>
          I hope I was enough clear<br>
          <br>
          In any case it would be good to find a solution for this type
          of problem <br>
          because these type of indexes are  used for climate data
          analysis (e.g.: <br>
          <a
            href="https://www.ecad.eu/download/millennium/millennium.php"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://www.ecad.eu/download/millennium/millennium.php</a>
          <br>
          <a href="https://www.climdex.org/learn/indices/"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://www.climdex.org/learn/indices/</a>
          )<br>
          <br>
          thank you<br>
          <br>
          Ivan<br>
          <br>
          <br>
          <br>
          On 17/08/22 20:04, Markus Neteler wrote:<br>
          > Hi Ivan,<br>
          ><br>
          > On Wed, Aug 17, 2022 at 9:07 AM Ivan Marchesini<br>
          > <<a href="mailto:ivan.marchesini@gmail.com"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">ivan.marchesini@gmail.com</a>>
          wrote:<br>
          >> Dear grass user<br>
          >><br>
          >> I have daily rainfall strds<br>
          >><br>
          >> I would like to obtain a layer of the largest number
          of consecutive days<br>
          >> where rainfall >1 mm<br>
          > May this script code help?<br>
          > <a
href="https://grasswiki.osgeo.org/wiki/Temporal_data_processing#How_to_count_consecutive_days_that_meet_a_certain_condition"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://grasswiki.osgeo.org/wiki/Temporal_data_processing#How_to_count_consecutive_days_that_meet_a_certain_condition</a>?<br>
          ><br>
          > Markus<br>
          ><br>
          >> Do you have any suggestions on how to calculate this
          climate index using<br>
          >> grass's time modules?<br>
          >><br>
          >> thank you very much<br>
          >><br>
          >> Ivan<br>
          _______________________________________________<br>
          grass-user mailing list<br>
          <a href="mailto:grass-user@lists.osgeo.org" target="_blank"
            moz-do-not-send="true" class="moz-txt-link-freetext">grass-user@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/grass-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>