tests/testthat/test-tasseledCap.R

context("tasseledCap")

test_that("basic function",{
           for(sat in c("Landsat4TM", "Landsat5TM", "Landsat7ETM", "Landsat8OLI"))  {
              expect_is(lsat_tc <- tasseledCap(lsat[[c(1:5, 7)]], sat = sat), "SpatRaster")
           }
           expect_is(lsat_tc <- tasseledCap(lsat, sat = "MODIS"), "SpatRaster")
           expect_error(tc <- tasseledCap(lsat[[1:4]], sat = "MODIS"), "Number of layers does not match")
           expect_error(tc <- tasseledCap(lsat[[1:4]], sat = "xkcd"), "Sensor not implemented")
        })

Try the RStoolbox package in your browser

Any scripts or data that you put into this service are public.

RStoolbox documentation built on May 29, 2024, 6:34 a.m.