Command Line User Guide#

The rasterio command line interface plugins allow you to execute commands that operate on a raster dataset. Online help lists the avalable subcommands, including those added by rio-terrain.

$ rio --help
Usage: rio [OPTIONS] COMMAND [ARGS]...

  Rasterio command line interface.

Options:
  -v, --verbose           Increase verbosity.
  -q, --quiet             Decrease verbosity.
  --aws-profile TEXT      Select a profile from the AWS credentials file
  --aws-no-sign-requests  Make requests anonymously
  --aws-requester-pays    Requester pays data transfer costs
  --version               Show the version and exit.
  --gdal-version
  --help                  Show this message and exit.

Commands:
  aspect       Calculates aspect of a height raster.
  blocks       Write dataset blocks as GeoJSON features.
  bounds       Write bounding boxes to stdout as GeoJSON.
  calc         Raster data calculator.
  clip         Clip a raster to given bounds.

The list below describes the purpose of the individual rio-terrain subcommands. Command usage can be had by accessing the --help of each command.

aspect#

Usage: rio aspect [OPTIONS] INPUT OUTPUT

  Calculate aspect of a raster.

  INPUT should be a single-band raster.

  Example:     rio aspect elevation.tif aspect.tif --pcs compass

Options:
  --neighbors [4|8]          Specifies the number of neighboring cells to use.
  --pcs [compass|cartesian]  Specifies the polar coordinate system.
  -j, --njobs INTEGER        Number of concurrent jobs to run.
  -v, --verbose              Enables verbose mode.
  --version                  Show the version and exit.
  --help                     Show this message and exit.

curvature#

Usage: rio curvature [OPTIONS] INPUT OUTPUT

  Calculate curvature of a raster.

  INPUT should be a single-band raster.

  Example:     rio curvature elevation.tif curvature.tif

Options:
  --neighbors [4|8]     Specifies the number of neighboring cells to use.
  --stats / --no-stats  Print basic curvature statistics.
  -j, --njobs INTEGER   Number of concurrent jobs to run.
  -v, --verbose         Enables verbose mode.
  --version             Show the version and exit.
  --help                Show this message and exit.

difference#

Usage: rio difference [OPTIONS] INPUT_T0 INPUT_T1 OUTPUT

  Subtract INPUT_T0 from INPUT_T1.

  INPUT_T0 should be a single-band raster at time t0.
  INPUT_T1 should be a single-band raster at time t1.

  Example:     rio diff elevation1.tif elevation2.tif, diff2_1.tif

Options:
  -b, --blocks INTEGER  Multiple internal blocks to chunk.
  -j, --njobs INTEGER   Number of concurrent jobs to run.
  -v, --verbose         Enables verbose mode.
  --version             Show the version and exit.
  --help                Show this message and exit.

extract#

Usage: rio extract [OPTIONS] INPUT CATEGORICAL OUTPUT

  Extract regions from a raster by category.

  INPUT should be a single-band raster.
  CATEGORICAL should be a single-band raster with categories to extract.

  The categorical data may be the input raster or another raster.

  Example:
  rio extract diff.tif categorical.tif extract.tif -c 1 -c 3

Options:
  -c, --category INTEGER  Category to extract.
  -j, --njobs INTEGER     Number of concurrent jobs to run
  -v, --verbose           Enables verbose mode.
  --version               Show the version and exit.
  --help                  Show this message and exit.

label#

Usage: rio label [OPTIONS] INPUT OUTPUT

  Label regions in a raster.

  INPUT should be a single-band raster.

  Example:
  rio label blobs.tif labeled_blobs.tif

Options:
  --diagonals / --no-diagonals  Connect diagonal cells (8-connected).
  --zeros / --no-zeros          Use the raster nodata value or zeros for False
                                condition.

  -j, --njobs INTEGER           Number of concurrent jobs to run.
  -v, --verbose                 Enables verbose mode.
  --version                     Show the version and exit.
  --help                        Show this message and exit.

mad#

Usage: rio mad [OPTIONS] INPUT OUTPUT

  Calculate a median absolute deviation raster.

  INPUT should be a single-band raster.

  Example:
  rio mad elevation.tif mad.tif

Options:
  -n, --neighborhood INTEGER  Neighborhood size in cells.
  -b, --blocks INTEGER        Multiple internal blocks to chunk.
  -j, --njobs INTEGER         Number of concurrent jobs to run.
  -v, --verbose               Enables verbose mode.
  --version                   Show the version and exit.
  --help                      Show this message and exit.

quantiles#

Usage: rio quantiles [OPTIONS] INPUT

  Calculate and print quantile values.

  If user supplies --njobs 0 the entire data is loaded and the statistics
  are calculated precisely. When --njobs 1 or greater the statistics are
  estimated from an incrementally built t-digest
  (https://github.com/tdunning/t-digest/) of data tiles. Crick
  (https://github.com/jcrist/crick/) provides the t-digest implementation.

  INPUT should be a single-band raster.

  Example:
      rio quantiles elevation.tif -q 0.5 -q 0.9

Options:
  -q, --quantile FLOAT        Print quantile value.
  -f, --fraction FLOAT        Randomly sample a fraction of internal blocks.
  --absolute / --no-absolute  Calculate quantiles for the absolute values.
  --describe / --no-describe  Print descriptive statistics to the console.
  --plot / --no-plot          Display statistics plots.
  -j, --jobs INTEGER          Number of concurrent jobs to run.
  -v, --verbose               Enables verbose mode.
  --version                   Show the version and exit.
  --help                      Show this message and exit.

slice#

Usage: rio slice [OPTIONS] INPUT OUTPUT

  Extract regions from a raster by a data range.

  INPUT should be a single-band raster.

  Setting the --keep-data option will return the data values from the INPUT raster.
  The default is to return a raster of ones and zeros.

  Example:
      rio slice diff.tif extracted.tif --minumum -2.0 --maximum 2.0

Options:
  --minimum FLOAT               Minimum value to extract.
  --maximum FLOAT               Maximum value to extract.
  --keep-data / --no-keep-data  Return the input data, or return ones.
  --zeros / --no-zeros          Use the raster nodata value or zeros for False
                                condition.

  -j, --njobs INTEGER           Number of concurrent jobs to run.
  -v, --verbose                 Enables verbose mode.
  --version                     Show the version and exit.
  --help                        Show this message and exit.

slope#

Usage: rio slope [OPTIONS] INPUT OUTPUT

  Calculate slope of a raster.

  INPUT should be a single-band raster.

  Example:
      rio slope elevation.tif slope.tif

Options:
  --neighbors [4|8]               Specifies the number of neighboring cells to
                                  use.

  -u, --units [grade|rise|sqrt|degrees|percent]
                                  Specifies the units of slope.
  -b, --blocks INTEGER            Multiple internal blocks to chunk.
  -j, --njobs INTEGER             Number of concurrent jobs to run.
  -v, --verbose                   Enables verbose mode.
  --version                       Show the version and exit.
  --help                          Show this message and exit.

std#

Usage: rio std [OPTIONS] INPUT OUTPUT

  Calculate a standard-deviation raster.

  INPUT should be a single-band raster.

  Example:
      rio std elevation.tif stddev.tif

Options:
  -n, --neighborhood INTEGER  Neigborhood size in cells.
  -b, --blocks INTEGER        Multiple internal blocks to chunk.
  -j, --njobs INTEGER         Number of concurrent jobs to run.
  -v, --verbose               Enables verbose mode.
  --version                   Show the version and exit.
  --help                      Show this message and exit.

threshold#

Usage: rio threshold [OPTIONS] INPUT UNCERTAINTY OUTPUT LEVEL

  Threshold a raster with an uncertainty raster.

  INPUT should be a single-band raster.
  UNCERTAINTY should be a single-band raster representing uncertainty.

  Example:
      rio threshold diff.tif uncertainty.tif detected.tif 1.68

Options:
  -j, --njobs INTEGER  Number of concurrent jobs to run.
  -v, --verbose        Enables verbose mode.
  --version            Show the version and exit.
  --help               Show this message and exit.

uncertainty#

Usage: rio uncertainty [OPTIONS] UNCERTAINTY0 UNCERTAINTY1 OUTPUT

  Calculate a level-of-detection raster.

  UNCERTAINTY0 should be a single-band raster for uncertainty at time 0.
  UNCERTAINTY1 should be a single-band raster for uncertainty at time 1.

  Example:
      rio uncertainty roughness_t0.tif roughness_t1.tif uncertainty.tif

Options:
  --instrumental0 FLOAT  Minimum uncertainty for the first raster.
  --instrumental1 FLOAT  Minimum uncertainty for the second raster.
  -j, --njobs INTEGER    Number of concurrent jobs to run.
  -v, --verbose          Enables verbose mode.
  --version              Show the version and exit.
  --help                 Show this message and exit.