Skip to content

Commit

Permalink
Update seasonal_rain.R
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyclements authored Dec 10, 2024
1 parent 566d1e3 commit bd5d46a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions R/seasonal_rain.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ seasonal_rain <- function (summary_data = NULL, start_date = NULL, end_date = NU
}

if(!is.null(s_start_doy)){ # any(grepl("-", summary_data[[year]]))){
data <- shift_dates(data = data, date = "date", s_start_doy = s_start_doy - 1)
year <- "year"
doy <- "doy"
data[[year]] <- data[["s_year"]]
# The shifting has already happened in R-Instat
#data <- shift_dates(data = data, date = date_time, s_start_doy = s_start_doy - 1)
year <- "s_year"
doy <- "s_doy"
data[[doy]] <- data[["s_doy"]]
data[[year]] <- data[["s_year"]]
}
data[[year]] <- factor(data[[year]])
summary_data <- dplyr::full_join(data %>% dplyr::select(c({{ station }}, {{ year }}, {{ date_time }},
Expand Down Expand Up @@ -179,4 +180,4 @@ seasonal_rain <- function (summary_data = NULL, start_date = NULL, end_date = NU
if (total_rain) climatic_output <- climatic_output %>% dplyr::rename(seasonal_rain = total_rain)
if (n_rain) climatic_output <- climatic_output %>% dplyr::rename(n_seasonal_rain = n_rain)
return(climatic_output)
}
}

0 comments on commit bd5d46a

Please sign in to comment.