Convert single-look S (S2,Sxy) (convert_S) — PolSARtools 0.11 documentation

Skip to main content
`Ctrl`+`K`

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

polsartools.convert_S(in_dir, mat='T3', azlks=4, rglks=2, fmt='tif', cog=False, ovr=[2, 4, 8, 16], comp=False, recip=True, cf=1, out_dir=None, max_workers=None, block_size=(512, 512), progress_callback=None)

  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", mat="C3", azlks=10, rglks=5)

      >>> # Output as tiled GeoTIFF with Cloud Optimized overviews
      >>> convert_S("/data/S_data", mat="C2", cog=True)

  Parameters:

    - in_dir (str) – Path to the input folder containing S11, S12, S21, S22 scattering components.

    - mat (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.

    - fmt ({'tif', 'bin'}, default='tif') – Output format type.

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

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

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

    - recip (bool, default=True) – If True, scattering matrix reciprocal symmetry is applied, i.e, S_HV = S_VH.

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

    - out_dir (str | None, default=None) – Path to the output folder. If None, uses the input folder.

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

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