Skip to content

Commit

Permalink
Formatting changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsmit committed Oct 27, 2023
1 parent f6757d2 commit 63a9243
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/detect_event.R
Original file line number Diff line number Diff line change
Expand Up @@ -462,16 +462,16 @@ detect_event <- function(data,
data_temp$climatology$thresh <- -data_temp$climatology$thresh
}

if("lat" %in% colnames(data)){
if ("lat" %in% colnames(data)) {
data_temp$climatology$lat <- data$lat
}
if("latitude" %in% colnames(data)){
if ("latitude" %in% colnames(data)) {
data_temp$climatology$lat <- data$latitude
}

data_cat <- category(data_temp, ...)

if(is.data.frame(data_cat)){
if (is.data.frame(data_cat)) {
colnames(data_cat)[c(3,5)] <- c("date_peak", "intensity_max")
data_res <- base::merge(x = events, y = data_cat,
by = c("event_no", "duration", "intensity_max", "date_peak"))
Expand All @@ -489,7 +489,7 @@ detect_event <- function(data,
type_cols <- base::sapply(data_res$climatology, class)
date_cols <- colnames(data_res$climatology)[which(type_cols == "Date")]
data_cols <- colnames(data)[!colnames(data) %in% colnames(data_cat$climatology)]
other_cols <- colnames(data_res$climatology)[! colnames(data_res$climatology) %in% c(date_cols, data_cols)]
other_cols <- colnames(data_res$climatology)[!colnames(data_res$climatology) %in% c(date_cols, data_cols)]

data_res$climatology <- data_res$climatology[c(date_cols, data_cols, other_cols)]
data_res$climatology <- data_res$climatology[base::order(data_res$climatology$t),]
Expand Down

0 comments on commit 63a9243

Please sign in to comment.