sectionate 0.3.3__tar.gz → 0.4.0rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/.github/workflows/ci.yml +11 -1
- sectionate-0.4.0rc1/.github/workflows/publish-to-pypi.yml +44 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/.gitignore +10 -0
- sectionate-0.4.0rc1/.readthedocs.yaml +37 -0
- sectionate-0.4.0rc1/CLAUDE.md +151 -0
- sectionate-0.4.0rc1/PKG-INFO +83 -0
- sectionate-0.4.0rc1/README.md +62 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/ci/environment.yml +1 -0
- sectionate-0.4.0rc1/conda/meta.yaml +54 -0
- sectionate-0.4.0rc1/docs/Makefile +20 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/docs/environment.yml +5 -0
- sectionate-0.4.0rc1/docs/make.bat +35 -0
- sectionate-0.4.0rc1/docs/source/_static/.gitkeep +0 -0
- sectionate-0.4.0rc1/docs/source/_static/custom.css +39 -0
- sectionate-0.4.0rc1/docs/source/_templates/.gitkeep +0 -0
- sectionate-0.4.0rc1/docs/source/conf.py +78 -0
- sectionate-0.4.0rc1/docs/source/index.rst +13 -0
- sectionate-0.4.0rc1/docs/source/installation.rst +44 -0
- sectionate-0.4.0rc1/pyproject.toml +55 -0
- sectionate-0.4.0rc1/sectionate/_version.py +24 -0
- sectionate-0.4.0rc1/sectionate/gridutils.py +1290 -0
- sectionate-0.4.0rc1/sectionate/section.py +982 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/sectionate/tests/test_convergent_transport.py +67 -2
- sectionate-0.4.0rc1/sectionate/tests/test_cube_left_grid.py +616 -0
- sectionate-0.4.0rc1/sectionate/tests/test_ecco_llc90.py +99 -0
- sectionate-0.4.0rc1/sectionate/tests/test_left_grid.py +251 -0
- sectionate-0.4.0rc1/sectionate/tests/test_section.py +193 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/sectionate/tests/test_section_class.py +24 -1
- sectionate-0.4.0rc1/sectionate/tests/test_section_cornercases.py +97 -0
- sectionate-0.4.0rc1/sectionate/tests/test_section_fold.py +113 -0
- sectionate-0.4.0rc1/sectionate/tests/test_section_multitile.py +547 -0
- sectionate-0.4.0rc1/sectionate/tests/test_section_reversibility.py +91 -0
- sectionate-0.4.0rc1/sectionate/tests/test_utils.py +42 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/sectionate/tracers.py +17 -11
- sectionate-0.4.0rc1/sectionate/transports.py +778 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/sectionate/utils.py +6 -1
- sectionate-0.4.0rc1/sectionate/version.py +18 -0
- sectionate-0.3.3/.github/workflows/publish-to-pypi.yml +0 -26
- sectionate-0.3.3/PKG-INFO +0 -44
- sectionate-0.3.3/README.md +0 -23
- sectionate-0.3.3/pyproject.toml +0 -38
- sectionate-0.3.3/sectionate/gridutils.py +0 -95
- sectionate-0.3.3/sectionate/section.py +0 -786
- sectionate-0.3.3/sectionate/tests/test_section.py +0 -92
- sectionate-0.3.3/sectionate/tests/test_section_cornercases.py +0 -63
- sectionate-0.3.3/sectionate/tests/test_utils.py +0 -4
- sectionate-0.3.3/sectionate/transports.py +0 -505
- sectionate-0.3.3/sectionate/version.py +0 -3
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/LICENSE +0 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/binder/environment.yml +0 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/sectionate/__init__.py +0 -0
- {sectionate-0.3.3 → sectionate-0.4.0rc1}/sectionate/catalog/Atlantic_transport_arrays.json +0 -0
|
@@ -26,7 +26,12 @@ jobs:
|
|
|
26
26
|
with:
|
|
27
27
|
access_token: ${{ github.token }}
|
|
28
28
|
- name: Checkout source
|
|
29
|
-
uses: actions/checkout@
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
with:
|
|
31
|
+
# `pip install -e .` resolves the version from the git tag via
|
|
32
|
+
# hatch-vcs; a shallow clone has no tag, so the installed package
|
|
33
|
+
# would report `0.1.devN` instead of the release line.
|
|
34
|
+
fetch-depth: 0
|
|
30
35
|
|
|
31
36
|
- name: Conda setup
|
|
32
37
|
uses: conda-incubator/setup-miniconda@v2
|
|
@@ -40,6 +45,11 @@ jobs:
|
|
|
40
45
|
- name: Set up conda environment
|
|
41
46
|
run: |
|
|
42
47
|
mamba env update -f ci/environment.yml
|
|
48
|
+
# The topology-driven multi-tile section/transport and bipolar north-fold
|
|
49
|
+
# tests need xgcm >= 0.10.1, which introduces the fold boundary
|
|
50
|
+
# (padding={"Y": {"fold": ...}}, formerly xgcm#711), the face_connections
|
|
51
|
+
# halo-padding fix (xgcm#712), and the other_component vector-pad fix
|
|
52
|
+
# (xgcm#749). It is a plain PyPI dependency, pulled in by `pip install -e .`.
|
|
43
53
|
python -m pip install -e .
|
|
44
54
|
- name: Conda list information
|
|
45
55
|
run: |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
with:
|
|
13
|
+
# hatch-vcs derives the version from the git tag, which a shallow clone
|
|
14
|
+
# does not have. Without this the build silently produces a
|
|
15
|
+
# `0.0.0.dev...` artifact instead of the release version.
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.x'
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install build twine
|
|
25
|
+
- name: Build package
|
|
26
|
+
run: python -m build
|
|
27
|
+
# Deriving the version from the tag should make this unfalsifiable, but it
|
|
28
|
+
# is the last point at which a mismatch is cheap to see: the alternative
|
|
29
|
+
# symptom is a 400 from PyPI at the very end of the release, and only when
|
|
30
|
+
# that version already exists.
|
|
31
|
+
- name: Built version must match the release tag
|
|
32
|
+
run: |
|
|
33
|
+
built=$(ls dist/*.tar.gz | sed -E 's|.*/sectionate-(.*)\.tar\.gz|\1|')
|
|
34
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
35
|
+
echo "tag=$tag built=$built"
|
|
36
|
+
if [ "$built" != "$tag" ]; then
|
|
37
|
+
echo "::error::Release tag $GITHUB_REF_NAME implies version '$tag', but the build produced '$built'."
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
- name: Publish package
|
|
41
|
+
env:
|
|
42
|
+
TWINE_USERNAME: __token__
|
|
43
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
44
|
+
run: twine upload dist/*
|
|
@@ -102,3 +102,13 @@ venv.bak/
|
|
|
102
102
|
|
|
103
103
|
# mypy
|
|
104
104
|
.mypy_cache/
|
|
105
|
+
|
|
106
|
+
# Local example data cache (fetched from Zenodo / PO.DAAC at runtime)
|
|
107
|
+
data/*.nc
|
|
108
|
+
|
|
109
|
+
# Build artifacts and OS cruft
|
|
110
|
+
*.tar.gz
|
|
111
|
+
.DS_Store
|
|
112
|
+
|
|
113
|
+
# Version file generated from the git tag by hatch-vcs at build time.
|
|
114
|
+
sectionate/_version.py
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Set the OS, Python version, and other tools you might need
|
|
8
|
+
build:
|
|
9
|
+
os: ubuntu-24.04
|
|
10
|
+
tools:
|
|
11
|
+
python: "miniforge3-latest"
|
|
12
|
+
jobs:
|
|
13
|
+
post_checkout:
|
|
14
|
+
# RTD clones shallow, but installing sectionate resolves its version from
|
|
15
|
+
# the git tag via hatch-vcs, and the docs are titled with it
|
|
16
|
+
# (`docs/source/conf.py` reads it from the installed metadata). Without
|
|
17
|
+
# the tag they would say `.devN`. Tolerate failure: an already-complete
|
|
18
|
+
# clone makes `--unshallow` an error, which must not fail the build.
|
|
19
|
+
- git fetch --unshallow || true
|
|
20
|
+
- git fetch --tags || true
|
|
21
|
+
|
|
22
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
23
|
+
sphinx:
|
|
24
|
+
builder: html
|
|
25
|
+
configuration: docs/source/conf.py
|
|
26
|
+
fail_on_warning: true
|
|
27
|
+
|
|
28
|
+
# Don't build any extra output files
|
|
29
|
+
formats: []
|
|
30
|
+
|
|
31
|
+
python:
|
|
32
|
+
install:
|
|
33
|
+
- method: pip
|
|
34
|
+
path: .
|
|
35
|
+
|
|
36
|
+
conda:
|
|
37
|
+
environment: docs/environment.yml
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Sectionate is a Python package for sampling grid-consistent hydrographic sections from structured ocean model outputs (e.g. MOM6). It traces paths along C-grid velocity faces between geographic waypoints and computes transports/tracer values along those sections. Only structured grids are supported.
|
|
8
|
+
|
|
9
|
+
## Development Setup
|
|
10
|
+
|
|
11
|
+
**One conda environment per branch/worktree, named `docs_env_sectionate_<branch-or-worktree-name>`.**
|
|
12
|
+
Branches diverge in their dependencies — the xgcm floor in particular — so a single
|
|
13
|
+
shared environment silently tests the wrong versions. Create it from
|
|
14
|
+
`docs/environment.yml`, overriding the baked-in `name:` with `-n`:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
ENV="docs_env_sectionate_$(git rev-parse --abbrev-ref HEAD)"
|
|
18
|
+
conda env create -f docs/environment.yml -n "$ENV"
|
|
19
|
+
conda activate "$ENV"
|
|
20
|
+
pip install -e . # resolves the branch's own runtime deps from pyproject.toml
|
|
21
|
+
python -m ipykernel install --user --name "$ENV" --display-name "$ENV"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`docs/environment.yml` pins none of the runtime dependencies; `pip install -e .` is
|
|
25
|
+
what resolves them, so install in that order and re-run it after any dependency
|
|
26
|
+
change in `pyproject.toml`. Reuse the env across runs on the same branch; remove it
|
|
27
|
+
with `conda env remove -n "$ENV"` once the branch or worktree is gone.
|
|
28
|
+
(`ci/environment.yml` is the minimal CI environment — pytest only, no plotting or
|
|
29
|
+
notebook stack. It is not sufficient for the notebooks.)
|
|
30
|
+
|
|
31
|
+
The environment must carry **xgcm >= 0.10.1**, which
|
|
32
|
+
introduces the bipolar north fold (`padding={"Y": {"fold": ...}}`, formerly #711),
|
|
33
|
+
the face-connection padding fix (#712), and the bare-`DataArray` `other_component`
|
|
34
|
+
vector-pad fix (#749). It is a plain PyPI release, so `pip install -e .` pulls it in
|
|
35
|
+
automatically (sectionate requires `xgcm>=0.10.1`). The ECCO example (notebook 5)
|
|
36
|
+
pulls its data subset from Zenodo (concept DOI `10.5281/zenodo.21051424`) via stdlib
|
|
37
|
+
`urllib` with MD5 checks — no `earthaccess`/Earthdata login needed.
|
|
38
|
+
|
|
39
|
+
A correctly set up environment runs the full suite with **0 skips**. Skips mean one of
|
|
40
|
+
two things: fold and multi-tile tests `skip` on `xgcm < 0.10.1`, and the ECCO LLC90 and
|
|
41
|
+
MOM6-fold tests `skip` when their example data is absent from `data/`. In a fresh
|
|
42
|
+
worktree the latter is the usual cause — `data/` holds ~1.4 GB of downloaded input that
|
|
43
|
+
each checkout otherwise re-fetches. Symlink it from a checkout that already has it
|
|
44
|
+
rather than downloading again (`data/*.nc` is gitignored, but `MOM5_global_example_grid.nc`
|
|
45
|
+
is tracked, so link the individual files, not the directory):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cd data && for f in /path/to/other/checkout/data/*.nc; do
|
|
49
|
+
b=$(basename "$f"); [ -e "$b" ] || ln -s "$f" "$b"
|
|
50
|
+
done
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
- **Run all tests:** `pytest`
|
|
56
|
+
- **Run a single test:** `pytest sectionate/tests/test_section.py::test_find_closest_grid_point`
|
|
57
|
+
- **Build docs:** `cd docs && make html` (requires `docs/environment.yml` environment)
|
|
58
|
+
|
|
59
|
+
## Definition of Done (always, before committing or pushing)
|
|
60
|
+
|
|
61
|
+
Before committing **or pushing** any change to this repository, always do all of the
|
|
62
|
+
following — use parallel agents where it is faster. Both of the first two steps, every
|
|
63
|
+
time: not one or the other, and not only the notebooks that look related to the change.
|
|
64
|
+
A change that passes `pytest` but breaks a notebook is still a broken change, because
|
|
65
|
+
the notebooks are the rendered documentation.
|
|
66
|
+
|
|
67
|
+
Run them in this branch's own `docs_env_sectionate_<branch-or-worktree-name>` environment
|
|
68
|
+
(see *Development Setup*), not in whatever env happens to be active.
|
|
69
|
+
|
|
70
|
+
1. **Run the full test suite** (`pytest`) and confirm it passes with **0 skips**.
|
|
71
|
+
2. **Re-execute the example notebooks** in `examples/` and confirm they run cleanly:
|
|
72
|
+
```bash
|
|
73
|
+
cd examples && jupyter nbconvert --to notebook --execute --inplace \
|
|
74
|
+
--ExecutePreprocessor.timeout=1800 \
|
|
75
|
+
--ExecutePreprocessor.kernel_name=python3 *.ipynb
|
|
76
|
+
```
|
|
77
|
+
Run from `examples/` — the notebooks resolve data paths relative to it. `--inplace`
|
|
78
|
+
refreshes the committed outputs, which is intended; review the resulting diff.
|
|
79
|
+
`kernel_name=python3` uses the active env's kernel, so the per-branch env name need
|
|
80
|
+
not match the `kernelspec` recorded in each notebook.
|
|
81
|
+
3. **Scan the repo for inconsistencies / outdated information** introduced by the change —
|
|
82
|
+
including docstrings, `README.md`, files under `docs/`, the example notebooks, and this
|
|
83
|
+
`CLAUDE.md` — and update them so docs and code stay in sync.
|
|
84
|
+
|
|
85
|
+
## Keeping pull requests in sync
|
|
86
|
+
|
|
87
|
+
When pushing a new commit to a branch that already has an open PR, also update that PR's
|
|
88
|
+
top-comment description so it stays consistent with the most recent commit:
|
|
89
|
+
|
|
90
|
+
- Revise the summary / "Changes" prose to reflect what the latest commit actually did.
|
|
91
|
+
- Update any task/status checklist — check off completed items (`- [ ]` → `- [x]`) and add
|
|
92
|
+
new ones as needed.
|
|
93
|
+
- Edit it in place with `gh pr edit <number> --repo <owner>/<repo> --body-file <file>` (find
|
|
94
|
+
the PR for the current branch with `gh pr view --json number,url`).
|
|
95
|
+
|
|
96
|
+
## AI Usage Policy
|
|
97
|
+
|
|
98
|
+
AI-assisted contributions to sectionate are welcome, but the person running the AI is
|
|
99
|
+
responsible for every change. This project follows the
|
|
100
|
+
[xgcm AI Usage Policy](https://github.com/hdrake/xgcm/blob/add-Claude.md/docs/contributor_guide.md),
|
|
101
|
+
which in turn adapts [xarray's](https://docs.xarray.dev/en/stable/contribute/ai-policy.html).
|
|
102
|
+
It applies to every change regardless of whether it was written by hand, with AI
|
|
103
|
+
assistance, or generated entirely by an AI tool. The essentials:
|
|
104
|
+
|
|
105
|
+
- **You own the diff.** Before opening or updating a PR, you must have read and understood
|
|
106
|
+
every line and be able to explain why each change is correct — the same bar as a
|
|
107
|
+
hand-written PR. Keep changes small, single-purpose, and free of unrelated edits.
|
|
108
|
+
- **Disclose AI assistance openly.** Add a `Co-Authored-By:` trailer to AI-assisted commits
|
|
109
|
+
and note on any PR or comment that was drafted with AI.
|
|
110
|
+
- **Communicate in your own words.** PR descriptions, issue comments, and review responses
|
|
111
|
+
must be your own; do not paste AI-generated text as a comment. Using AI to polish your own
|
|
112
|
+
writing (grammar, phrasing) is fine as long as it introduces no inaccuracies.
|
|
113
|
+
- **Every code change ships with tests** and, per the *Definition of Done* above, a green
|
|
114
|
+
suite and re-executed notebooks.
|
|
115
|
+
- **Discuss large AI-assisted contributions first.** For a substantial refactor, new
|
|
116
|
+
subsystem, or migration, open an issue to agree scope before generating the diff — a large
|
|
117
|
+
diff is fast to produce and slow to review.
|
|
118
|
+
|
|
119
|
+
## Architecture
|
|
120
|
+
|
|
121
|
+
The package is organized around a pipeline: define sections → map to grid → compute transports/tracers.
|
|
122
|
+
|
|
123
|
+
### Core Modules
|
|
124
|
+
|
|
125
|
+
- **`section.py`** — Section definition and grid path algorithms. `Section` holds named waypoint coordinates; `GriddedSection` extends it with grid index information. `grid_section()` is the main entry point that maps geographic waypoints to grid vorticity-point indices `(i_c, j_c)` by walking the grid between waypoints along the `curve` requested (`"great circle"`, the default geodesic, or `"latitude circle"`); each segment must span less than 180°. The walk is deterministic and direction-independent: it admits neighbors strictly closer to the endpoint plus any seam twin of the current cell (so periodic/fold-seam crossings do not depend on floating-point rounding), and breaks ties by index. Grid topology is inferred entirely from `xgcm.Grid` metadata — each axis' `boundary` (periodic wrap, fill/extend wall, or a single-tile bipolar north fold `{"Y": {"fold": ...}}`) and `face_connections` for multi-tile grids — so there is no `topology` keyword. The pathfinder consumes topology-aware neighbor maps built by `gridutils.build_neighbor_maps`.
|
|
126
|
+
|
|
127
|
+
- **`transports.py`** — Transport computation along sections. `uvindices_from_qindices()` converts vorticity-point indices to U/V velocity-point indices using a per-position corner offset (`gridutils.corner_offset`) covering all three C-grid staggerings: 'outer', 'right', and 'left' (see "Corner staggering" below). `convergent_transport()` is the main function: it lazily computes signed normal transports with configurable orientation (positive inward to the polygon defined by the section).
|
|
128
|
+
|
|
129
|
+
- **`tracers.py`** — `extract_tracer()` interpolates tracer data to U/V points along a section path for cross-section plotting.
|
|
130
|
+
|
|
131
|
+
- **`gridutils.py`** — Grid introspection utilities: `corner_position()` returns the shared vorticity corner position (`"outer"`, `"right"`, or `"left"`) and `corner_offset()` the corresponding velocity index shift used throughout transports/tracers; `check_outer()` is a thin wrapper (True iff `"outer"`). (Package source names positions only by these xgcm labels; their correspondence to MOM6/MITgcm/ECCO conventions is documented under "Corner staggering" below and in the example notebooks.) `coord_dict()` and `get_geo_corners()` extract coordinate/dimension names from `xgcm.Grid` metadata; `build_neighbor_maps()` builds the topology-aware neighbor maps the pathfinder consumes. For single-tile grids these come from xgcm halo padding; for every multi-tile grid they are projected from **`outer_topology(grid)`** (cached `_OuterTopology`), which reconstructs each face's full 'outer' (shared-corner) lattice, resolves every extended corner slot to the native corner storing that physical point (topological matching of the surrounding tracer cells — including a diagonal-cell recovery for normal-seam face corners and a 3-cell fingerprint for 3-tile junctions with native storage — with a small coordinate fallback only for the polar-cut corners no cell fingerprint can determine), and merges slots into physical corner *nodes* — so rotated/reversed seams, cube-vertex/tile junctions, boundary folds (e.g. LLC's south rows), and the polar grid cut are ordinary graph nodes, each resolved to its canonical native `(face, j, i)` (a physical corner may be stored once, on no face, or more than once). `_OuterTopology.padded_transports(u, v)` extends native transports to the outer lattice by reading each missing edge slot's *stored* twin through the node graph — a topology-exact, xgcm-independent alternative to `xgcm.pad(..., other_component=...)` (cell convergence built from `padded_transports` sums to exactly zero globally on ECCO LLC90). Even a correct vector pad (xgcm#749 fixes the bare-DataArray path; the dict form was always exact) cannot supply a halo for edges stored on *no* face, so `padded_transports` remains the exact path on grids with cuts/caps. Points stored on **no** face (a cubed-sphere stores `6N²` corners for `6N²+2` points; LLC90's 4th Arctic-cap vertex; the unstored lip of its 65°E/115°W polar grid cut under Antarctica) become edge-less nodes: sections and traced boundaries cannot pass through them and raise an error rather than return invalid indices.
|
|
132
|
+
|
|
133
|
+
- **`utils.py`** — Section catalog I/O. Sections can be loaded by name from JSON catalog files in `sectionate/catalog/`. Also provides `save_gridded_section()`/`load_gridded_section()` for persisting gridded sections.
|
|
134
|
+
|
|
135
|
+
### Key Concepts
|
|
136
|
+
|
|
137
|
+
- **Vorticity points (q-points):** Sections are defined as paths through vorticity-point indices `(i_c, j_c)`. Consecutive q-points define velocity faces (either U or V).
|
|
138
|
+
- **Corner staggering (three positions):** Vorticity sits at one of three xgcm positions: `"outer"` (MOM6 symmetric, M+1×N+1), `"right"` (MOM6 non-symmetric, M×N), or `"left"` (MITgcm/ECCO, incl. the lat-lon-cap, M×N). All three are native; they differ only by a per-position velocity index offset (`gridutils.corner_offset`: outer→0, right→+1, left→0). `"left"` indexes like `"outer"`; it differs only in array length and in that the *high* corner row/column is absent (so a section exactly on the north/east domain wall clips one row inside).
|
|
139
|
+
- **Sign conventions:** For a *closed* section, `convergent_transport()` determines orientation (clockwise/counterclockwise) using stereographic projection and signed polygon area, then applies sign corrections so positive transport means "inward" (toward the enclosed polygon). For an *open* section there is no enclosing polygon, so `positive_in` is undefined; it instead uses the **left-of-transect** convention — `positive_in=True` makes positive transport point to the left of the section as traversed from the first to the last waypoint — and emits a `UserWarning`. `is_section_counterclockwise()` is only consulted in the closed case.
|
|
140
|
+
- **xgcm.Grid dependency:** The package relies heavily on `xgcm.Grid` for grid metadata (axis boundaries, coordinate positions, dataset access via `grid._ds`).
|
|
141
|
+
|
|
142
|
+
## Version
|
|
143
|
+
|
|
144
|
+
**The git tag is the version.** There is no version string checked into the tree:
|
|
145
|
+
`hatch-vcs` derives it from the tag at build time and writes the gitignored
|
|
146
|
+
`sectionate/_version.py`, which ships inside the sdist and wheel. `sectionate/version.py`
|
|
147
|
+
is only a shim over that generated file — never add a version literal back to it. A
|
|
148
|
+
`0.0.0+unknown` from it means the package was imported without being built or installed,
|
|
149
|
+
not that a number is missing. Any checkout that installs the package needs its tags: a
|
|
150
|
+
shallow clone resolves a `.devN` version instead of the release line, which is why CI and
|
|
151
|
+
Read the Docs both fetch with full depth. See the Releasing section of `README.md`.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sectionate
|
|
3
|
+
Version: 0.4.0rc1
|
|
4
|
+
Summary: A package to sample grid-consistent sections from ocean model outputs
|
|
5
|
+
Project-URL: Homepage, https://github.com/MOM6-community/sectionate
|
|
6
|
+
Project-URL: Bugs/Issues/Features, https://github.com/MOM6-community/sectionate/issues
|
|
7
|
+
Project-URL: Sibling package, https://github.com/hdrake/regionate
|
|
8
|
+
Author-email: Raphael Dussin <raphael.dussin@gmail.com>, "Henri F. Drake" <hfdrake@uci.edu>
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Requires-Dist: dask
|
|
15
|
+
Requires-Dist: numba
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: xarray
|
|
19
|
+
Requires-Dist: xgcm>=0.10.1
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# sectionate
|
|
23
|
+
A package to sample grid-consistent sections from ocean model outputs
|
|
24
|
+
|
|
25
|
+
(Currently only supports structured grids.)
|
|
26
|
+
|
|
27
|
+
[](https://badge.fury.io/py/sectionate)
|
|
28
|
+
[](https://anaconda.org/conda-forge/sectionate)
|
|
29
|
+
[](https://sectionate.readthedocs.io/en/latest/)
|
|
30
|
+
[](https://github.com/MOM6-Community/sectionate)
|
|
31
|
+
|
|
32
|
+
Quick Start Guide
|
|
33
|
+
-----------------
|
|
34
|
+
|
|
35
|
+
**For users: minimal installation within an existing environment**
|
|
36
|
+
```bash
|
|
37
|
+
conda install -c conda-forge sectionate
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**For developers: installing dependencies from scratch using `conda`**
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/MOM6-community/sectionate.git
|
|
43
|
+
cd sectionate
|
|
44
|
+
conda env create -f docs/environment.yml
|
|
45
|
+
conda activate docs_env_sectionate
|
|
46
|
+
pip install -e .
|
|
47
|
+
python -m ipykernel install --user --name docs_env_sectionate --display-name "docs_env_sectionate"
|
|
48
|
+
jupyter-lab
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Releasing
|
|
52
|
+
---------
|
|
53
|
+
|
|
54
|
+
**The git tag is the version.** `sectionate` has no version string checked into
|
|
55
|
+
the source tree: `hatch-vcs` derives it from the tag at build time and writes
|
|
56
|
+
`sectionate/_version.py` (gitignored, but shipped inside the sdist and wheel).
|
|
57
|
+
To cut a release you tag; there is no file to bump and nothing to keep in sync.
|
|
58
|
+
|
|
59
|
+
1. Make sure `master` is green and has everything you want in the release.
|
|
60
|
+
2. **Publish a GitHub Release** whose tag is `vX.Y.Z`, targeting the commit you
|
|
61
|
+
want to ship:
|
|
62
|
+
```bash
|
|
63
|
+
gh release create vX.Y.Z --target "$(git rev-parse origin/master)" \
|
|
64
|
+
--title vX.Y.Z --generate-notes
|
|
65
|
+
```
|
|
66
|
+
Publishing it (not merely pushing a tag) is what fires the workflow. Target
|
|
67
|
+
the commit you actually want: a tag placed *before* the commit you meant to
|
|
68
|
+
release builds the previous version, and PyPI rejects it as a duplicate.
|
|
69
|
+
3. The **Publish to PyPI** workflow builds from that tag and uploads. It checks
|
|
70
|
+
out with `fetch-depth: 0` so the tag is visible to `hatch-vcs`, and asserts
|
|
71
|
+
that the built version matches the tag before publishing.
|
|
72
|
+
4. Verify: <https://pypi.org/project/sectionate/>.
|
|
73
|
+
5. conda-forge builds from the PyPI sdist and lags by design; the autotick bot
|
|
74
|
+
opens the version-bump PR. Its recipe must list `hatch-vcs` alongside
|
|
75
|
+
`hatchling` in `host`, since it builds with `--no-build-isolation`.
|
|
76
|
+
|
|
77
|
+
Two things follow from the tag being the version. Never add a version literal
|
|
78
|
+
back to the tree — `sectionate/version.py` is a shim over the generated file, and
|
|
79
|
+
a `0.0.0+unknown` from it means the package was imported without being built or
|
|
80
|
+
installed, not that a number is missing. And any checkout that installs the
|
|
81
|
+
package needs its tags: a shallow clone, or a fork that never fetched them,
|
|
82
|
+
resolves a `.devN` version instead of the release line. That is why CI checks out
|
|
83
|
+
with `fetch-depth: 0` and Read the Docs unshallows in `post_checkout`.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# sectionate
|
|
2
|
+
A package to sample grid-consistent sections from ocean model outputs
|
|
3
|
+
|
|
4
|
+
(Currently only supports structured grids.)
|
|
5
|
+
|
|
6
|
+
[](https://badge.fury.io/py/sectionate)
|
|
7
|
+
[](https://anaconda.org/conda-forge/sectionate)
|
|
8
|
+
[](https://sectionate.readthedocs.io/en/latest/)
|
|
9
|
+
[](https://github.com/MOM6-Community/sectionate)
|
|
10
|
+
|
|
11
|
+
Quick Start Guide
|
|
12
|
+
-----------------
|
|
13
|
+
|
|
14
|
+
**For users: minimal installation within an existing environment**
|
|
15
|
+
```bash
|
|
16
|
+
conda install -c conda-forge sectionate
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**For developers: installing dependencies from scratch using `conda`**
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/MOM6-community/sectionate.git
|
|
22
|
+
cd sectionate
|
|
23
|
+
conda env create -f docs/environment.yml
|
|
24
|
+
conda activate docs_env_sectionate
|
|
25
|
+
pip install -e .
|
|
26
|
+
python -m ipykernel install --user --name docs_env_sectionate --display-name "docs_env_sectionate"
|
|
27
|
+
jupyter-lab
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Releasing
|
|
31
|
+
---------
|
|
32
|
+
|
|
33
|
+
**The git tag is the version.** `sectionate` has no version string checked into
|
|
34
|
+
the source tree: `hatch-vcs` derives it from the tag at build time and writes
|
|
35
|
+
`sectionate/_version.py` (gitignored, but shipped inside the sdist and wheel).
|
|
36
|
+
To cut a release you tag; there is no file to bump and nothing to keep in sync.
|
|
37
|
+
|
|
38
|
+
1. Make sure `master` is green and has everything you want in the release.
|
|
39
|
+
2. **Publish a GitHub Release** whose tag is `vX.Y.Z`, targeting the commit you
|
|
40
|
+
want to ship:
|
|
41
|
+
```bash
|
|
42
|
+
gh release create vX.Y.Z --target "$(git rev-parse origin/master)" \
|
|
43
|
+
--title vX.Y.Z --generate-notes
|
|
44
|
+
```
|
|
45
|
+
Publishing it (not merely pushing a tag) is what fires the workflow. Target
|
|
46
|
+
the commit you actually want: a tag placed *before* the commit you meant to
|
|
47
|
+
release builds the previous version, and PyPI rejects it as a duplicate.
|
|
48
|
+
3. The **Publish to PyPI** workflow builds from that tag and uploads. It checks
|
|
49
|
+
out with `fetch-depth: 0` so the tag is visible to `hatch-vcs`, and asserts
|
|
50
|
+
that the built version matches the tag before publishing.
|
|
51
|
+
4. Verify: <https://pypi.org/project/sectionate/>.
|
|
52
|
+
5. conda-forge builds from the PyPI sdist and lags by design; the autotick bot
|
|
53
|
+
opens the version-bump PR. Its recipe must list `hatch-vcs` alongside
|
|
54
|
+
`hatchling` in `host`, since it builds with `--no-build-isolation`.
|
|
55
|
+
|
|
56
|
+
Two things follow from the tag being the version. Never add a version literal
|
|
57
|
+
back to the tree — `sectionate/version.py` is a shim over the generated file, and
|
|
58
|
+
a `0.0.0+unknown` from it means the package was imported without being built or
|
|
59
|
+
installed, not that a number is missing. And any checkout that installs the
|
|
60
|
+
package needs its tags: a shallow clone, or a fork that never fetched them,
|
|
61
|
+
resolves a `.devN` version instead of the release line. That is why CI checks out
|
|
62
|
+
with `fetch-depth: 0` and Read the Docs unshallows in `post_checkout`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{% set name = "sectionate" %}
|
|
2
|
+
{% set version = "0.3.3" %}
|
|
3
|
+
{% set python_min = "3.11" %}
|
|
4
|
+
|
|
5
|
+
package:
|
|
6
|
+
name: {{ name|lower }}
|
|
7
|
+
version: {{ version }}
|
|
8
|
+
|
|
9
|
+
source:
|
|
10
|
+
url: https://pypi.org/packages/source/s/sectionate/sectionate-{{ version }}.tar.gz
|
|
11
|
+
sha256: b855b091e0c5ac56ab09ec96822ad46ee2ec89bf3b6b3aecb53cbe16dbc36ecb
|
|
12
|
+
|
|
13
|
+
build:
|
|
14
|
+
noarch: python
|
|
15
|
+
number: 0
|
|
16
|
+
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
|
|
17
|
+
|
|
18
|
+
requirements:
|
|
19
|
+
host:
|
|
20
|
+
- python {{ python_min }}
|
|
21
|
+
- pip
|
|
22
|
+
- hatchling
|
|
23
|
+
# The build backend resolves the version through hatch-vcs. The build above
|
|
24
|
+
# is `--no-build-isolation`, so it has to be installed here or the wheel
|
|
25
|
+
# build fails outright; the sdist carries the generated `_version.py`, so
|
|
26
|
+
# git itself is not needed.
|
|
27
|
+
- hatch-vcs
|
|
28
|
+
run:
|
|
29
|
+
- python >={{ python_min }}
|
|
30
|
+
- dask
|
|
31
|
+
- numba
|
|
32
|
+
- numpy
|
|
33
|
+
- scipy
|
|
34
|
+
- xarray
|
|
35
|
+
- xgcm >=0.10.1
|
|
36
|
+
|
|
37
|
+
test:
|
|
38
|
+
requires:
|
|
39
|
+
- python {{ python_min }}
|
|
40
|
+
- pip
|
|
41
|
+
imports:
|
|
42
|
+
- sectionate
|
|
43
|
+
commands:
|
|
44
|
+
- pip check
|
|
45
|
+
|
|
46
|
+
about:
|
|
47
|
+
home: https://github.com/MOM6-community/sectionate
|
|
48
|
+
summary: A package to sample grid-consistent sections from ocean model outputs
|
|
49
|
+
license: GPL-3.0-only
|
|
50
|
+
license_file: LICENSE
|
|
51
|
+
|
|
52
|
+
extra:
|
|
53
|
+
recipe-maintainers:
|
|
54
|
+
- hdrake
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* Responsive layout widening for Alabaster
|
|
2
|
+
- On small screens: use full width (with padding)
|
|
3
|
+
- On typical laptops: ~1100–1250px content area
|
|
4
|
+
- On big screens: cap so lines don't get absurdly long
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
div.document {
|
|
8
|
+
/* Total doc block width (sidebar + content) */
|
|
9
|
+
width: min(96vw, 1400px);
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Keep the main content comfortable: cap line length */
|
|
14
|
+
div.body {
|
|
15
|
+
/* body width within the document area */
|
|
16
|
+
max-width: 900px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Give the sidebar a stable width; let it wrap below on small screens */
|
|
20
|
+
div.sphinxsidebar {
|
|
21
|
+
width: 270px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* On narrower screens, don't force sidebar + body side-by-side */
|
|
25
|
+
@media (max-width: 900px) {
|
|
26
|
+
div.document {
|
|
27
|
+
width: 96vw;
|
|
28
|
+
}
|
|
29
|
+
div.sphinxsidebar {
|
|
30
|
+
float: none;
|
|
31
|
+
width: auto;
|
|
32
|
+
}
|
|
33
|
+
div.bodywrapper {
|
|
34
|
+
margin: 0;
|
|
35
|
+
}
|
|
36
|
+
div.body {
|
|
37
|
+
max-width: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
File without changes
|