Learn R Programming

sits (version 1.4.0)

sits_cube_copy: Copy the images of a cube to a local directory

Description

This function downloads the images of a cube in parallel. A region of interest (roi) can be provided to crop the images and a resolution (res) to resample the bands.

Usage

sits_cube_copy(
  cube,
  roi = NULL,
  res = NULL,
  multicores = 2,
  output_dir,
  progress = TRUE
)

Value

a sits cube with updated metadata.

Arguments

cube

A sits cube

roi

A Region of interest. See details below.

res

An integer value corresponds to the output spatial resolution of the images. Default is NULL.

multicores

Number of workers for parallel downloading.

output_dir

Output directory where images will be saved.

progress

Show progress bar?

Examples

Run this code
if (sits_run_examples()) {
  # Creating a sits cube from BDC
  bdc_cube <- sits_cube(
      source = "BDC",
      collection = "CB4_64_16D_STK-1",
      tiles = c("022024", "022025"),
      bands = c("B15", "CLOUD"),
      start_date = "2018-01-01",
      end_date = "2018-01-12"
  )

  # Downloading images to a temporary directory
  cube_local <- sits_cube_copy(
      cube = bdc_cube,
      output_dir = tempdir(),
      roi = c(lon_min = -42.28469009,
              lat_min = -14.95411527,
              lon_max = -41.74745556,
              lat_max = -14.65950650),
      multicores = 2
  )
}

Run the code above in your browser using DataLab