Skip to content

Commit ed44b38

Browse files
committed
chore: finalize v0.7 public API and release checks
1 parent 2f00f62 commit ed44b38

25 files changed

Lines changed: 266 additions & 194 deletions

File tree

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ updates:
1212
patterns: ['*']
1313
update-types: [minor, patch]
1414

15+
- package-ecosystem: pre-commit
16+
directory: /
17+
schedule:
18+
interval: daily
19+
time: '04:10'
20+
timezone: America/New_York
21+
1522
- package-ecosystem: github-actions
1623
directory: /
1724
schedule:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ jobs:
424424
python-version: ${{ env.PYTHON_VERSION }}
425425

426426
- name: Build documentation
427-
run: uv run --no-dev --group docs sphinx-build -b html docs docs/_build/html
427+
run: uv run --no-dev --group docs sphinx-build -W --keep-going -b html docs docs/_build/html
428428

429429
docker-build:
430430
name: Build and test Docker images

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
types_or: [ python ]
2727

2828
- repo: https://github.com/astral-sh/ty-pre-commit
29-
rev: v0.0.66
29+
rev: v0.0.74
3030
hooks:
3131
- id: ty
3232
args: [ --all-extras, --isolated ]

.readthedocs.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ build:
99
nodejs: "20"
1010
jobs:
1111
post_install:
12-
- >-
13-
uv pip install --python "$READTHEDOCS_VIRTUALENV_PATH/bin/python"
14-
"sphinxcontrib-mermaid==2.0.2"
1512
- npm install -g @mermaid-js/mermaid-cli
1613

1714
python:

CONTRIBUTING.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,36 @@ We welcome ideas for new features or improvements. Please [open an issue](https:
2020
### Submitting Pull Requests
2121

2222
1. **Fork the repository** and create your branch from `main`.
23+
2324
1. **Install development dependencies**:
25+
2426
```bash
2527
uv sync
2628
```
29+
2730
1. **Make your changes**:
31+
2832
- Ensure your code follows the project's style (use `ruff` for formatting and linting).
2933
- Add or update tests for your changes.
3034
- Ensure all tests pass.
31-
1. **Run Quality Control Checks**:
35+
36+
1. **Run the local quality checks**:
37+
3238
```bash
33-
uv run ruff check . --fix
34-
uv run ruff format .
39+
uv run prek run --all-files
3540
uv run mypy
36-
uv run pytest tests/unit tests/integration tests/parity
41+
uv run pytest
42+
uv run pytest tests/integration -m "not slow and not data"
43+
uv run pytest tests/parity -m "not slow and not data"
44+
uv run python scripts/generate_trackjson_schema.py --check
3745
```
46+
47+
`uv run pytest` is the fast unit suite because the default test paths are
48+
`tests/unit`. See [the testing guide](docs/development/testing.md) for
49+
external-data and expensive validation.
50+
3851
1. **Submit the Pull Request**:
52+
3953
- Provide a clear description of the changes.
4054
- Reference any related issues.
4155

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ Additional method-specific references are given in the relevant documentation.
8383

8484
## License
8585

86-
PyStormTracker is distributed under the [BSD 3-Clause License](LICENSE).
86+
PyStormTracker is distributed under the [BSD 3-Clause License](https://github.com/mwyau/PyStormTracker/blob/main/LICENSE).

docs/api.md

Lines changed: 136 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Python API Reference
22

3-
PyStormTracker provides an object-oriented Python API. Tracker instances encapsulate algorithm, preprocessing, and execution configuration. The `.track()` method executes tracking on an input file or xarray dataset and returns an immutable `Tracks` container, which provides `.write()` for output serialization.
3+
PyStormTracker provides an object-oriented Python API. Tracker instances
4+
encapsulate algorithm, preprocessing, and execution configuration. The
5+
`.track()` method executes tracking on an input file or xarray dataset and
6+
returns an immutable `Tracks` container, which provides `.write()` for output
7+
serialization.
48

59
## Overview
610

@@ -32,41 +36,74 @@ tracks = tracker.track(
3236
tracks.write("tracks.trackjson")
3337
```
3438

35-
### API Division
39+
## API policy
3640

37-
- **Constructor**: Specifies algorithm parameters, spatial/spectral preprocessing filters, projections, and backend/concurrency settings.
38-
- **`track()`**: Specifies input data (`data`, `variable`), time window (`start_time`, `end_time`), extremum mode (`detection_mode`), thresholds (`feature_threshold` for Simple, `object_threshold` for Hodges and HEALPix), and reader engine (`engine`).
39-
- **`Tracks.write()`**: Handles output serialization to supported formats (`json`, `track`, `imilast`).
41+
PyStormTracker is a pre-1.0 project with a deliberately small compatibility
42+
surface. Python importability alone does not make a name supported. The
43+
`__all__` declarations, package re-exports, and the explicitly documented
44+
members below define the intended API.
4045

41-
For `HodgesTracker`, `frame_workers` controls concurrent frame tasks,
42-
`sht_threads` controls DUCC0 threads per active spherical-harmonic transform,
43-
and `mge_workers` controls concurrent MGE segment tasks. `segment_frames`
44-
remains the scientific temporal segment length and is independent of these
45-
controls.
46+
### Primary API
4647

47-
## Core Exports
48+
The preferred interface is the package root:
4849

49-
The package root exports only the public tracker classes, domain entities, and format functions:
50+
```python
51+
import pystormtracker as pst
52+
```
53+
54+
The root exports exactly these nine names:
5055

51-
- `pst.Tracker` (Protocol)
52-
- `pst.SimpleTracker`
53-
- `pst.HodgesTracker`
54-
- `pst.HealpixTracker`
5556
- `pst.Center`
57+
- `pst.HealpixTracker`
58+
- `pst.HodgesTracker`
59+
- `pst.SimpleTracker`
5660
- `pst.Track`
61+
- `pst.Tracker`
5762
- `pst.Tracks`
5863
- `pst.load_tracks`
5964
- `pst.save_tracks`
6065

61-
Domain value types remain available under `pystormtracker.models`:
66+
`pystormtracker.__version__` remains normally accessible, but is not part of
67+
the root `__all__` compatibility list.
68+
69+
### Advanced supported APIs
6270

63-
- `pystormtracker.models.Center`
64-
- `pystormtracker.models.CenterFrame`
65-
- `pystormtracker.models.SpatialBounds`
66-
- `pystormtracker.models.ProcessingStep`
67-
- `pystormtracker.models.TracksMetadata`
71+
The following package and direct-module APIs are supported when explicitly
72+
documented here or in the linked methodology pages:
6873

69-
## Trackers
74+
- `pystormtracker.models`: domain types `Center`, `DetectionMode`,
75+
`ProcessingStep`, `Projection`, `ResolvedDetectionMode`, `SpatialBounds`,
76+
`Track`, `Tracker`, `Tracks`, and `TracksMetadata`.
77+
- `pystormtracker.io`: generic `DataLoader`, `SUPPORTED_FORMATS`,
78+
`SupportedFormat`, `infer_format`, `load_tracks`, and `save_tracks`.
79+
- `pystormtracker.preprocessing`: `BoundaryTaper`, `DCTFilter`, `SHTFilter`,
80+
`SpectralRegridder`, and `compute_vorticity_divergence`.
81+
- `pystormtracker.metrics`: the high-level metric functions and the explicit
82+
comparison API documented below.
83+
- `pystormtracker.sample.sample_tracks`.
84+
- `pystormtracker.hodges.rsplice.filter_rsplice`.
85+
86+
TRACK-specific `read_track`, `write_track`, and `TrackNumericTime` remain
87+
available from `pystormtracker.io.track` for deliberate advanced use. The
88+
provisional TrackJSON wire structs and encoder remain in
89+
`pystormtracker.io.trackjson`, but are not re-exported by generic
90+
`pystormtracker.io`.
91+
92+
### Implementation modules
93+
94+
Detector, linker, MGE, segment, execution-helper, refinement, CLI-routing,
95+
schema-generation, and TrackJSON wire-structure internals are not a general
96+
compatibility surface. Feature-point refinement is selected through tracker
97+
configuration, for example `feature_refinement="grid"`,
98+
`"quadratic"`, `"spherical_quadratic"`, `"bspline"`, or
99+
`"spherical_bspline"`; the low-level refinement structures remain in their
100+
implementation modules.
101+
102+
Modules not listed here may be importable but are implementation details and
103+
are not part of the supported compatibility surface. This project makes no
104+
semantic-version stability claim for unlisted names while it remains pre-1.0.
105+
106+
## Tracker classes
70107

71108
```{eval-rst}
72109
.. automodule:: pystormtracker.simple.tracker
@@ -82,117 +119,154 @@ Domain value types remain available under `pystormtracker.models`:
82119
:show-inheritance:
83120
```
84121

85-
## Core Models
122+
## Domain models
86123

87-
### Tracks
124+
### Tracks and metadata
88125

89126
```{eval-rst}
90127
.. automodule:: pystormtracker.models.tracks
91-
:members: Track, Tracks
128+
:members: DetectionMode, ProcessingStep, ResolvedDetectionMode, Track, Tracks, TracksMetadata
92129
:show-inheritance:
93130
```
94131

95-
### Storm Centers
132+
### Storm centers
96133

97134
```{eval-rst}
98135
.. automodule:: pystormtracker.models.center
99136
:members: Center
100137
:show-inheritance:
101138
```
102139

103-
## Data Loader
140+
### Geographic domain types
141+
142+
```{eval-rst}
143+
.. automodule:: pystormtracker.models.geo
144+
:members: Projection, SpatialBounds
145+
:show-inheritance:
146+
```
147+
148+
### Tracker protocol
149+
150+
```{eval-rst}
151+
.. automodule:: pystormtracker.models.tracker
152+
:members: Tracker
153+
```
154+
155+
`CenterFrame` is an internal frame-processing transport type. It is not a
156+
public model or part of the Tracker return contract.
157+
158+
## Generic I/O
104159

105160
```{eval-rst}
106161
.. automodule:: pystormtracker.io.data_loader
107162
:members: DataLoader
163+
164+
.. automodule:: pystormtracker.io.format
165+
:members: SUPPORTED_FORMATS, SupportedFormat, infer_format, load_tracks, save_tracks
108166
```
109167

110-
## Preprocessing
168+
Use `load_tracks` and `save_tracks` for ordinary format handling. TrackJSON/1.0
169+
is provisional; its typed wire structures and direct encoder are documented in
170+
the [TrackJSON reference](trackjson.md), not promoted to the generic I/O
171+
namespace.
172+
173+
## Scientific preprocessing
111174

112-
Trackers accept preprocessing options in their constructors: `lmin` and `lmax` request an optional spectral filter when supplied together, while `taper_points` controls spatial tapering independently. `HodgesTracker` accepts `spectral_taper` with source-compatible default `1.0`; `HealpixTracker` owns a separate default of `0.1`. Hodges' default `feature_refinement="bspline"` uses TRACK/SMOOPY-compatible rectangular B-spline refinement with coordinate-space GDFP optimization. The advanced experimental `"spherical_bspline"` option uses a global spherical B-spline with a candidate-local feasible region on eligible periodic latitude-longitude frames. `"quadratic"` and `"spherical_quadratic"` provide local polynomial subgrid refinement, and `"grid"` disables subgrid refinement. `missing_frame_parameters` and `time_step` model known input-time gaps.
175+
Tracker constructors accept preprocessing options: `lmin` and `lmax` request an
176+
optional spectral filter when supplied together, while `taper_points` controls
177+
spatial tapering independently. `HodgesTracker` accepts `spectral_taper` with
178+
source-compatible default `1.0`; `HealpixTracker` owns a separate default of
179+
`0.1`. The Hodges default `feature_refinement="bspline"` uses the
180+
TRACK/SMOOPY-compatible rectangular B-spline path with coordinate-space GDFP
181+
optimization. The advanced experimental `"spherical_bspline"` option uses a
182+
global spherical B-spline with a candidate-local feasible region on eligible
183+
periodic latitude-longitude frames. `"quadratic"` and
184+
`"spherical_quadratic"` provide local polynomial alternatives, and `"grid"`
185+
disables subgrid refinement. `missing_frame_parameters` and `time_step` model
186+
known input-time gaps for Hodges tracking.
113187

114-
### Kinematics (vorticity and divergence)
188+
### Vorticity and divergence
115189

116190
```{eval-rst}
117191
.. automodule:: pystormtracker.preprocessing.kinematics
118-
:members:
192+
:members: compute_vorticity_divergence
119193
```
120194

121-
### Spectral Filtering
195+
### Spectral filtering
122196

123197
```{eval-rst}
124198
.. automodule:: pystormtracker.preprocessing.spectral
125-
:members:
199+
:members: DCTFilter, SHTFilter
126200
```
127201

128202
### Regridding
129203

130204
```{eval-rst}
131205
.. automodule:: pystormtracker.preprocessing.regrid
132-
:members:
206+
:members: SpectralRegridder
133207
```
134208

135-
### Feature Refinement
209+
### Spatial tapering
136210

137211
```{eval-rst}
138-
.. automodule:: pystormtracker.refinement
139-
:members:
212+
.. automodule:: pystormtracker.preprocessing.taper
213+
:members: BoundaryTaper
140214
```
141215

142-
### Spatial Tapering
216+
The HEALPix example uses the supported package import:
143217

144-
```{eval-rst}
145-
.. automodule:: pystormtracker.preprocessing.taper
146-
:members:
218+
```python
219+
from pystormtracker.preprocessing import SpectralRegridder
147220
```
148221

149-
## Post-processing and Analysis
222+
## Metrics and post-processing
150223

151-
### Secondary-variable Sampling
224+
### Secondary-variable sampling
152225

153226
```{eval-rst}
154227
.. automodule:: pystormtracker.sample
155228
:members: sample_tracks
156229
```
157230

158-
### Track Matching
159-
160-
```{eval-rst}
161-
.. automodule:: pystormtracker.metrics.compare
162-
:members: compare_tracks, TrackComparisonConfig, TrackComparison, TrackMatch
163-
```
231+
### Track comparison
164232

165-
### Spherical Weighting Kernels
233+
The comparison result uses `TrackProperties` for lifecycle and intensity
234+
summaries and `IntensityDifference` for pointwise candidate-minus-reference
235+
statistics. These result structures are part of the documented comparison
236+
module, but are not re-exported through `pystormtracker.metrics`.
166237

167238
```{eval-rst}
168-
.. automodule:: pystormtracker.metrics.weighting
169-
:members:
239+
.. automodule:: pystormtracker.metrics.compare
240+
:members: compare_tracks, TrackComparisonConfig, TrackComparison, TrackMatch, TrackProperties, IntensityDifference
170241
```
171242

172-
### Eulerian Track Metrics
243+
### Eulerian metrics
173244

174245
```{eval-rst}
175246
.. automodule:: pystormtracker.metrics.eulerian
176-
:members:
247+
:members: compute_eke, compute_high_wind_index, compute_variance_metric
177248
```
178249

179-
### Lagrangian Track Metrics
250+
### Lagrangian metrics
180251

181252
```{eval-rst}
182253
.. automodule:: pystormtracker.metrics.lagrangian
183254
:members: compute_track_metrics
184255
```
185256

186-
### Hodges Splice Filtering
257+
### CORMAX and CCA cross-validation
187258

188259
```{eval-rst}
189-
.. automodule:: pystormtracker.hodges.rsplice
190-
:members: filter_rsplice
260+
.. automodule:: pystormtracker.metrics.cross_validation
261+
:members: compute_cormax, find_best_cca_truncation, train_cca_model
191262
```
192263

193-
### CORMAX and CCA/PCA Cross-validation
264+
Spherical weighting helpers are implementation details of the scientific metric
265+
workflows and are not documented as standalone convenience APIs.
266+
267+
### Hodges splice filtering
194268

195269
```{eval-rst}
196-
.. automodule:: pystormtracker.metrics.cross_validation
197-
:members:
270+
.. automodule:: pystormtracker.hodges.rsplice
271+
:members: filter_rsplice
198272
```

0 commit comments

Comments
 (0)