earthkit.climate.utils.percentile.get_percentile

earthkit.climate.utils.percentile.get_percentile(baseline_dataset: xarray.Dataset, varname: str, percentile: float, freq: str = 'YS') xarray.Dataset

Compute a regular percentile (e.g. 90th) of a variable over time, grouped by a temporal component (month, season, or year), and expand the result to have one value per day of the input period. The final dataset uses ‘dayofyear’ as the main temporal dimension.

Parameters:
  • baseline_dataset (xr.Dataset) – Dataset containing the variable to analyze.

  • varname (str) – Name of the variable within the dataset.

  • percentile (float) – Percentile value (e.g., 90 for 90th percentile).

  • freq (str, optional) – Frequency for grouping (e.g. ‘YS’, ‘MS’, ‘QS’). Default is yearly.

Returns:

Dataset with the computed percentile values expanded to daily resolution, using ‘dayofyear’ (1–365) as the main coordinate.

Return type:

xr.Dataset