Skip to content

Commit 7cafb9e

Browse files
authored
Merge pull request #144 from ocean-uhh/docs-accuracy-fixes
[DOC] Documentation accuracy sweep: formats, API reference
2 parents 5415b0c + 8dbe138 commit 7cafb9e

6 files changed

Lines changed: 310 additions & 19 deletions

File tree

docs/source/api_reference.rst

Lines changed: 137 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@ API Reference
33

44
This section provides detailed API documentation for all SeaSenseLib modules.
55

6+
Top-Level API Functions
7+
-----------------------
8+
9+
These convenience functions are the main entry points for most users and are available directly on the ``seasenselib`` package (commonly imported as ``ssl``).
10+
11+
.. autofunction:: seasenselib.read
12+
13+
.. autofunction:: seasenselib.write
14+
15+
.. autofunction:: seasenselib.plot
16+
17+
.. autofunction:: seasenselib.formats
18+
19+
.. autofunction:: seasenselib.list_readers
20+
21+
.. autofunction:: seasenselib.list_writers
22+
23+
.. autofunction:: seasenselib.list_plotters
24+
25+
.. autofunction:: seasenselib.list_parameters
26+
27+
.. autofunction:: seasenselib.list_all
28+
629
Readers
730
-------
831

@@ -121,6 +144,11 @@ Specific Reader Classes
121144
:undoc-members:
122145
:show-inheritance:
123146

147+
.. autoclass:: seasenselib.readers.SbeHexReader
148+
:members:
149+
:undoc-members:
150+
:show-inheritance:
151+
124152
Writers
125153
-------
126154

@@ -177,7 +205,7 @@ Specific Plotter Classes
177205
:undoc-members:
178206
:show-inheritance:
179207

180-
.. autoclass:: seasenselib.plotters.ProfilePlotter
208+
.. autoclass:: seasenselib.plotters.DepthProfilePlotter
181209
:members:
182210
:undoc-members:
183211
:show-inheritance:
@@ -187,11 +215,6 @@ Specific Plotter Classes
187215
:undoc-members:
188216
:show-inheritance:
189217

190-
.. autoclass:: seasenselib.plotters.TimeSeriesPlotterMulti
191-
:members:
192-
:undoc-members:
193-
:show-inheritance:
194-
195218
Processors
196219
----------
197220

@@ -224,3 +247,111 @@ Specific Processor Classes
224247
:members:
225248
:undoc-members:
226249
:show-inheritance:
250+
251+
Pipeline System
252+
---------------
253+
254+
The Level-1 processing pipeline transforms raw data into standardized, CF/ACDD-compliant datasets through a sequence of configurable stages. See the :doc:`user_guide` for a conceptual overview; the classes and factory functions below make up its public API.
255+
256+
.. automodule:: seasenselib.pipeline
257+
:no-members:
258+
:show-inheritance:
259+
260+
.. autoclass:: seasenselib.pipeline.Pipeline
261+
:members:
262+
:undoc-members:
263+
:show-inheritance:
264+
265+
.. autoclass:: seasenselib.pipeline.Stage
266+
:members:
267+
:undoc-members:
268+
:show-inheritance:
269+
270+
.. autoclass:: seasenselib.pipeline.StageContext
271+
:members:
272+
:undoc-members:
273+
:show-inheritance:
274+
275+
.. autoclass:: seasenselib.pipeline.TransformationStage
276+
:members:
277+
:undoc-members:
278+
:show-inheritance:
279+
280+
.. autoclass:: seasenselib.pipeline.PipelineConfig
281+
:members:
282+
:undoc-members:
283+
:show-inheritance:
284+
285+
.. autoclass:: seasenselib.pipeline.StageConfig
286+
:members:
287+
:undoc-members:
288+
:show-inheritance:
289+
290+
.. autoclass:: seasenselib.pipeline.StageRegistry
291+
:members:
292+
:undoc-members:
293+
:show-inheritance:
294+
295+
.. autofunction:: seasenselib.pipeline.default_pipeline
296+
297+
.. autofunction:: seasenselib.pipeline.minimal_pipeline
298+
299+
.. autofunction:: seasenselib.pipeline.create_pipeline
300+
301+
.. autofunction:: seasenselib.pipeline.list_available_pipelines
302+
303+
Core Infrastructure
304+
-------------------
305+
306+
Lower-level classes used by the readers, writers, and top-level API. Most users will not need these directly.
307+
308+
.. autoclass:: seasenselib.core.DataIOManager
309+
:members:
310+
:undoc-members:
311+
:show-inheritance:
312+
313+
.. autoclass:: seasenselib.core.FormatDetector
314+
:members:
315+
:undoc-members:
316+
:show-inheritance:
317+
318+
.. autoclass:: seasenselib.core.ReaderFactory
319+
:members:
320+
:undoc-members:
321+
:show-inheritance:
322+
323+
.. autoclass:: seasenselib.core.WriterFactory
324+
:members:
325+
:undoc-members:
326+
:show-inheritance:
327+
328+
Exceptions
329+
^^^^^^^^^^
330+
331+
.. autoclass:: seasenselib.core.SeaSenseLibError
332+
:members:
333+
:show-inheritance:
334+
335+
.. autoclass:: seasenselib.core.FormatDetectionError
336+
:members:
337+
:show-inheritance:
338+
339+
.. autoclass:: seasenselib.core.DependencyError
340+
:members:
341+
:show-inheritance:
342+
343+
.. autoclass:: seasenselib.core.ValidationError
344+
:members:
345+
:show-inheritance:
346+
347+
Canonical Parameters
348+
--------------------
349+
350+
``seasenselib.parameters`` defines the canonical (standardized) variable names used throughout SeaSenseLib — for example ``TEMPERATURE = 'temperature'`` and ``SALINITY = 'salinity'``. Reader mappings translate instrument-specific column names onto these canonical names.
351+
352+
To list the canonical parameters available at runtime, use the top-level helper:
353+
354+
.. code-block:: python
355+
356+
import seasenselib as ssl
357+
ssl.list_parameters()

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For recommendations or bug reports, please visit https://github.com/ocean-uhh/se
1616
:caption: Getting started
1717

1818
about
19+
overview
1920
installation
2021

2122
.. toctree::

docs/source/installation.rst

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ Installation
44
Requirements
55
------------
66

7-
SeaSenseLib requires Python 3.10 or later and depends on several scientific Python packages:
7+
SeaSenseLib requires Python 3.10 or later and depends on several scientific Python packages, all of which are installed automatically by ``pip``:
88

9-
* **Core dependencies**: xarray, pandas, numpy, matplotlib
10-
* **File format support**: netcdf4, pycnv, pyrsktools
11-
* **Scientific computing**: scipy, gsw (Gibbs SeaWater library)
9+
* **Core data handling**: xarray, pandas, numpy, scipy
10+
* **File format support**: netcdf4, pycnv, pyrsktools, seabirdscientific, mhkit (with the ``dolfyn`` extra, for Nortek/RDI raw data)
11+
* **Scientific computing**: gsw (Gibbs SeaWater library), pint (units)
12+
* **Plotting**: matplotlib, pylablib
13+
14+
You do not need to install these individually — they come with SeaSenseLib.
15+
16+
If you are new to Python, first check that Python 3.10+ is available:
17+
18+
.. code-block:: bash
19+
20+
python3 --version
21+
22+
If it reports a version below 3.10 (or the command is not found), install a current Python from `python.org <https://www.python.org/downloads/>`_ or via a distribution such as Miniconda (see below) before continuing.
1223

1324
Install from PyPI
1425
-----------------
@@ -21,6 +32,25 @@ The easiest way to install SeaSenseLib is using pip:
2132
2233
This will install SeaSenseLib and all required dependencies.
2334

35+
Using conda or mamba
36+
--------------------
37+
38+
Many oceanographers manage Python with Anaconda/Miniconda (``conda``) or its faster drop-in replacement ``mamba``. SeaSenseLib is not yet published on conda-forge, so you create a conda environment and then install SeaSenseLib into it with ``pip``:
39+
40+
.. code-block:: bash
41+
42+
# with conda
43+
conda create -n seasenselib python=3.11
44+
conda activate seasenselib
45+
pip install seasenselib
46+
47+
# or with mamba (same commands, faster solver)
48+
mamba create -n seasenselib python=3.11
49+
mamba activate seasenselib
50+
pip install seasenselib
51+
52+
Installing with ``pip`` inside an activated conda environment is expected and supported here. Do not run ``conda install seasenselib`` — the package is not on any conda channel and that command will fail.
53+
2454
Development Installation
2555
------------------------
2656

@@ -63,7 +93,21 @@ If you want to contribute to the project or modify the code, follow these steps:
6393
pip install --upgrade pip setuptools wheel
6494
pip install -e ".[dev]"
6595
66-
This installs SeaSenseLib in "editable" mode along with development dependencies like pytest and sphinx.
96+
This installs SeaSenseLib in "editable" mode (changes to the source take effect immediately without reinstalling). The ``[dev]`` part is an optional dependency group that adds tools needed only for development — pytest (running tests), sphinx, nbsphinx, myst-parser and the RTD theme (building these docs), plus build and twine (packaging). A plain ``pip install -e .`` skips those.
97+
98+
The same editable install works inside a conda/mamba environment: activate the environment first, then run the ``pip install -e ".[dev]"`` command.
99+
100+
**Using the conda environment file:**
101+
102+
For development with conda, the repository provides an ``environment.yml`` that creates an environment named ``seasenselib`` with Python (3.10–3.13), ``gsw``, ``pandoc``, and all runtime and development dependencies:
103+
104+
.. code-block:: bash
105+
106+
conda env create -f environment.yml
107+
conda activate seasenselib
108+
pip install -e .
109+
110+
The environment file installs the dependencies but not SeaSenseLib itself, so the final ``pip install -e .`` installs the package in editable mode from the repository root.
67111

68112
Alternative Installation Methods
69113
--------------------------------
@@ -111,7 +155,9 @@ This should display the available commands and options.
111155

112156
.. code-block:: bash
113157
114-
python -m unittest discover tests/
158+
python -m pytest tests/
159+
160+
(``python -m unittest discover tests/`` also works if you prefer the standard library test runner.)
115161

116162
Troubleshooting
117163
---------------

docs/source/overview.rst

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,74 @@
1-
SeaSenseLib overview
2-
===============================
1+
SeaSenseLib Overview
2+
====================
33

4+
SeaSenseLib reads oceanographic sensor data from many instrument formats, standardizes it, and lets you convert or visualize it — all through a single, consistent interface built on `xarray <https://docs.xarray.dev/>`_ Datasets.
45

5-
Some notes about how to use the SeaSenseLib package, and where it fits into a data processing pipeline.
6+
This page describes how the pieces fit together. For installation see :doc:`installation`, for the full list of formats see :doc:`supported_formats`, and for detailed signatures see :doc:`api_reference`.
7+
8+
Where it fits in a data workflow
9+
--------------------------------
10+
11+
A typical SeaSenseLib workflow has three steps:
12+
13+
1. **Read** a raw instrument file into an xarray ``Dataset``. During reading, an optional processing *pipeline* normalizes variable names and units, derives parameters, and adds CF/ACDD-compliant metadata.
14+
2. **Process** the Dataset further if needed — subset, resample, or compute statistics — using standard xarray operations or the built-in processors.
15+
3. **Write** the Dataset to a standard format (NetCDF, CSV, Excel), or **plot** it (depth profile, time series, T-S diagram).
16+
17+
::
18+
19+
raw instrument file
20+
21+
22+
ssl.read() ──► xarray.Dataset ──► ssl.write() ──► .nc / .csv / .xlsx
23+
(+ pipeline) │
24+
└──────────► ssl.plot() ──► figure
25+
26+
A minimal example
27+
-----------------
28+
29+
.. code-block:: python
30+
31+
import seasenselib as ssl
32+
33+
# Read a SeaBird CNV file. Format is auto-detected from the extension.
34+
ds = ssl.read("station001.cnv")
35+
36+
# Inspect it — it is a standard xarray Dataset.
37+
print(ds)
38+
39+
# Write it out as a CF-compliant NetCDF file.
40+
ssl.write(ds, "station001.nc", file_format="netcdf")
41+
42+
# Or make a T-S diagram.
43+
ssl.plot("ts-diagram", ds, output_file="station001_ts.png")
44+
45+
When automatic format detection is not enough (ambiguous extensions such as ``.mat`` or ``.hex``), pass an explicit ``file_format`` key — see :doc:`supported_formats`.
46+
47+
The processing pipeline
48+
-----------------------
49+
50+
By default, reading applies a processing pipeline that turns raw data into a standardized Level-1 dataset. You can choose how much processing to apply with the ``pipeline_profile`` argument:
51+
52+
.. code-block:: python
53+
54+
ds = ssl.read("station001.cnv", pipeline_profile="minimal") # mapping only
55+
ds = ssl.read("station001.cnv", pipeline_profile="default") # conservative L1
56+
ds = ssl.read("station001.cnv", pipeline_profile="full") # all stages
57+
58+
- ``minimal`` — variable-name mapping and finalization only.
59+
- ``default`` — conservative Level-1 processing (no unit conversion).
60+
- ``full`` — the complete Level-1 pipeline with all stages and handlers.
61+
62+
For raw, unprocessed data, use the CLI ``--raw-only`` flag or skip the pipeline stages you do not want. The pipeline is fully configurable; its stages, profiles, and public API are described in :doc:`user_guide` and :doc:`api_reference`.
63+
64+
Command-line interface
65+
----------------------
66+
67+
Everything above is also available from the command line:
68+
69+
.. code-block:: bash
70+
71+
seasenselib convert -i station001.cnv -o station001.nc
72+
seasenselib list readers
73+
74+
Run ``seasenselib --help`` to see all commands.

0 commit comments

Comments
 (0)