API Reference

l2c_processor module

L2C processor for Sentinel-1 OSW and WW3 colocalization.

topsocnww3sp.l2c_processor.create_global_attributes(sar_filename: str, product_version: str, mode: str) dict[str, str][source]

Create CF-compliant global attributes for the L2C product.

topsocnww3sp.l2c_processor.find_ww3_file(sar_time: datetime, config: dict[str, Any]) str[source]

Find the WW3 file corresponding to the SAR acquisition time.

Parameters:
  • sar_time – SAR acquisition time

  • config – Configuration dictionary containing directory_ww3spectra_output

Returns:

Path to the WW3 file

Raises:

FileNotFoundError – If no WW3 file is found for the given time period

topsocnww3sp.l2c_processor.list_osw_files_in_safe(safe_path: Path) list[Path][source]

List all OSW .nc files in a SAFE directory.

Parameters:

safe_path – Path to the SAFE directory

Returns:

List of paths to OSW .nc files (one per subswath)

Raises:

FileNotFoundError – If measurement directory or OSW files not found

topsocnww3sp.l2c_processor.main() None[source]

Main function to process SAR and WW3 data for colocalization.

topsocnww3sp.l2c_processor.process_group(osw_path: Path, ds_ww3: Dataset, group_name: str, config: dict[str, Any], sar_start: datetime, mode: str) tuple[Dataset | None, Dataset | None, Dataset | None][source]

Process a specific group (intraburst or interburst) of SAR data.

Parameters:
  • osw_path – Path to the OSW file

  • ds_ww3 – WW3 dataset containing spectral data

  • group_name – Name of the group to process (“intraburst” or “interburst”)

  • config – Configuration dictionary with thresholds

  • sar_start – Start time of SAR acquisition

  • mode – Processing mode (“1to1”, “unique”, or “many”)

Returns:

Tuple containing (ds_sar, ds_ww3_out, ds_match) or (None, None, None) if no matches

topsocnww3sp.l2c_processor.process_lasso_group(osw_path: Path, ds_ww3: Dataset, group_name: str, config: dict[str, Any], sar_start: datetime) Dataset | None[source]

Lasso mode: extract WW3 points within buffered footprint of the SAR subswath.

topsocnww3sp.l2c_processor.write_output_file(output_path: Path, global_attrs: dict[str, str], sar_groups: list[tuple[str, Dataset]], ww3_groups: list[tuple[str, Dataset]], match_groups: list[tuple[str, Dataset]] | None = None) None[source]

Write a complete L2C output file with global attributes and groups.

read_s1_osw_tops_data module

Read S1 OSW tops data and concatenate along tiles dimension.

topsocnww3sp.read_s1_osw_tops_data.clean_source_path(full_path: str) str[source]

Extract the meaningful part of the OSW file path.

topsocnww3sp.read_s1_osw_tops_data.read_osw(group: str, lst_sar_files_osw: list[Path], dev: bool = False) tuple[Dataset, dict[str, ndarray]][source]

Read OSW files and concatenate along tiles dimension.