aggregate-scidbst-methods: Aggregates a scidbst object over given dimensions and/or...

Description Usage Arguments Details Note Examples

Description

Due to the fact that scidbst arrays can have dimensions that are referenced in space and/or time, this function uses 'scidb's aggregate function for performing the aggregation itself and it manages the metadata information about the references / extents and alike.

Usage

1
2
3
4
5
6
7
## S4 method for signature 'scidbst'
aggregate.t(x, by, ...)

## S4 method for signature 'scidbst'
aggregate.sp(x, by, ...)

aggregate(x, by, FUN, window, variable_window)

Arguments

x

A scidbst object.

by

optional single character string or a list of array dimension and/or attribute names to group by; or a scidb object to group by. Not required for window and grand aggregates.

FUN

a character string representing a SciDB aggregation expression or a reduction function.

window

optional, if specified, perform a moving window aggregate along the specified coordinate windows.

variable_window

optional, if specified, perform a moving window aggregate over successive data values along the coordinate dimension axis specified by by.

Details

The scidbst package also provides functions to directly aggregate over space or time without the need to specify the dimensions that need to be aggregated by.

Aggregate over space

This function aggregates over space leaving a scidbst array without spatial dimensions. The spatial information will remain on the R object. The spatial resolution will be increased to the whole spatial dimensions (one cell captures the whole image). And the spatial extent will remain the same.

Aggregate over time

This function aggregates a scidbst array for the temporal dimension. This means the resulting array will stripped from the temporal dimension and the values on the temporal dimension will be aggregated.

Note

The additional parameter like window and variable_window are passed to the original aggregate function from the scidb package. However, the variable_window parameter was not tested.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
# Using the pure aggregate method
scidbconnect(...)
scidbst.obj = scidbst("array1") #array with spatial and temporal dimension (x,y,t)
agg.1 = aggregate(x=scidbst.obj,by=list("y","x"),FUN="avg(band1)") # aggreagtes over time, result something similar to a raster
agg.2 = aggregate(x=scidbst.obj,by=list("t"),FUN="avg(band1)") # aggregate over space, result something like a time series
agg.3 = aggregate(x=scidbst.obj,by=list("y","x","t"),FUN=count) # count cells that are aggregated = total number of cells over all dimensions

## End(Not run)

## Not run: 
# Using aggregate over space
scidbst.obj = scidbst("array2")
aggt = aggregate.sp(scidbst.obj,FUN="avg(attribute1)") # returns something similar to a timeseries with aggregated values over the spatial dimension

## End(Not run)

## Not run: 
# Using aggregate over time
scidbst.obj = scidbst("array3")
aggt = aggregate.t(scidbst.obj,FUN="avg(attribute1)") # returns something similar to a raster with aggregated values over the temporal dimension

## End(Not run)

flahn/scidbst documentation built on May 16, 2019, 1:15 p.m.