The function materializes a data cube as a temporary netCDF file and loads the file with the stars package.
Usage
st_as_stars.cube(.x, ...)
Arguments
Argument
Description
.x
data cube object to coerce
…
not used
Value
stars object
Examples
# create image collection from example Landsat data only # if not already done in other examplesif (!file.exists(file.path(tempdir(), "L8.db"))) { L8_files <-list.files(system.file("L8NY18", package ="gdalcubes"),".TIF", recursive =TRUE, full.names =TRUE)create_image_collection(L8_files, "L8_L1TP", file.path(tempdir(), "L8.db"), quiet =TRUE) }L8.col =image_collection(file.path(tempdir(), "L8.db"))v =cube_view(extent=list(left=388941.2, right=766552.4, bottom=4345299, top=4744931, t0="2018-04", t1="2018-04"),srs="EPSG:32618", nx =497, ny=526, dt="P1M")if(require("stars"))st_as_stars(select_bands(raster_cube(L8.col, v), c("B04", "B05")))
Loading required package: stars
Loading required package: abind
Loading required package: sf
Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
stars object with 3 dimensions and 2 attributes
attribute(s):
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
4 6119 6928 8717 11063.82 10620 53002 99070
5 5564 6411 13519 14300.35 17073 57497 99070
dimension(s):
from to offset delta refsys point
x 1 497 388941 759.8 WGS 84 / UTM zone 18N NA
y 1 526 4744931 -759.8 WGS 84 / UTM zone 18N NA
time 1 1 NA NA POSIXct FALSE
values x/y
x NULL [x]
y NULL [y]
time [2018-04-01,2018-05-01)
# st_as_stars.cubeCoerce gdalcubes object into a stars object```{r include=FALSE}library(gdalcubes)```## DescriptionThe function materializes a data cube as a temporary netCDF file and loads the file with the stars package.## Usage```rst_as_stars.cube(.x, ...)```## Arguments| Argument | Description ||:------------|:----------------------------------|| .x | data cube object to coerce || ... | not used |## Valuestars object## Examples```{r}# create image collection from example Landsat data only # if not already done in other examplesif (!file.exists(file.path(tempdir(), "L8.db"))) { L8_files <-list.files(system.file("L8NY18", package ="gdalcubes"),".TIF", recursive =TRUE, full.names =TRUE)create_image_collection(L8_files, "L8_L1TP", file.path(tempdir(), "L8.db"), quiet =TRUE) }L8.col =image_collection(file.path(tempdir(), "L8.db"))v =cube_view(extent=list(left=388941.2, right=766552.4, bottom=4345299, top=4744931, t0="2018-04", t1="2018-04"),srs="EPSG:32618", nx =497, ny=526, dt="P1M")if(require("stars"))st_as_stars(select_bands(raster_cube(L8.col, v), c("B04", "B05")))```