Skip to main content

Python lib to associate Sentinel-1 OCN TOPS products with WW3 spectra.

Project description

topsocnww3sp

Actions Status Documentation Status PyPI version Conda-Forge PyPI platforms GitHub Discussion Coverage

Python library to co-localize Sentinel-1 OCN Level-2 OSW (Ocean Swell Wave) products with WW3 (WaveWatch III) spectral data.

Table of Contents

Overview

The topsocnww3sp package provides tools to associate Sentinel-1 OSW (Ocean Swell Wave) data with WW3 (WaveWatch III) wave model spectra. The co-localization can be performed using different matching strategies depending on the scientific use case.

Features

  • Multiple matching modes:

    • 1to1: One-to-one matching (closest WW3 point per SAR tile)
    • unique: Multiple SAR tiles can share the same WW3 point (pointer array)
    • many: Many-to-many mapping table (all matches within radius)
    • lasso: All WW3 points within buffered SAR subswath footprint
  • Multi-grid WW3 support: Handles IRI configuration with Arctic, Antarctic and mid-latitude grids

  • CF-compliant NetCDF output: L2C products with full metadata and provenance tracking

  • Interactive visualization: GIF animations and static maps for validation

  • SAR SAFE processing: Process entire SAFE directories (all subswaths IW1/IW2/IW3 or EW1..EW5) in one run

Installation

From PyPI

pip install topsocnww3sp

From Conda-Forge

conda install -c conda-forge topsocnww3sp

For development

git clone https://github.com/umr-lops/topsocnww3sp.git
cd topsocnww3sp
pip install -e ".[dev]"

Configuration

Create a config.yml file with the following structure:

# WW3 data directory
directory_ww3spectra_output: /path/to/ww3/data

# Temporal and spatial thresholds
TIME_THRESHOLD_MINUTES: 30
DISTANCE_THRESHOLD_KM: 20
BUFFER_DEG: 0.1

# Product version (will be appended to output filename)
product_version: "v1.0"

# Multi-grid WW3 configuration (for IRI grids)
ww3_grids:
  arctic:
    pattern: "ARC-*/YYYY-*/TRACK_NC/WW3-ARC-*_*_trck.nc"
  antarctic:
    pattern: "ANTARC-*/YYYY-*/TRACK_NC/WW3-ANTARC-*_*_trck.nc"
  midlatitude:
    pattern: "IRIGLOB-*/YYYY-*/TRACK_NC/WW3-IRIGLOB-*_*_trck.nc"

Usage

Command Line Interface

SAFE directory processing (all subswaths)

procl2c \
  --ocn-safe /path/to/S1A_IW_OCN__2SDV_*.SAFE \
  --config config.yml \
  --mode lasso \
  --output-dir ./output \
  --overwrite

Modes of Operation

Mode Description Output Structure
1to1 Closest WW3 point per SAR tile WW3_{group} with dimension all_tiles
unique Multiple SAR tiles can share WW3 point Pointer array in MATCH_MAP
many All WW3 points within distance threshold Pair table with sar_index and ww3_index
lasso All WW3 points within buffered footprint. Default mode. Single WW3 group per subswath, no MATCH_MAP

Output Structure

For a SAFE directory, the output files are organized as:

output/
└── YYYY/
    └── MM/
        └── DD/
            └── SAFE_NAME/
                ├── s1a-iw1-osw-..._v1.0.nc
                ├── s1a-iw2-osw-..._v1.0.nc
                └── s1a-iw3-osw-..._v1.0.nc

Each output NetCDF file contains:

  • SAR_intraburst group: Original SAR OSW data
  • SAR_interburst group: Interburst SAR data
  • WW3 group: Filtered WW3 spectra (lasso mode)
  • MATCH_MAP group: Association table (other modes)

Visualization Tools

Interactive GIF animation

python scripts/l2c_map_gif.py \
  --l2c-file /path/to/L2C_lasso.nc \
  --tile 10 \
  --output colocation.gif

Static maps for SAFE validation

python scripts/l2c_map_safe.py \
  --safe-dir /path/to/SAFE \
  --output-dir ./maps \
  --tile-zoom 8

Generated maps:

  • Map 1: SAR intraburst tiles only
  • Map 2: SAR intraburst + interburst tiles
  • Map 3: SAR tiles + WW3 spectra positions

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=topsocnww3sp

# Run specific test
pytest tests/test_l2c_processor.py

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Run pre-commit hooks: pre-commit run --all-files
  4. Submit a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this software in your research, please cite:

@software{topsocnww3sp,
  author = {Grouazel, Antoine},
  title = {topsocnww3sp: Sentinel-1 OSW and WW3 co-localization},
  year = {2024},
  url = {https://github.com/umr-lops/topsocnww3sp}
}

Acknowledgments

  • Ifremer / LOPS laboratory
  • ESA for Sentinel-1 data
  • WW3 model developers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsocnww3sp-2026.6.3.post3.tar.gz (56.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topsocnww3sp-2026.6.3.post3-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file topsocnww3sp-2026.6.3.post3.tar.gz.

File metadata

  • Download URL: topsocnww3sp-2026.6.3.post3.tar.gz
  • Upload date:
  • Size: 56.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for topsocnww3sp-2026.6.3.post3.tar.gz
Algorithm Hash digest
SHA256 9235b6924c99226b6412c5c3598ff73220c448c698a892ff096b7c30cf7ae1e2
MD5 d6fae12eda15d1b726db4d3379dcc29c
BLAKE2b-256 69b815eb1920c181cd673028ab712e658341a15dd1c202418ec6cc5bbd0636f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for topsocnww3sp-2026.6.3.post3.tar.gz:

Publisher: cd.yml on umr-lops/topsocnww3sp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file topsocnww3sp-2026.6.3.post3-py3-none-any.whl.

File metadata

File hashes

Hashes for topsocnww3sp-2026.6.3.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 792f01ace9edc45b52be8cdcdcfb67c6cee848f4ad8cf4068c830998f885e040
MD5 67816b43af53a403d2e3793486099c1b
BLAKE2b-256 639b862acac5b1ac9210b465a25d0f881731d95c2600011c8b3c440bca4cc4d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for topsocnww3sp-2026.6.3.post3-py3-none-any.whl:

Publisher: cd.yml on umr-lops/topsocnww3sp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page