Skip to content
Ben edited this page Apr 16, 2014 · 6 revisions

A number of functions are available in the bfastSpatial package to help keep an inventory of data in a raster time series stack. These functions range from basic scene information (getSceneinfo()) to summary of pixel values per year in the time series (annualSummary()).

The following functions are included in the Data Inventory module:

  1. getSceneinfo()
  2. countObs()
  3. annualSummary()

1. Basic Scene Information: getSceneinfo()

getSceneinfo() allows the user to list the information contained within a scene ID. Currently, only Landsat scene ID's are supported. For example, the scene ID "LE71700552007309ASN00" tells us that the scene is from the Landsat 7 ETM+ sensor ('LE7'), path-row 170-55 ('170055') and was acquired on the 309th day of the year 2007 ('2007309'). Calling getSceneinfo('LE71700552007309ASN00') will give a data.frame with one row showing all of this information.

> # show scene info from tura layers
> data(tura)
> names(tura)
> s <- getSceneinfo(names(tura))
> s
> # add a column for years and plot # of scenes per year
> s$year <- as.numeric(substr(s$date, 1, 4))
> hist(s$year, breaks=c(1984:2014))

More examples can be found under ?getSceneinfo. Many other functions in the bfastSpatial package rely on getSceneinfo to extract relevant scene information, such as acquisition dates to be passed to bfmSpatial() or bfmPixel().

2. Valid Observations: countObs()

The number of available observations in a raster time series can be calculated by using countObs(). This function "drills" through pixels of a time series and counts the number of pixels with a non-NA value. Optionally, any other value can be supplied as a substitute for NA (e.g. the number of non-zero values per pixel can also be queried). Values can also be expressed as a percentage if as.perc is set to TRUE.

> data(tura)
> obs <- countObs(tura, as.perc=TRUE)
> plot(obs)
> summary(obs)

3. Annual Summary Statistics: annualSummary()