#' @param limit Maximum number of indices to return
#' @param same_season Should the indices correspond to day in same season?
#' @param days_in Optional set to intersect with results (NULL to discard)
#' @param limit Maximum number of indices to return
#' @param same_season Should the indices correspond to day in same season?
#' @param days_in Optional set to intersect with results (NULL to discard)
#'
#' @export
getSimilarDaysIndices = function(index, data, limit, same_season,
#'
#' @export
getSimilarDaysIndices = function(index, data, limit, same_season,
j = index + 1
while (length(days) < min( limit, ifelse(is.null(days_in),Inf,length(days_in)) ))
{
j = index + 1
while (length(days) < min( limit, ifelse(is.null(days_in),Inf,length(days_in)) ))
{
if (month_ref %in% c(11,12,1,2)) #~= mid-polluted
return (month %in% c(11,12,1,2))
if (month_ref %in% c(3,4,9,10)) #~= high-polluted
if (month_ref %in% c(11,12,1,2)) #~= mid-polluted
return (month %in% c(11,12,1,2))
if (month_ref %in% c(3,4,9,10)) #~= high-polluted