View source: R/sits_cube_copy.R
| sits_cube_copy | R Documentation |
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. sits_cube_copy is useful to improve processing time in the
regularization operation.
sits_cube_copy(
cube,
roi = NULL,
res = NULL,
crs = NULL,
n_tries = 3L,
multicores = 2L,
output_dir,
progress = TRUE
)
cube |
A data cube (class "raster_cube") |
roi |
Region of interest. Either:
|
res |
An integer value corresponds to the output spatial resolution of the images. Default is NULL. |
crs |
The Coordinate Reference System (CRS) of the roi. (see details below). |
n_tries |
Number of attempts to download the same image. Default is 3. |
multicores |
Number of cores for parallel downloading (integer, min = 1, max = 2048). |
output_dir |
Output directory where images will be saved. (character vector of length 1). |
progress |
Logical: show progress bar? |
Copy of input data cube (class "raster cube").
The main sits classification workflow has the following steps:
sits_cube: selects a ARD image collection from
a cloud provider.
sits_cube_copy: copies an ARD image collection
from a cloud provider to a local directory for faster processing.
sits_regularize: create a regular data cube
from an ARD image collection.
sits_apply: create new indices by combining
bands of a regular data cube (optional).
sits_get_data: extract time series
from a regular data cube based on user-provided labelled samples.
sits_train: train a machine learning
model based on image time series.
sits_classify: classify a data cube
using a machine learning model and obtain a probability cube.
sits_smooth: post-process a probability cube
using a spatial smoother to remove outliers and
increase spatial consistency.
sits_label_classification: produce a
classified map by selecting the label with the highest probability
from a smoothed cube.
The roi parameter is used to crop cube images. To define a roi
use one of:
A path to a shapefile with polygons;
A sfc or sf object from sf package;
A SpatExtent object from terra package;
A named vector ("lon_min",
"lat_min", "lon_max", "lat_max") in WGS84;
A named vector ("xmin", "xmax",
"ymin", "ymax") with XY coordinates.
Defining a region of interest using SpatExtent or XY values not in
WGS84 requires the crs parameter to be specified.
Felipe Carlos, efelipecarlos@gmail.com
Felipe Carvalho, felipe.carvalho@inpe.br
if (sits_run_examples()) {
# Creating a sits cube from BDC
bdc_cube <- sits_cube(
source = "BDC",
collection = "CBERS-WFI-16D",
tiles = c("007004", "007005"),
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 = -46.5,
lat_min = -45.5,
lon_max = -15.5,
lat_max = -14.6
),
multicores = 2L,
res = 250
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.