Skip to content

Commit 3a24c69

Browse files
authored
Merge pull request #12 from umr-lops/docs-update
Docs update
2 parents dd274cd + 2a6debe commit 3a24c69

13 files changed

Lines changed: 323 additions & 54 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
rev: "1.20.0"
1111
hooks:
1212
- id: blacken-docs
13-
additional_dependencies: [black==26.*]
13+
additional_dependencies: ["black==25.11.0"]
1414

1515
- repo: https://github.com/pre-commit/pre-commit-hooks
1616
rev: "v6.0.0"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Swell Wave) data with WW3 (WaveWatch III) wave model spectra. The
3535
co-localization can be performed using different matching strategies depending
3636
on the scientific use case.
3737

38+
![Example of 1to1 SAR/WW3 colocation](docs/coloc_1to1_llustration.png)
39+
3840
## Features
3941

4042
- **Multiple matching modes**:

docs/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SPHINXBUILD = sphinx-build
2+
SOURCEDIR = .
3+
BUILDDIR = _build
4+
5+
.PHONY: html clean
6+
7+
html:
8+
$(SPHINXBUILD) -b html $(SOURCEDIR) $(BUILDDIR)/html
9+
10+
clean:
11+
rm -rf $(BUILDDIR)

docs/api.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33
API Reference
44
=============
55

6-
.. automodule:: topsocnww3sp.l2c_processor
7-
:members:
8-
:undoc-members:
9-
:show-inheritance:
10-
11-
.. automodule:: topsocnww3sp.read_s1_osw_tops_data
12-
:members:
13-
:undoc-members:
14-
:show-inheritance:
15-
166
.. _l2c_processor:
177

188
l2c_processor module

docs/coloc_1to1_llustration.png

119 KB
Loading

docs/colocation_notebook.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. _colocation_notebook:
2+
3+
Co-location Illustration (Notebook)
4+
===================================
5+
6+
The co-localization process allows for the alignment of SAR and WW3 data. This page describes how to implement a workflow using a notebook.
7+
8+
Typical Notebook Workflow
9+
--------------------------
10+
11+
A typical analysis notebook would follow these steps:
12+
13+
1. **Data Loading**: Load an L2C NetCDF file produced by ``procl2c``.
14+
2. **Visualization**: Plot the SAR footprint and the associated WW3 points.
15+
3. **Spectral Analysis**: Extract spectral parameters (e.g., significant wave height) from both the OSW product and the WW3 spectra for the same coordinates.
16+
4. **Validation**: Compare values using scatter plots or time-series analysis.
17+
18+
Example snippet for visualization:
19+
20+
.. code-block:: python
21+
22+
import matplotlib.pyplot as plt
23+
import xarray as xr
24+
import cartopy.crs as ccrs
25+
26+
# Load data
27+
ds_sar = xr.open_dataset("product_v0.1.nc", group="SAR_intraburst")
28+
ds_ww3 = xr.open_dataset("product_v0.1.nc", group="WW3")
29+
30+
# Plotting map
31+
fig = plt.figure(figsize=(10, 6))
32+
ax = plt.axes(projection=ccrs.PlateCarree())
33+
34+
# The SAR tiles can be plotted as points or polygons
35+
ax.scatter(ds_sar.oswLon, ds_sar.oswLat, c="blue", label="SAR Tiles")
36+
ax.scatter(ds_ww3.longitude, ds_ww3.latitude, c="red", label="WW3 Spectra")
37+
ax.legend()
38+
plt.show()

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env python3
22
from __future__ import annotations
33

4-
import importlib.metadata
54
from typing import Any
65

76
project = "topsocnww3sp"
87
copyright = "2026, Antoine Grouazel"
98
author = "Antoine Grouazel"
10-
version = release = importlib.metadata.version("topsocnww3sp")
9+
version = release = "dev"
1110

1211
extensions = [
1312
"myst_parser",

docs/index.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@ TOPSOCNWW3SP Documentation
55

66
Welcome to the TOPSOCNWW3SP documentation. This project provides tools for colocalizing SAR and WW3 spectral data.
77

8+
.. image:: coloc_1to1_llustration.png
9+
:alt: Example of 1to1 SAR/WW3 colocation
10+
:align: center
11+
:width: 80%
12+
13+
814
.. toctree::
915
:maxdepth: 2
1016
:caption: Contents:
1117

1218
usage
13-
api
1419
install
15-
colocation_notebook
20+
api
21+
l2c_definition
1622
l2c_output_usage
23+
colocation_notebook
1724
l2c_processor_strategy
1825

1926
Indices and tables

docs/install.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. _install:
2+
3+
Installation
4+
=============
5+
6+
Installation of ``topsocnww3sp`` can be done via pip from the source repository.
7+
8+
Prerequisites
9+
-------------
10+
11+
- Python 3.10 or higher
12+
- A working Python environment (venv, conda, etc.)
13+
14+
Install from Source
15+
--------------------
16+
17+
18+
Clone the repository and install the package:
19+
20+
.. code-block:: bash
21+
22+
git clone https://github.com/umr-lops/topsocnww3sp.git
23+
cd topsocnww3sp
24+
pip install .
25+
26+
Optional Dependencies
27+
---------------------
28+
29+
To enable plotting features, install the optional ``plot`` dependencies:
30+
31+
.. code-block:: bash
32+
33+
pip install ".[plot]"
34+
35+
Verification
36+
------------
37+
38+
You can verify the installation by checking the version of the installed package:
39+
40+
.. code-block:: bash
41+
42+
python -c "import topsocnww3sp; print(topsocnww3sp.__version__)"

docs/l2c_definition.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _l2c_definition:
2+
3+
File Naming Convention & L2C Product Definition
4+
================================================
5+
6+
This section defines the Level-2C (L2C) product generated by ``topsocnww3sp``.
7+
8+
Product Definition
9+
------------------
10+
11+
The L2C product is a NetCDF file that co-localizes Sentinel-1 Ocean Waves (OSW) data with WaveWatch III (WW3) spectral data. The goal is to provide a dataset where SAR observations and model spectra are aligned in time and space for easier comparison and analysis.
12+
13+
L2C Output Structure
14+
---------------------
15+
16+
17+
The output files use NetCDF groups to separate different types of information:
18+
19+
* **SAR Groups**: Contain the original OSW data (e.g., ``SAR_intraburst``, ``SAR_interburst``).
20+
* **WW3 Group**: Contains the associated WW3 spectra. The group name depends on the mode:
21+
* In ``lasso`` mode, it is simply named ``WW3``.
22+
* In other modes, it is often prefixed by the SAR group (e.g., ``WW3_intraburst``).
23+
* **MATCH_MAP Groups**: (Used in 1to1, unique, and many modes) Contains mapping information such as distances and pointers from SAR tiles to WW3 spectra.
24+
25+
File Naming Convention
26+
----------------------
27+
28+
The output files are named following this pattern:
29+
30+
``<original_osw_stem>_<product_version>.nc``
31+
32+
Example: ``s1a-iw1-osw-vv-20220107t062429-20220107t062500-041351-04ea80-001_v0.1.nc``
33+
34+
The files are organized in a hierarchical directory structure:
35+
``<output_dir>/<year>/<month>/<day>/<safe_name>/<filename>.nc``
36+
37+
Metadata
38+
--------
39+
40+
Every L2C file contains comprehensive global attributes following CF-1.8 conventions, including the processor version, source SAR product, and the co-localization mode used.

0 commit comments

Comments
 (0)