rio stack
Stack a number of bands from one or more input files into a multiband dataset.
Input datasets must be of a kind: same data type, dimensions, etc. The output is cloned from the first input.
By default, rio-stack will take all bands from each input and write them in same order to the output. Optionally, bands for each input may be specified using a simple syntax:
–bidx N takes the Nth band from the input (first band is 1).
—bidx M,N,0 takes bands M, N, and O.
–bidx M..O takes bands M-O, inclusive.
—bidx ..N takes all bands up to and including N.
–bidx N.. takes all bands from N to the end.
Examples, using the Rasterio testing dataset, which produce a copy.
rio stack RGB.byte.tif -o stacked.tif
rio stack RGB.byte.tif –bidx 1,2,3 -o stacked.tif
rio stack RGB.byte.tif –bidx 1..3 -o stacked.tif
rio stack RGB.byte.tif –bidx ..2 RGB.byte.tif –bidx 3.. -o stacked.tif
Usage
rio stack [OPTIONS] INPUTS... OUTPUT
Options
- -o, --output <output>
Path to output file (optional alternative to a positional arg).
- -f, --format, --driver <driver>
Output format driver.
- --rgb
Set RGB photometric interpretation.
- --bounds <bounds>
Bounds: ‘left bottom right top’ or ‘[left, bottom, right, top]’.
- -r, --res <res>
Output dataset resolution in units of coordinate reference system. Pixels assumed to be square if this option is used once, otherwise use: –res pixel_width –res pixel_height.
- --resampling <resampling>
Resampling method.
- Default:
'nearest'- Options:
nearest | bilinear | cubic | cubic_spline | lanczos | average | mode | gauss
- --nodata <NUMBER|nan>
Set a Nodata value.
- -t, --dtype <dtype>
Output data type.
- Options:
ubyte | uint8 | uint16 | int16 | uint32 | int32 | float32 | float64
- -b, --bidx <bidx>
Indexes of input file bands.
- --overwrite
Always overwrite an existing output file.
- --target-aligned-pixels, --no-target-aligned-pixels
Align the output bounds based on the resolution.
- --mem-limit <mem_limit>
Limit on memory used to perform calculations, in MB.
- --use-highest-res, --use-first-res
Use the highest resolution of sources or the resolution of the first source argument.
- --co, --profile <NAME=VALUE>
Driver specific creation options. See the documentation for the selected output driver for more information.
Arguments
- INPUTS... OUTPUT
Required argument(s)