Convert single-look S (S2,Sxy) (convert_S)#

polsartools.convert_S(infolder, matrixType='T3', azlks=4, rglks=2, cf=1, outType='tif', outfolder=None, cog_flag=False, cog_overviews=[2, 4, 8, 16], write_flag=True, max_workers=None, block_size=(512, 512), progress_callback=None)[source]

Convert full/dual-polarimetric scattering (S2,Sxy) matrix into multi-looked coherency (T4, T3, T2) or covariance (C4, C3, C2) matrices. It supports both GeoTIFF and PolSARpro-compatible output.

Examples

>>> # Convert to C3 matrix with 10x5 multi-looking
>>> convert_S("/path/to/S_data", matrix="C3", azlks=10, rglks=5)
>>> # Output as tiled GeoTIFF with Cloud Optimized overviews
>>> convert_S("/data/S_data", matrix="C2", cog_flag=True)
Parameters:
  • infolder (str) – Path to the input folder containing S11, S12, S21, S22 scattering components.

  • matrixType (str, default='T3') – Output matrix format. Supported values: - ‘T4’, ‘T3’, ‘T2HV’ (Coherency) - ‘C4’, ‘C3’, ‘C2HX’, ‘C2VX’, ‘C2HV’ (Covariance)

  • azlks (int, default=4) – Number of looks in azimuth direction.

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

  • cf (float, default=1) – Calibration factor (linear) to adjust the amplitude of S2 data.

  • outType ({'tif', 'bin'}, default='tif') – Output format type.

  • cog_flag (bool, default=False) – If True, creates Cloud Optimized GeoTIFF (COG).

  • cog_overviews (list[int], default=[2, 4, 8, 16]) – Levels of pyramid overviews for COG generation.

  • write_flag (bool, default=True) – If False, skips writing output to disk.

  • max_workers (int | None, default=None) – Number of parallel worker threads.

  • block_size (tuple[int, int], default=(512, 512)) – Size of chunks for processing.

Returns:

Writes multi-looked polarimetric matrix to disk in the selected format.

Return type:

None