Command line — pyramids cog#
pyramids ships a small command-line interface (the pyramids console script, registered on
pip install pyramids-gis) built on the standard-library argparse — no extra dependency.
The cog command group mirrors the common write / validate / inspect workflow.
# Write a COG (validates the output unless --no-validate)
pyramids cog create input.tif scene_cog.tif --profile zstd
pyramids cog create input.tif scene_cog.tif --compress DEFLATE --blocksize 256
# Validate (exit code 1 for a non-COG; --strict promotes warnings to errors)
pyramids cog validate scene_cog.tif --strict
# Print structured metadata + the overview pyramid
pyramids cog info scene_cog.tif
The functions are also callable in-process for scripting/testing:
API#
pyramids.cli
#
Command-line interface for pyramids.
Thin, scriptable wrappers over the library's primitives, built on the
standard-library :mod:argparse (no extra dependency):
pyramids cog create|validate|info ...— the Cloud Optimized GeoTIFF grouppyramids info FILE [--json]— raster metadata at a glancepyramids bounds FILE [--crs CRS] [--json]— bounding boxpyramids clip SRC DST (--bbox MINX MINY MAXX MAXY | --vector PATH)— croppyramids warp SRC DST --crs CRS [--resampling M]— reprojectpyramids merge SRC... DST— mosaicpyramids overview FILE [--resampling M] [--levels N...]— build overviewspyramids sample FILE --points "x,y;x,y..." [--json]— point samplingpyramids convert SRC DST [--driver NAME]— format conversionpyramids georeference SRC DST --gcp PIXEL LINE X Y ... --gcp-crs CRS— warp from ground-control pointspyramids orthorectify SRC DST [--dem PATH | --rpc-height H]— RPC orthorectificationpyramids edit-info FILE [--crs CRS] [--nodata V] [--tag K=V...]— edit CRS / nodata / tags in placepyramids calc EXPR SRC... DST [--dtype T]— evaluate a band expression (safe AST evaluator, noeval)pyramids shapes SRC DST [--geometry polygon|point]— vectorize a rasterpyramids rasterize SRC DST (--cell-size S | --like RASTER) [--column C]— burn a vector into a raster
Every command maps 1:1 onto an existing library call — no business logic lives
here. Expected user errors (missing file, bad CRS, unknown driver) exit
non-zero with a one-line message instead of a traceback. The entry point is
registered as the pyramids console script; the functions here are also
callable in-process (main([...])) for testing.
main(argv=None)
#
Entry point for the pyramids console script.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
Sequence[str] | None
|
Argument list (excluding the program name). Defaults to
:data: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Process exit code ( |
Examples:
- Inspect a COG from the shell: