Diversity indices for FP(diversity_fp)#

polsartools.diversity_fp(in_dir, win=1, fmt='tif', cog=False, ovr=[2, 4, 8, 16], comp=False, max_workers=None, block_size=(512, 512), progress_callback=None)[source]

Compute multiple diversity indices from full-polarimetric SAR data.

This function processes full-polarimetric SAR data stored as T3 or C3 covariance/scattering matrix files, calculating various diversity measures based on the eigenvalue decomposition of the scattering matrices. The computed indices characterize the scattering complexity and heterogeneity of the scene.

The diversity indices computed include: - Shannon entropy - Perplexity - Simpson index - Inverse Simpson index - Gini index - Rényi entropies (orders 2, 3, and 4)

The function processes the input data in spatial chunks with optional parallelization and writes the results as individual files to the specified input directory.

Examples

>>> # Basic usage with default parameters
>>> div_fp("/path/to/fullpol_data")
>>> # Advanced usage with custom parameters
>>> div_fp(
...     in_dir="/path/to/fullpol_data",
...     win=5,
...     fmt="tif",
...     cog=True,
...     block_size=(1024, 1024)
... )
Parameters:
  • in_dir (str) – Path to the input folder containing full-pol T3 or C3 matrix files.

  • win (int, default=1) – Size of the spatial averaging window. Larger windows improve DoP estimation accuracy but decrease spatial resolution.

  • fmt ({'tif', 'bin'}, default='tif') – Output file format: - ‘tif’: GeoTIFF format with georeferencing information - ‘bin’: Raw binary format

  • cog (bool, default=False) – If True, creates a Cloud Optimized GeoTIFF (COG) with internal tiling and overviews for efficient web access.

  • ovr (list[int], default=[2, 4, 8, 16]) – Overview levels for COG creation. Each number represents the decimation factor for that overview level.

  • comp (bool, default=False) – If True, applies LZW compression to the output GeoTIFF files.

  • max_workers (int | None, default=None) – Maximum number of parallel processing workers. If None, uses CPU count - 1 workers.

  • block_size (tuple[int, int], default=(512, 512)) – Size of processing blocks (rows, cols) for parallel computation. Larger blocks use more memory but may be more efficient.

Returns:

Writes eight output files to disk in the format specified by the fmt parameter (GeoTIFF by default):

  1. shannon.tif / shannon.bin: Shannon entropy index of scattering diversity.

  2. perplex.tif / perplex.bin: Perplexity index (effective number of scattering components).

  3. simpson.tif / simpson.bin: Simpson diversity index.

  4. simpson_inv.tif / simpson_inv.bin: Inverse Simpson index.

  5. gini.tif / gini.bin: Gini index (measure of inequality among scattering components).

  6. reyni_2.tif / reyni_2.bin: Rényi entropy of order 2.

  7. reyni_3.tif / reyni_3.bin: Rényi entropy of order 3.

  8. reyni_4.tif / reyni_4.bin: Rényi entropy of order 4.

Return type:

None