Skip to contents

How far any BC watershed’s climate has shifted from your chosen baseline

cd measures how much the climate of a watershed or any other area in British Columbia has changed: air temperature, precipitation, humidity, soil moisture and snow, by season and year since 1950, compared with whatever reference period you choose, with the trend and how much it has moved. It reads ERA5-Land reanalysis from a public catalog that needs no account, so restoration can be planned and monitored against the climate a site has now rather than the one it had. It also gives daily air temperature at any point in the province, for stream-temperature models and degree-day work, and its baseline and trend steps take any annual series, such as streamflow or stream temperature.

Bar chart of annual mean air temperature in the Kootenay Lake watershed group from 1950 to 2025, as the difference from the 1951 to 1980 average, with a dashed trend line rising about 1.9 degrees

Annual mean air temperature in the Kootenay Lake watershed group, compared with its 1951–1980 average. Red years were warmer, blue years cooler; the dashed line is the trend since 1951.

Installation

pak::pak("NewGraphEnvironment/cd")

cd is under active development and its functions change between releases (see NEWS). Pin a release for reproducible work: pak::pak("NewGraphEnvironment/cd@vX.Y.Z").

The example below also needs sf, Kendall and zyp: pak::pak(c("sf", "Kendall", "zyp")).

Example

Extract a series for an area, compare it with a baseline, and test the trend. This is the run behind the figure above:

library(cd)

catalog <- cd_catalog()
aoi <- sf::st_read(
  system.file("extdata", "example_aoi_kotl.gpkg", package = "cd"),
  quiet = TRUE
)

ts  <- cd_extract(catalog, aoi, variables = "tmean", periods = "annual")
bl  <- cd_baseline(ts, baseline_years = 1951:1980)
ano <- cd_anomaly(ts, bl)
trn <- cd_trend(ano, trend_start = 1951)

cd_summary(trn)
#> # A tibble: 1 × 7
#>   Parameter        Period Slope Years `Total Change` Unit  `p-value`
#>   <chr>            <chr>  <dbl> <int>          <dbl> <chr>     <dbl>
#> 1 Mean temperature Annual 0.025    75            1.9 °C            0

Files are cached after the first read and downloaded again only when they are republished. Extracted rows record which commit of cd built each file they came from.

Learn more

Ecosystem

Package Role
link Build, compare and test fish habitat and access models, every fish habitat definition editable
fresh Splits streams at barriers, classifies habitat by species, traces what’s upstream
wet Typical flow in nearly every stream, tested against gauges; station flow and temperature
flooded Maps floodplains from terrain: the valley floor a river can spread across
drift Maps what changed in land cover, where and when, in a floodplain or any area, from free satellite maps or your own
fly Puts BC’s historic airphotos back on the map from free thumbnails
cd How far any BC watershed’s climate has shifted from your chosen baseline (this package)
knowledge Starts from each species’ life history and tunes its fish habitat definitions from where sampling did and did not catch it
floodplains Maps BC’s floodplains and how the land in them changed, one watershed group at a time
crate Canonical schemas for data that changes shape, and provenance receipts for outputs
stac_floodplains_bc Floodplains and land-cover change, a screen for where to look; by watershed group

cd computes the departures from wet’s yearly station values.

Data and methods it builds on

The climate data are ERA5-Land (Muñoz-Sabater et al. 2021), produced by ECMWF for the Copernicus Climate Change Service and read from the DestinE Earth Data Hub. The published layers contain modified Copernicus Climate Change Service information, under CC BY 4.0. Trends are Mann-Kendall tests with Theil-Sen slopes, from the Kendall and zyp packages. cd’s core climate variables and its ecoregion and watershed framing follow bcgov/bc_climate_anomaly, a Shiny app by the Province of British Columbia (Aseem Sharma and contributors).

Citation

Cite cd with citation("cd").

License

MIT © New Graph Environment Ltd. See LICENSE. The ERA5-Land data it ships and publishes are CC BY 4.0; see NOTICE.