Open hzambran opened 8 years ago
It will be nice to have a flexible season . In my case it will be October to September the following year. The best would be to start time and number of months to sum.
hi, I think is better to allow to the user to define the season, and change the month-approach by a day-approach. I mean, I would like to define the season based on a specific date, for instante the start of spring is in 21-march. So, what if you get the day of the year and then do the classification of the dates?
In a very customized approach I use the following code, that requires lubridate:
date2season <- function(x) {
day_of_year <- lubridate::yday(x)
winter <- which(day_of_year %in% c(1:80,356:366))
spring <- which(day_of_year %in% 81:172)
summer <- which(day_of_year %in% 173:264)
autumm <- which(day_of_year %in% 265:355)
seasons <- rep(NA, length(x))
seasons[winter] <- "winter"
seasons[spring] <- "spring"
seasons[summer] <- "summer"
seasons[autumm] <- "autumm"
return(seasons)
}
Original question from 'Bernard Okoński UP ':
I think it would be great that the values for the argument season should be maximum flexible that everyone can chose any month sequence or a period that suits ones research end geographic region e.g. hydrologic year in Atlantic Europe starts November 1st of one year and October 30th of the next, in the US October 1st of one year and September 30th of the next, Vegetation period (mean temp. above 5C) is roughly from the beginning of April to the end of October.
The problem will be with months starting with the same letter with
JFMAMJJASOND
but the same issue was solved intreeclim
package by Christian Zang. There isdcc
function with that functionality for calculating correlation/multiple correlation with arguments:selection=.range(-4:-9)+.range(4:9)
indicating the season April to September previous year and April to September the next year as an explanatory data for calculation of linear correlation