Conversation
tests/testthat/test-rasterize_bmtr.R
Outdated
|
|
||
| raster_uw <- rasterize_bmtr(bmtr_uw, bf) | ||
|
|
||
| expect_true(ext(bf) == ext(raster_uw)) |
There was a problem hiding this comment.
Conceptually it's nice to have this a separate named test but in practice there's a lot of overhead to calc_bmtr() + rasterize_bmrt(). can you combine this with the prior to eliminate that?
tests/testthat/test-rasterize_bmtr.R
Outdated
|
|
||
| raster_uw <- rasterize_bmtr(bmtr_uw, bf) | ||
|
|
||
| expect_true(bf$metadata$n_timesteps == terra::nlyr(raster_uw)) |
|
|
||
| test_that("rasterization works for weighted BMTR calculation", { | ||
| local_quiet() | ||
|
|
There was a problem hiding this comment.
Leave this test as is but add skip("Slow test. Always skipped") to the beginning. The calculation for the weighted BMTR is very different but the structure of the returned object is not so I don't think it's necessary to check raterize_bmtr() against the output of the weighted version every time.
The tests for calc_bmtr() itself should definitely test the weighted version though.
|
I don't think the failed test has anythign to do with your changes. I hope it's just a fluke and re-running will fix it. Edit: It did fix it. I made some comments on the testing. For efficiency I want you to only call |
This PR introduces a new function
rasterize_bmtr. This function converts a BMTR object into a multi-layerSpatRaster, with each unique transition as a separate layer. This makes it easier to plot BMTR objects usingterra::plot().