Skip to content

Commit

Permalink
fix 366 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
emmamendelsohn committed Nov 6, 2023
1 parent 80aa37d commit 8a33183
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 89 deletions.
9 changes: 7 additions & 2 deletions R/calculate_forecasts_anomalies.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ calculate_forecasts_anomalies <- function(ecmwf_forecasts_transformed,
lead_dates <- seq(lead_start_date, lead_end_date, by = "day")
lead_doys <- yday(lead_dates)
if(366 %in% lead_doys) {
lead_doys <- lead_doys[lead_doys!=366]
lead_doys <- c(lead_doys, tail(lead_doys, 1) + 1)
if(tail(lead_doys, 1) == 366){
lead_doys <- lead_doys[lead_doys!=366]
lead_doys <- c(lead_doys, 1)
}else{
lead_doys <- lead_doys[lead_doys!=366]
lead_doys <- c(lead_doys, tail(lead_doys, 1) + 1)
}
}

doy_start <- head(lead_doys, 1)
Expand Down
Loading

0 comments on commit 8a33183

Please sign in to comment.