anomaly: Temperature Anomaly

View source: R/anomaly.R

anomalyR Documentation

Temperature Anomaly

Description

anomaly() calculates the temperature anomalies compared to a baseline reference period. Anomalies are the difference between annual temperature extremes and the average across the baseline period.

If aggregate_stations = TRUE, anomalies are averaged across all weather stations.

Usage

anomaly(x, cutoff, aggregate_stations = FALSE)

Arguments

x

Object of class ghcn_daily or ghcn_annual. See daily() and annual() for details.

cutoff

Numeric, last year of the baseline period (inclusive).

aggregate_stations

Logical, if anomaly should be calculated aggregating data from all weather stations.

Details

cutoff must be a character with the date, e.g. "2000-01-01".

Value

A tibble with the anomaly timeseries at the stations.

Examples

x <- USC00010655
x <- remove_flagged(x)
cover <- annual_coverage(x)
years <- cover$year[cover$"annual_coverage_tmax" > .99 & cover$"annual_coverage_tmin" > .99]
years <- setdiff(years, 2024)
x$years <- as.numeric(format(x$date, "%Y"))
x <- x[x$years %in% years, ]
a <- annual(x)
anom <- anomaly(a, cutoff = 2012)
plot(anom)

GHCNr documentation built on April 3, 2025, 11:16 p.m.