bioclim_window: Bioclimatic variables over an arbitrary window of months

View source: R/bioclim_window.R

bioclim_windowR Documentation

Bioclimatic variables over an arbitrary window of months

Description

Computes the 19 standard bioclimatic variables over a user-defined subset of months. This is useful when a species' relevant season does not coincide with fixed quarters (e.g. eBird Status & Trends breeding windows).

Usage

bioclim_window(
  tas,
  tasmax,
  tasmin,
  pr,
  months = NULL,
  start = NULL,
  end = NULL,
  window = 3L,
  na.rm = FALSE,
  ...
)

Arguments

tas

Numeric vector (length 12), matrix (pixels x 12), SpatRaster with 12 layers, or BioclimData.

tasmax

Same form as tas: monthly maximum temperature.

tasmin

Same form as tas: monthly minimum temperature.

pr

Same form as tas: monthly precipitation.

months

Integer vector of 1-based months in the window, e.g. c(6, 7) for Jun-Jul or c(12, 1, 2) for DJF. If start and end are supplied, months is derived automatically.

start, end

Optional character strings in "MM-DD" format. When both are supplied, the months that overlap the day range are selected. Wrap-around across the year end is supported.

window

Integer: length of the internal rolling sub-window used to compute bio08..bio19. Defaults to 3 (quarterly). Must be ⁠<= length(months)⁠ for the rolling variables to be non-NA.

na.rm

Logical. If FALSE (default), a single NA among the selected months makes all outputs NA for that pixel. If TRUE, missing months are skipped.

...

Not currently used.

Details

The base variables (bio01..bio07, bio12..bio15) are computed directly over the selected months. The rolling variables (bio08..bio11, bio16..bio19) are computed over the best contiguous window-month period that is fully contained in months. If length(months) < window or no such contiguous period exists, those columns are NA.

Value

  • Vector input: a named numeric vector of length 19 (bio01..bio19).

  • Matrix / BioclimData input: a numeric matrix (pixels x 19).

  • SpatRaster input: a 19-layer SpatRaster.

See Also

bioclim_rolling() for rolling optimal windows over the full year with a free window length.


xbioclim documentation built on Oct. 5, 2026, 5:08 p.m.