lsp_add_stars: Creates or adds a stars object

Description Usage Arguments Value Examples

View source: R/lsp_add_spatial.R

Description

Creates or adds a stars object based on the input object or a set of parameters. It accepts either an object of class stars or lsp. In the first case, the output is created based on the window parameter. In the second case, the output converts the lsp object into a stars object.

Usage

1
2
3
4
5
6
7
lsp_add_stars(x = NULL, window = NULL)

## Default S3 method:
lsp_add_stars(x = NULL, window = NULL)

## S3 method for class 'lsp'
lsp_add_stars(x = NULL, window = NULL)

Arguments

x

Object of class stars or lsp. For stars, window or window_size can be used.

window

Specifies areas for analysis. It can be either: NULL, a numeric value, or an sf object. If window=NULL calculations are performed for a whole area. If the window argument is numeric, it is a length of the side of a square-shaped block of cells. Expressed in the numbers of cells, it defines the extent of a local pattern. If an sf object is provided, each feature (row) defines the extent of a local pattern. The sf object should have one attribute (otherwise, the first attribute is used as an id).

Value

A stars object converted from the input object or a provided set of parameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(stars)
landform = read_stars(system.file("raster/landforms.tif", package = "motif"))
plot(landform)
landform_lsp = lsp_add_stars(landform, window = 100)
plot(landform_lsp)

lc_cove = lsp_signature(landform, type = "cove", window = 200, normalization = "pdf")
lc_cove_lsp = lsp_add_stars(lc_cove)
plot(lc_cove_lsp)
plot(lc_cove_lsp["na_prop"])



# larger data example
library(stars)
landform = read_stars(system.file("raster/landform.tif", package = "motif"))
plot(landform)
landform_lsp = lsp_add_stars(landform, window = 100)
plot(landform_lsp)

lc_cove = lsp_signature(landform, type = "cove", window = 200, normalization = "pdf")
lc_cove_lsp = lsp_add_stars(lc_cove)
plot(lc_cove_lsp)
plot(lc_cove_lsp["na_prop"])

motif documentation built on June 4, 2021, 1:08 a.m.