Displaying 2 results from an estimated 2 matches for "prec_daily".
2017 Sep 13
0
compounding precipitation based on whether falls within a day
...## There are 22 different days, not 21
date <- as.Date(prec_idx)
## Sum results by date at each i,j of the last 2 array dimensions
z <- lapply(unique(date),function(d)
apply(prec[date==d,,],2:3,sum)
)
## This gives a list with 22 3x4 matrices of sums.
## Convert to 3x4x22 array with
prec_daily <- array(unlist(z),dim=c(3,4,22))
## This is the **almost** part. You can use the aperm() function to reshape
the array if you like. I leave those pleasures to you.
HTH.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking thing...
2017 Sep 13
2
compounding precipitation based on whether falls within a day
Using the small reproducible example below, I'm wondering how best to
complete the following task:
In the small reproducible example below, the 3D array prec has indexes that
correspond to time, x, y (i.e., prec[time, x, y]). In this case, the time
index is hours since some predefined start time. I'd like to add up all
the time indexes in 'prec' based on whether or not the