tests/testthat/test-clim_calc.R

context("Test clim_calc.R")

test_that("clim_calc() returns the correct output", {
  ts_xy <- sst_Med
  colnames(ts_xy) <- c("ts_x", "ts_y")
  ts_whole <- heatwaveR:::make_whole_fast(ts_xy)
  ts_wide <- heatwaveR:::clim_spread(ts_whole, clim_start = "1983-01-01",
                                     clim_end = "2012-12-31", windowHalfWidth = 5)
  res <- heatwaveR:::clim_calc(ts_wide, windowHalfWidth = 5, pctile = 90)
  expect_is(res, "matrix")
  expect_equal(ncol(res), 4)
  expect_equal(nrow(res), 366)
})
robwschlegel/heatwaveR documentation built on April 23, 2024, 10:24 p.m.