I have a precipitation data"daily" and I formed the following index DRI from the data

\(

\begin{tabular}{|l|cr|}

\hline

Daily Rainfall(mm) & DRI \\

\hline

0-4.9 & 0 \\

5-9.9 & 1 \\

10-14.9 & 2 \\

so the general formula is

5n-5n+4.9 & n\\

\hline

\end{tabular}

\)

I have the following code:

Now I have the daily dates for the precipitation and I want to specify the dates with precipitation >= 10 and

\( \sum_{d = 1}^30 {N_d * DRI^2_d} \)

then sum over 30 or 31 days for N*DRI^2 where N is the day with pcp>=10 (i.e get the monthly index)

for example I have days 1,2,3,4,5,6,7,8,9,10 and so on up to 30 and the days with precipitation >=10 is days 1 with value 10 mm, day 4 with value 15 mm so I want to multiply 1 by the corresponding index which is DRI^2 =4 and day 4 multiplied by 9 and so one and sum over those days

my questions are:

1) how to select the days with precipitation >=10

2) how to form such sum

Thanks in advance

\(

\begin{tabular}{|l|cr|}

\hline

Daily Rainfall(mm) & DRI \\

\hline

0-4.9 & 0 \\

5-9.9 & 1 \\

10-14.9 & 2 \\

so the general formula is

5n-5n+4.9 & n\\

\hline

\end{tabular}

\)

I have the following code:

Code:

```
PCP <- c(0, 4.9, 5, 9.9, 10, 14.9, 15)
seq2max <- seq(0,max(PCP)+70,5)
result <- data.frame(min=seq2max,max=seq2max+4.9,DRI=seq_along(seq2max)-1)
result$DRI
result$DRI^2
```

\( \sum_{d = 1}^30 {N_d * DRI^2_d} \)

then sum over 30 or 31 days for N*DRI^2 where N is the day with pcp>=10 (i.e get the monthly index)

for example I have days 1,2,3,4,5,6,7,8,9,10 and so on up to 30 and the days with precipitation >=10 is days 1 with value 10 mm, day 4 with value 15 mm so I want to multiply 1 by the corresponding index which is DRI^2 =4 and day 4 multiplied by 9 and so one and sum over those days

my questions are:

1) how to select the days with precipitation >=10

2) how to form such sum

Thanks in advance

Last edited: