tests/testthat/test-rast_coord.R

test_that("rast_coord works", {
  bandnames = paste0("bands", 1:3)
  vals = rep(seq(1, 360 * 180), 3)
  r = make_rast(vals = vals, nlyrs = 3, names = bandnames)

  d = rast_coord(r)
  d_1st = subset(d, cell == 1)
  expect_equal(nrow(d), 360*180)
  expect_true(with(d_1st, lon == -179.5 && lat == 89.5))
})
rpkgs/sp2 documentation built on Aug. 12, 2024, 9:35 a.m.