Learn R Programming

sits (version 1.5.3)

sits_regularize: Build a regular data cube from an irregular one

Description

Produces regular data cubes for analysis-ready data (ARD) image collections. Analysis-ready data (ARD) collections available in AWS, MPC, USGS and DEAfrica are not regular in space and time. Bands may have different resolutions, images may not cover the entire time, and time intervals are not regular. For this reason, subsets of these collection need to be converted to regular data cubes before further processing and data analysis. This function requires users to include the cloud band in their ARD-based data cubes. This function uses the gdalcubes package.

Usage

sits_regularize(cube, ...)

# S3 method for raster_cube sits_regularize( cube, ..., period, res, output_dir, timeline = NULL, roi = NULL, crs = NULL, tiles = NULL, grid_system = NULL, multicores = 2L, progress = TRUE )

# S3 method for sar_cube sits_regularize( cube, ..., period, res, output_dir, timeline = NULL, grid_system = "MGRS", roi = NULL, crs = NULL, tiles = NULL, multicores = 2L, progress = TRUE )

# S3 method for combined_cube sits_regularize( cube, ..., period, res, output_dir, grid_system = NULL, roi = NULL, crs = NULL, tiles = NULL, multicores = 2L, progress = TRUE )

# S3 method for rainfall_cube sits_regularize( cube, ..., period, res, output_dir, timeline = NULL, grid_system = "MGRS", roi = NULL, crs = NULL, tiles = NULL, multicores = 2L, progress = TRUE )

# S3 method for dem_cube sits_regularize( cube, ..., res, output_dir, grid_system = "MGRS", roi = NULL, crs = NULL, tiles = NULL, multicores = 2L, progress = TRUE )

# S3 method for ogh_cube sits_regularize( cube, ..., period, res, output_dir, timeline = NULL, grid_system = "MGRS", roi = NULL, crs = NULL, tiles = NULL, multicores = 2L, progress = TRUE )

# S3 method for derived_cube sits_regularize(cube, ...)

# S3 method for default sits_regularize(cube, ...)

Value

A raster_cube object with aggregated images.

Arguments

cube

raster_cube object whose observation period and/or spatial resolution is not constant.

...

Additional parameters.

period

ISO8601-compliant time period for regular data cubes, with number and unit, where "D", "M" and "Y" stand for days, month and year; e.g., "P16D" for 16 days.

res

Spatial resolution of regularized images (in meters).

output_dir

Valid directory for storing regularized images.

timeline

User-defined timeline for regularized cube.

roi

Region of interest (see notes below).

crs

Coordinate Reference System (CRS) of the roi. (see details below).

tiles

Tiles to be produced.

grid_system

Grid system to be used for the output images.

multicores

Number of cores used for regularization; used for parallel processing of input (integer)

progress

show progress bar?

Author

Felipe Carvalho, felipe.carvalho@inpe.br

Rolf Simoes, rolfsimoes@gmail.com

References

Appel, Marius; Pebesma, Edzer. On-demand processing of data cubes from satellite image collections with the gdalcubes library. Data, v. 4, n. 3, p. 92, 2019. DOI: 10.3390/data4030092.

Examples

Run this code
if (sits_run_examples()) {
    # define a non-regular Sentinel-2 cube in AWS
    s2_cube_open <- sits_cube(
        source = "AWS",
        collection = "SENTINEL-2-L2A",
        tiles = c("20LKP", "20LLP"),
        bands = c("B8A", "CLOUD"),
        start_date = "2018-10-01",
        end_date = "2018-11-01"
    )
    # regularize the cube
    rg_cube <- sits_regularize(
        cube = s2_cube_open,
        period = "P16D",
        res = 60,
        multicores = 2,
        output_dir = tempdir()
    )

    ## Sentinel-1 SAR
    roi <- c(
        "lon_min" = -50.410, "lon_max" = -50.379,
        "lat_min" = -10.1910, "lat_max" = -10.1573
    )
    s1_cube_open <- sits_cube(
        source = "MPC",
        collection = "SENTINEL-1-GRD",
        bands = c("VV", "VH"),
        orbit = "descending",
        roi = roi,
        start_date = "2020-06-01",
        end_date = "2020-09-28"
    )
    # regularize the cube
    rg_cube <- sits_regularize(
        cube = s1_cube_open,
        period = "P12D",
        res = 60,
        roi = roi,
        multicores = 2,
        output_dir = tempdir()
    )
}

Run the code above in your browser using DataLab