Skip to content

Instantly share code, notes, and snippets.

View oousmane's full-sized avatar
🎯
Focusing

Ousmane Ouedraogo oousmane

🎯
Focusing
View GitHub Profile
@oousmane
oousmane / season_length.R
Last active May 9, 2026 15:32
This piece of code let you compute season length using definition of onset, cessation valid for sahelian region
# set up
pak::pak("YODAdam/ClimSeasonR")
library(tidyverse)
library(ClimSeasonR)
# read and clean daily data for multiple stations
data<-readxl::read_excel("~/Downloads/rain.xls",skip = 2) %>%
janitor::clean_names()
# compute season length, for a set of stations
@oousmane
oousmane / circular_mean.R
Last active May 10, 2026 00:46
This function streamline computation of of weighted circular mean. Useful for data described by direction and module like wind.
#' Round to a given multiple
#'
#' @param x Numeric scalar or vector.
#' @param to Target multiple. Default: `5`.
#' @param direction Rounding direction: `"nearest"` (default), `"up"`, or
#' `"down"`.
#'
#' @return Numeric vector rounded to the nearest multiple of `to`.
#' @export
#'