Skip to content

Commit

Permalink
Merge pull request #38 from PNNL-PREMIS/top3
Browse files Browse the repository at this point in the history
Compute Js for top-three PAR hours for each day
  • Loading branch information
stephpenn1 authored Oct 5, 2020
2 parents 62304cd + ebfabfc commit 44e4fd8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions R/sapflow-Rs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ sapflow_js %>%
complete(Tree, Timestamp = seq(min(Timestamp), max(Timestamp), by = "hour")) %>%
log_obs("combined") -> combined
# For each tree and date, grab the three rows with maximum PAR, compute the mean Js
# for those rows, and then merge the result back into `combined`.
combined %>%
group_by(Tree, Date) %>%
slice_max(PAR, n = 3) %>%
summarise(Js_maxPAR = mean(Js_avg, na.rm = TRUE)) %>%
right_join(combined, by = c("Tree", "Date")) ->
combined
# At this point, `combined` holds rs, js, and weather data rounded to the nearest hour
# Here the data are joined and include any NAs or NaNs in any column
Expand Down

0 comments on commit 44e4fd8

Please sign in to comment.