Convert Covariance matrix (C4/C3/C2) (convert_C)#
- polsartools.convert_C(in_dir, mat='T3', azlks=1, rglks=1, win=1, 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)[source]
Convert Covariance matrix into coherency (T4, T3, T2) or covariance (C2) matrices. It supports both GeoTIFF and PolSARpro-compatible output.
Examples
>>> # Convert C3 to T3 matrix >>> convert_C("/path/to/C_data", mat="T3")
>>> # Output as tiled GeoTIFF with Cloud Optimized overviews >>> convert_C("/data/C_data", mat="C2", cog=True)
- Parameters:
in_dir (str) –
Path to the input folder containing covariance components {C3: C11, C12_real, C12_imag, C13_real, C13_imag, C22, C13_real, C23_imag, C33;
C4: C11, C12_real, C12_imag, C13_real, C13_imag, C14_real, C14_imag, C22, C23_real, C23_imag, C24_real, C24_imag, C33, C34_real, C34_imag,}.
mat (str, default='T3') – Output matrix. Supported values: - ‘T4’, ‘T3’, ‘T2’ (Coherency) - ‘C3’, ‘C2’, ‘C2HX’, ‘C2VX’, ‘C2HV’ (Covariance)
azlks (int, default=1) – Number of looks in azimuth direction.
rglks (int, default=1) – Number of looks in range direction.
win (int, default=1) – Size of the moving average window.
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.