Description Usage Arguments Details Value Warning Author(s) Examples
This operator is used to get single band or subset of bands from multi-band ursaRaster
object. Another purpose is get portions of data including data reading from files.
1 2 |
x |
|
i |
Integer or character. If integer, then band index, specifying bands to extract. If character, either list of band names or charater sting for |
j |
Integer. Line index, specifying lines to extract. |
... |
Mentioned for consistence with internal generic function |
drop |
Not used. For consistence with generic function. |
Operator \sQuote{[}
is high-level implementation for data reading. If x$value
item is not applicable, then value of ursaRaster
is not in memory. In this case the controlled by i
and j
portion is read to memory. If both i
and j
are missing, then x[]
reads all values from file.
x[,j]
is appropriate for time series analysis and processing in the case bands have relation to temporal observation. Use regrid
for geographical subset and cropping.
ursaRaster
object with extracter bands. Values ($value
item) are in memory.
It is not allowed to read simultaneously portion of bands and portion of lines from file, e.g.,
1 2 3 |
Such brunch is not implemented in code. You use one of the followed tricks:
1 2 3 |
or
1 2 3 |
Nikita Platonov platonov@sevin.ru
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | session_grid(NULL)
## Prepare
session_grid(regrid(mul=1/8))
a <- pixelsize()
w <- c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"
,"MondayAgain")
b <- rep(a/mean(a),length(w))+seq(length(w))-1
bandname(b) <- w
nr <- ursa_rows(b)
bottom <- (as.integer(nr/2)):nr
write_envi(b,"tmp1",compress=FALSE,interleave="bil")
## Extract
print(b["Monday",regexp=TRUE])
print(b["Monday",regexp=FALSE])
print(b["s"])
print(b["^s"])
d1 <- b[6,bottom]
rm(b)
## Read from file
b <- open_envi("tmp1")
print(b[])
print(b[-c(6:8)])
d2 <- b[,bottom][6] ## don't use b[6,bottom]
close(b)
envi_remove("tmp1")
## Compare
print(d1)
print(d2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.