search for: _daily

Displaying 2 results from an estimated 2 matches for "_daily".

Did you mean: daily
2017 Sep 13
2
compounding precipitation based on whether falls within a day
...at the end of the small example below, there are two variables that I'm left with, prec_idx (an hourly sequence from beg_time to end_time) whose length is equal to the first index (the time index) of the 3D array of precipitation called prec. That is, I'd like to get a 3D array called prec*_daily* that has dimension prec*_daily*[21, 3, 4], where 21 is the number of days and the value in say prec*_daily*[1,x,y] is equal to prec[1,x,y] + prec[2,x,y] + ... + prec[24,x,y] ndays <- 21 base_time <- as.character('2001-12-31T23:00:00Z') hrs_since_base <- 1 # adding an extra seco...
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...