User Guide#
This guide describes all available pyGuidos analysis tools. Each tool operates on a single-band uint8 GeoTIFF input and returns a result object containing statistics and optionally the output array.
Before using any tool, please read the Input Format page which describes the expected pixel value conventions and the GTB output format.
Available Tools#
The easiest way to explore the available tools and access their
scientific documentation is to use the interactive info() function:
import pyguidos as pg
# List all available analytical tools
pg.info()
# Get detailed links and usage for a specific tool
pg.info('frag')
# Get full technical specification of a function
help(pg.frag)
Function |
Description |
Output Files |
|---|---|---|
Simplified Pattern Analysis |
|
|
Fragmentation analysis |
|
|
Landscape Mosaic |
|
|
Patch Size Accounting |
|
|
Restoration Status Summary |
|
|
Extract raster by polygon features |
one |
Common Parameters#
All analysis functions share a common set of parameters:
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str or Path |
– |
Path to input GeoTIFF |
|
str or Path |
None |
Output directory. Defaults to input file directory |
|
bool |
True |
Compute and return statistics |
|
bool |
True |
Write statistics to output files (.txt, .png, …) |
|
bool |
False |
Include output numpy array in result object |
|
bool |
False |
Print progress messages to stdout |
Result Structure#
Each analysis function returns a nested dict. This dictionary contains all the
metadata, file paths, and calculated statistics generated during the run.
The dictionary follows a consistent structure across all tools:
output paths: (
dictorNone) Paths to generated output files. ReturnsNoneifstat_files=False.input stats: (
dict) Basic pixel counts and metadata from the source map.output stats: (
dict) Tool-specific metrics (e.g., MSPA classes, Fragmentation indices, or Landscape Mosaic frequencies).
import pyguidos as pg
# Run an analysis (returns a dict)
result = pg.frag("my_map.tif", "FAD", window_size=27)
# Access primary keys
print(result.keys())
# dict_keys(['output paths', 'input stats', 'output stats'])
# Access a specific output path
tif_path = result['output paths']['path tif']
print(f"Result saved at: {tif_path}")
# Access calculated metrics
avcon = result['output stats']['avcon ']
print(f"AVCON: {avcon}")
Standalone Statistics#
All tools provide a companion *_stats() function that can be called
independently on a previously generated output GeoTIFF, without
rerunning the full analysis:
# Recompute statistics on an existing MSPA output
stats = pg.frag_stats(
frag_tiff="output/my_map_frag_FAD_27.tif",
outfile=True
)
Note
Standalone *_stats() functions require as input raster files to
be output GeoTIFFs from pyGuidos or GTB. See Input Format for details.