Aliases: st_dimensions st_dimensions.stars st_dimensions<- st_dimensions<-.stars st_dimensions<-.stars_proxy st_dimensions<-.list st_dimensions.array st_dimensions.default st_set_dimensions st_get_dimension_values
Keywords:
### ** Examples x = read_stars(system.file("tif/L7_ETMs.tif", package = "stars")) # Landsat 7 ETM+ band semantics: https://landsat.gsfc.nasa.gov/the-enhanced-thematic-mapper-plus/ # set bands to values 1,2,3,4,5,7: (x1 = st_set_dimensions(x, "band", values = c(1,2,3,4,5,7), names = "band_number", point = TRUE))
stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. L7_ETMs.tif 1 54 69 68.91242 86 255 dimension(s): from to offset delta refsys point values x/y x 1 349 288776 28.5 SIRGAS 2000 / UTM zone 25S FALSE NULL [x] y 1 352 9120761 -28.5 SIRGAS 2000 / UTM zone 25S FALSE NULL [y] band_number 1 6 NA NA NA TRUE 1,...,7
# set band values as bandwidth rbind(c(0.45,0.515), c(0.525,0.605), c(0.63,0.69), c(0.775,0.90), c(1.55,1.75), c(2.08,2.35)) %>% units::set_units("um") -> bw # or: units::set_units(µm) -> bw # set bandwidth midpoint: (x2 = st_set_dimensions(x, "band", values = 0.5 * (bw[,1]+bw[,2]), names = "bandwidth_midpoint", point = TRUE))
stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. L7_ETMs.tif 1 54 69 68.91242 86 255 dimension(s): from to offset delta refsys point x 1 349 288776 28.5 SIRGAS 2000 / UTM zone 25S FALSE y 1 352 9120761 -28.5 SIRGAS 2000 / UTM zone 25S FALSE bandwidth_midpoint 1 6 NA NA udunits TRUE values x/y x NULL [x] y NULL [y] bandwidth_midpoint 0.4825 [um],...,2.215 [um]
# set bandwidth intervals: (x3 = st_set_dimensions(x, "band", values = make_intervals(bw), names = "bandwidth"))
stars object with 3 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. L7_ETMs.tif 1 54 69 68.91242 86 255 dimension(s): from to offset delta refsys point x 1 349 288776 28.5 SIRGAS 2000 / UTM zone 25S FALSE y 1 352 9120761 -28.5 SIRGAS 2000 / UTM zone 25S FALSE bandwidth 1 6 NA NA udunits NA values x/y x NULL [x] y NULL [y] bandwidth [0.45,0.515) [um],...,[2.08,2.35) [um]
m = matrix(1:20, nrow = 5, ncol = 4) dim(m) = c(x = 5, y = 4) # named dim (s = st_as_stars(m))
stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. A1 1 5.75 10.5 10.5 15.25 20 dimension(s): from to offset delta point x/y x 1 5 0 1 FALSE [x] y 1 4 0 1 FALSE [y]
st_get_dimension_values(s, 'x', where = "start")
[1] 0 1 2 3 4
st_get_dimension_values(s, 'x', center = FALSE)
[1] 0 1 2 3 4
st_get_dimension_values(s, 'x', where = "center")
[1] 0.5 1.5 2.5 3.5 4.5
st_get_dimension_values(s, 'x', center = TRUE)
[1] 0.5 1.5 2.5 3.5 4.5
st_get_dimension_values(s, 'x', where = "end")
[1] 1 2 3 4 5
st_get_dimension_values(s, 'x', max = TRUE)
[1] 1 2 3 4 5