Multi-looking (mlook) — PolSARtools 0.10 documentation

Skip to main content
`Ctrl`+`K`

# Multi-looking (`mlook`)

polsartools.mlook(in_dir, azlks=2, rglks=2, fmt='tif', sub_dir=True, cog=False, ovr=[2, 4, 8, 16], comp=False, max_workers=None, block_size=(512, 512), progress_callback=None)

  Generate multilooked polarimetric matrix from C4, T4, C3, T3, C2, or T2 formats.

  This function applies multilooking (spatial averaging) to reduce speckle noise and improve radiometric stability in polarimetric SAR datasets.

  Examples

      >>> # Basic usage with default look factors
      >>> mlook("/path/to/polSAR_data")

      >>> # With 3 azimuth and 2 range looks, and COG GeoTIFF output
      >>> mlook("/path/to/polSAR_data", azlks=3, rglks=2, fmt="tif", cog=True)

  Parameters:

    - in_dir (str) – Path to the input folder containing a supported polarimetric matrix.

    - azlks (int, default=2) – Number of looks in azimuth (vertical) direction.

    - rglks (int, default=2) – Number of looks in range (horizontal) direction.

    - fmt ({'tif', 'bin'}, default='tif') – Output format: - ‘tif’: Cloud-optimized GeoTIFF (if cog_flag is True) - ‘bin’: Raw binary format

    - cog (bool, default=False) – Enable Cloud Optimized GeoTIFF output with internal overviews and tiling.

    - ovr (list[int], default=[2, 4, 8, 16]) – Overview levels for pyramid generation (used with COGs).

    - comp (bool, default=False) – If True, uses LZW compression for GeoTIFF outputs.

    - max_workers (int | None, default=None) – Maximum number of parallel worker threads (defaults to all available CPUs).

    - block_size (tuple[int, int], default=(512, 512)) – Size of processing blocks for chunked and parallel execution.

  Returns:

    The multilooked output matrix is saved to disk. Number and names of output files depend on matrix type (e.g., C3 → C11.tif, C12_real.tif, etc.).

  Return type:

    None

  Notes

  - Supported polarimetric matrices: ‘C4’, ‘T4’, ‘C3’, ‘T3’, ‘C2’, ‘T2’

  - Automatically detects matrix type and file extension (.bin or .tif)

  - Handles real and complex-valued data appropriately (e.g., multilooks real and imag separately)

  - Output pixel spacing is updated in geotransform metadata based on look factors