Skip to content

Commit

Permalink
Fix import of lubridate::days
Browse files Browse the repository at this point in the history
  • Loading branch information
mrustl committed Jul 5, 2024
1 parent 3973111 commit b00dc7c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ importFrom(ggplot2,ylim)
importFrom(kwb.hydrus1d,defaults_atmosphere)
importFrom(kwb.hydrus1d,read_solute)
importFrom(lubridate,"%m+%")
importFrom(lubridate,ceiling_date)
importFrom(lubridate,days)
importFrom(lubridate,days_in_month)
importFrom(lubridate,month)
importFrom(lubridate,year)
Expand Down
19 changes: 8 additions & 11 deletions R/.virtual_storage.R
Original file line number Diff line number Diff line change
Expand Up @@ -363,22 +363,19 @@ p1 <- sol_travel_tot %>%
plotly::ggplotly(p1)


solute_files_noirrig <- fs::dir_ls(paths$exe_dir,
regexp = "1a2a_no-irrig_tracer.*_vs/solute\\d\\d?.out",
recurse = TRUE)
traveltimes_list <- setNames(lapply(scenarios, function(scenario) {


solute_files_irrig <- fs::dir_ls(paths$exe_dir,
regexp = "1a2a_tracer.*_vs/solute\\d\\d?.out",
recurse = TRUE)
solute_files <- fs::dir_ls(paths$exe_dir,
regexp = sprintf("1a2a_%s_tracer.*_vs/solute\\d\\d?.out",
scenario),
recurse = TRUE)

profile_files_2m <- fs::dir_ls(paths$exe_dir,
regexp = "1a2a_soil-2m_tracer.*/PROFILE.dat",
recurse = TRUE)


flextreat.hydrus1d::get_traveltimes(solute_files)
}), nm = names(scenarios))

traveltimes_noirrig <- flextreat.hydrus1d::get_traveltimes(solute_files_noirrig)
traveltimes_irrig <- flextreat.hydrus1d::get_traveltimes(solute_files_irrig)


htmlwidgets::saveWidget(flextreat.hydrus1d::plot_traveltimes(traveltimes_irrig,
Expand Down
6 changes: 3 additions & 3 deletions R/conservative_tracer-traveltime.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ interpolate_time <- function(
#'
#' @param ids vector with ids
#' @param date_start (default: "2017-05-01")
#' @return
#' @return last days of month
#' @keywords internal
#'
#' @importFrom lubridate %m+%
#' @importFrom lubridate %m+% days ceiling_date
get_last_day_of_months <- function(ids,
date_start = "2017-05-01") {
sapply(ids, function(id) {
start_date <- lubridate::ymd(date_start)
month_date <- start_date %m+% months(id - 1)
last_day <- lubridate::ceiling_date(month_date, "month") - days(1)
last_day <- lubridate::ceiling_date(month_date, "month") - lubridate::days(1)

return(last_day)
}) %>% as.Date()
Expand Down
3 changes: 3 additions & 0 deletions man/get_last_day_of_months.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b00dc7c

Please sign in to comment.