Learn R Programming

sits (version 0.10.0)

sits_get_data.csv_raster_cube: Obtain time series from brick based on CSV file

Description

Obtain time series from brick based on CSV file

Usage

# S3 method for csv_raster_cube
sits_get_data(cube, file, ..., bands = NULL, impute_fn = sits_impute_linear())

Arguments

cube

Data cube from where data is to be retrieved.

file

File with information on the data to be retrieved.

...

Other parameters to be passed for specific types.

bands

Bands to be retrieved (optional).

impute_fn

Imputation function for NA values.

Value

A tibble with time series data and metadata.

Examples

Run this code
# NOT RUN {
#' Read a CSV in a Raster Brick
# define the file that has the raster brick
ndvi_file <- c(system.file("extdata/raster/mod13q1/sinop-ndvi-2014.tif",
               package = "sits"))

evi_file <- c(system.file("extdata/raster/mod13q1/sinop-evi-2014.tif",
              package = "sits"))

# define the data cube based on files and known timeline
sinop_2014 <- sits_cube(
    type = "BRICK",
    name = "sinop-2014",
    timeline = timeline_2013_2014,
    satellite = "TERRA",
    sensor = "MODIS",
    bands = c("ndvi", "evi"),
    files = c(ndvi_file, evi_file)
)
# read data from a CSV file
csv_file <- system.file("extdata/samples/samples_sinop_crop.csv",
    package = "sits"
)
points <- sits_get_data(sinop_2014, file = csv_file)

# show the points

plot(points)
# }

Run the code above in your browser using DataLab