R: Animate a data cube as an image time series

animate {gdalcubes} | R Documentation

## Animate a data cube as an image time series

### Description

Animate a data cube as an image time series

### Usage

    animate(
      x,
      ...,
      fps = 1,
      loop = 0,
      width = dev.size(units = "px")[1],
      height = dev.size(units = "px")[2],
      save_as = NULL,
      plot = TRUE
    )

### Arguments

`x` | a data cube proxy object (class cube)
`...` | parameters passed to plot.cube
`fps` | frames per second of the animation
`loop` | how many iterations, 0 = infinite
`width` | width (in pixels) of the animation
`height` | height (in pixels) of the animation
`save_as` | character path where the animation shall be stored as a gif file
`plot` | logical; plot the animation (default is TRUE)

### Details

Animations can be created for single band data cubes or RGB plots of multi-band data cubes (by providing the argument rgb) only.

### See Also

`plot.cube`

### Examples

    if (!file.exists(file.path(tempdir(), "L8.db"))) {
      L8_files <- list.files(system.file("L8NY18", package = "gdalcubes"),
                             ".TIF", recursive = TRUE, full.names = TRUE)
      create_image_collection(L8_files, "L8_L1TP", file.path(tempdir(), "L8.db"))
    }

    L8.col = image_collection(file.path(tempdir(), "L8.db"))
    v = cube_view(extent=list(left=388941.2, right=766552.4,
                              bottom=4345299, top=4744931, t0="2018-04", t1="2018-06"),
                  srs="EPSG:32618", nx = 497, ny=526, dt="P16D")

    animate(select_bands(raster_cube(L8.col, v), c("B02", "B03", "B04")), rgb=3:1,
            zlim=c(0,20000), fps=1, loop=1)

    animate(select_bands(raster_cube(L8.col, v), c("B05")), col=terrain.colors, key.pos=1)

[Package gdalcubes version 0.3.1 Index]