Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute Js for top-three PAR hours for each day #38

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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