Identifying and Determining the Average Rainfall Intensity of Precipitation Events and Associated Increases in Streamflow Part 2

This is a follow-up to my previous post Identifying and Determining the Average Rainfall Intensity of Precipitation Events and Associated Increases in Streamflow Part 1 - General - Posit Community.

From the previous post, I created a new tibble table with 227,455 observations, the first 100 of which are shown below.

observation Date       Time     Precipitation Discharge in_dry_spell rain_event
          <int> <chr>      <chr>            <dbl>     <dbl> <lgl>             <dbl>
  1           1 2010-05-01 0:00:00            0       0.299 TRUE                 NA
  2           2 2010-05-01 0:15:00            0       0.302 TRUE                 NA
  3           3 2010-05-01 0:30:00            0       0.305 TRUE                 NA
  4           4 2010-05-01 0:45:00            0.2     0.308 FALSE                 1
  5           5 2010-05-01 1:00:00            0.2     0.312 FALSE                 1
  6           6 2010-05-01 1:15:00            0       0.317 FALSE                 1
  7           7 2010-05-01 1:30:00            0       0.321 FALSE                 1
  8           8 2010-05-01 1:45:00            0.2     0.326 FALSE                 1
  9           9 2010-05-01 2:00:00            0.4     0.33  FALSE                 1
 10          10 2010-05-01 2:15:00            0       0.339 FALSE                 1
 11          11 2010-05-01 2:30:00            0       0.352 FALSE                 1
 12          12 2010-05-01 2:45:00            0.2     0.38  FALSE                 1
 13          13 2010-05-01 3:00:00            0       0.41  FALSE                 1
 14          14 2010-05-01 3:15:00            0       0.428 FALSE                 1
 15          15 2010-05-01 3:30:00            0       0.424 FALSE                 1
 16          16 2010-05-01 3:45:00            0       0.419 FALSE                 1
 17          17 2010-05-01 4:00:00            0.2     0.415 FALSE                 1
 18          18 2010-05-01 4:15:00            0       0.41  FALSE                 1
 19          19 2010-05-01 4:30:00            0       0.411 FALSE                 1
 20          20 2010-05-01 4:45:00            0.6     0.412 FALSE                 1
 21          21 2010-05-01 5:00:00            0.4     0.414 FALSE                 1
 22          22 2010-05-01 5:15:00            0.2     0.415 FALSE                 1
 23          23 2010-05-01 5:30:00            0       0.416 FALSE                 1
 24          24 2010-05-01 5:45:00            0       0.44  FALSE                 1
 25          25 2010-05-01 6:00:00            0       0.459 FALSE                 1
 26          26 2010-05-01 6:15:00            0       0.465 FALSE                 1
 27          27 2010-05-01 6:30:00            0       0.495 FALSE                 1
 28          28 2010-05-01 6:45:00            0       0.495 FALSE                 1
 29          29 2010-05-01 7:00:00            0       0.495 FALSE                 1
 30          30 2010-05-01 7:15:00            0       0.495 FALSE                 1
 31          31 2010-05-01 7:30:00            0.2     0.495 FALSE                 1
 32          32 2010-05-01 7:45:00            0       0.495 TRUE                 NA
 33          33 2010-05-01 8:00:00            0       0.471 TRUE                 NA
 34          34 2010-05-01 8:15:00            0       0.453 TRUE                 NA
 35          35 2010-05-01 8:30:00            0       0.44  TRUE                 NA
 36          36 2010-05-01 8:45:00            0       0.431 TRUE                 NA
 37          37 2010-05-01 9:00:00            0       0.422 TRUE                 NA
 38          38 2010-05-01 9:15:00            0       0.423 TRUE                 NA
 39          39 2010-05-01 9:30:00            0       0.423 TRUE                 NA
 40          40 2010-05-01 9:45:00            0       0.424 TRUE                 NA
 41          41 2010-05-01 10:00:00           0       0.424 TRUE                 NA
 42          42 2010-05-01 10:15:00           0       0.425 TRUE                 NA
 43          43 2010-05-01 10:30:00           0       0.425 TRUE                 NA
 44          44 2010-05-01 10:45:00           0       0.426 TRUE                 NA
 45          45 2010-05-01 11:00:00           0       0.427 TRUE                 NA
 46          46 2010-05-01 11:15:00           0       0.427 TRUE                 NA
 47          47 2010-05-01 11:30:00           0       0.428 TRUE                 NA
 48          48 2010-05-01 11:45:00           0       0.428 TRUE                 NA
 49          49 2010-05-01 12:00:00           0       0.429 TRUE                 NA
 50          50 2010-05-01 12:15:00           0       0.429 TRUE                 NA
 51          51 2010-05-01 12:30:00           0       0.43  TRUE                 NA
 52          52 2010-05-01 12:45:00           0       0.43  TRUE                 NA
 53          53 2010-05-01 13:00:00           0       0.431 TRUE                 NA
 54          54 2010-05-01 13:15:00           0       0.431 TRUE                 NA
 55          55 2010-05-01 13:30:00           0       0.432 TRUE                 NA
 56          56 2010-05-01 13:45:00           0       0.432 TRUE                 NA
 57          57 2010-05-01 14:00:00           0       0.433 TRUE                 NA
 58          58 2010-05-01 14:15:00           0       0.433 TRUE                 NA
 59          59 2010-05-01 14:30:00           0       0.434 TRUE                 NA
 60          60 2010-05-01 14:45:00           0       0.434 TRUE                 NA
 61          61 2010-05-01 15:00:00           0       0.435 TRUE                 NA
 62          62 2010-05-01 15:15:00           0       0.441 TRUE                 NA
 63          63 2010-05-01 15:30:00           0       0.471 TRUE                 NA
 64          64 2010-05-01 15:45:00           0       0.527 TRUE                 NA
 65          65 2010-05-01 16:00:00           0       0.565 TRUE                 NA
 66          66 2010-05-01 16:15:00           0       0.562 TRUE                 NA
 67          67 2010-05-01 16:30:00           0       0.559 TRUE                 NA
 68          68 2010-05-01 16:45:00           0       0.556 TRUE                 NA
 69          69 2010-05-01 17:00:00           0       0.552 TRUE                 NA
 70          70 2010-05-01 17:15:00           0       0.665 TRUE                 NA
 71          71 2010-05-01 17:30:00           0       0.892 TRUE                 NA
 72          72 2010-05-01 17:45:00           0       0.941 TRUE                 NA
 73          73 2010-05-01 18:00:00           0       0.937 TRUE                 NA
 74          74 2010-05-01 18:15:00           0       0.933 TRUE                 NA
 75          75 2010-05-01 18:30:00           0       0.928 TRUE                 NA
 76          76 2010-05-01 18:45:00           0       0.924 TRUE                 NA
 77          77 2010-05-01 19:00:00           0       0.843 TRUE                 NA
 78          78 2010-05-01 19:15:00           0       0.812 TRUE                 NA
 79          79 2010-05-01 19:30:00           0       0.765 TRUE                 NA
 80          80 2010-05-01 19:45:00           0       0.729 TRUE                 NA
 81          81 2010-05-01 20:00:00           0       0.693 TRUE                 NA
 82          82 2010-05-01 20:15:00           0       0.672 TRUE                 NA
 83          83 2010-05-01 20:30:00           0       0.644 TRUE                 NA
 84          84 2010-05-01 20:45:00           0       0.617 TRUE                 NA
 85          85 2010-05-01 21:00:00           0       0.611 TRUE                 NA
 86          86 2010-05-01 21:15:00           0       0.591 TRUE                 NA
 87          87 2010-05-01 21:30:00           0       0.578 TRUE                 NA
 88          88 2010-05-01 21:45:00           0       0.569 TRUE                 NA
 89          89 2010-05-01 22:00:00           0       0.559 TRUE                 NA
 90          90 2010-05-01 22:15:00           0       0.55  TRUE                 NA
 91          91 2010-05-01 22:30:00           0       0.54  TRUE                 NA
 92          92 2010-05-01 22:45:00           0       0.538 TRUE                 NA
 93          93 2010-05-01 23:00:00           0       0.536 TRUE                 NA
 94          94 2010-05-01 23:15:00           0       0.534 TRUE                 NA
 95          95 2010-05-01 23:30:00           0       0.532 TRUE                 NA
 96          96 2010-05-01 23:45:00           0       0.53  TRUE                 NA
 97          97 2010-05-02 0:00:00            0       0.528 TRUE                 NA
 98          98 2010-05-02 0:15:00            0       0.526 TRUE                 NA
 99          99 2010-05-02 0:30:00            3       0.524 FALSE                 2
100         100 2010-05-02 0:45:00            0       0.521 TRUE                 NA```

In the table above, I have precipitation and discharge data in 15-minute intervals from 2010 until 2022. I used the precipitation data to identify individual rainfall events using a 4-hour intermittent dry period (i.e., any precipitation that fell within 4 hours of a previous event was considered the same event and any precipitation that fell with more than 4 hours since the previous event was considered a unique event. Using this criteria, I created a new column in the table called "rain_event" which numbered each unique event chronologically.

For each rainfall event, I now want to pull out the start date and time, end date and time, the total precipitation that had accumulated between the start date and time and the end date and time, the maximum discharge and the minimum discharge between the start date and time and the end date and time. I then want to put this data in a new table with the format

Rain_Event, StartDateTime, EndDateTime, TotalPrecipitation, MinimumDischarge, MaximumDischarge

Does anyone have any suggestions as to how to achieve this?

TIA

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.