bathy 0.2.0__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.
- bathy-0.2.0/LICENSE +15 -0
- bathy-0.2.0/PKG-INFO +188 -0
- bathy-0.2.0/README.md +132 -0
- bathy-0.2.0/pyproject.toml +90 -0
- bathy-0.2.0/src/bathy/__init__.py +145 -0
- bathy-0.2.0/src/bathy/__main__.py +46 -0
- bathy-0.2.0/src/bathy/analysis.py +655 -0
- bathy-0.2.0/src/bathy/datasets.py +37 -0
- bathy-0.2.0/src/bathy/draw.py +714 -0
- bathy-0.2.0/src/bathy/io.py +599 -0
- bathy-0.2.0/src/bathy/plot.py +963 -0
- bathy-0.2.0/src/bathy/profile.py +1182 -0
- bathy-0.2.0/src/bathy/profile_plot.py +570 -0
- bathy-0.2.0/src/bathy/py.typed +0 -0
- bathy-0.2.0/src/bathy/utils.py +64 -0
bathy-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Euan Soutter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
7
|
+
furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
12
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
14
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
15
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
bathy-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: bathy
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Lightweight Python package for exploring bathymetry data.
|
|
5
|
+
Keywords: bathymetry,geomorphology,oceanography
|
|
6
|
+
Author: eslrgs
|
|
7
|
+
Author-email: eslrgs <euan-soutter@hotmail.co.uk>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2025 Euan Soutter
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
Classifier: Development Status :: 3 - Alpha
|
|
24
|
+
Classifier: Intended Audience :: Science/Research
|
|
25
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
26
|
+
Classifier: Programming Language :: Python :: 3
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
29
|
+
Classifier: Topic :: Scientific/Engineering
|
|
30
|
+
Requires-Dist: xarray>=2024.1.0
|
|
31
|
+
Requires-Dist: netcdf4>=1.6.0
|
|
32
|
+
Requires-Dist: numpy>=1.24.0
|
|
33
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
34
|
+
Requires-Dist: scipy>=1.11.0
|
|
35
|
+
Requires-Dist: geographiclib>=2.0
|
|
36
|
+
Requires-Dist: geopandas>=0.14.0
|
|
37
|
+
Requires-Dist: pydap>=3.5.8
|
|
38
|
+
Requires-Dist: cmocean>=4.0.0
|
|
39
|
+
Requires-Dist: rioxarray>=0.15.0
|
|
40
|
+
Requires-Dist: polars>=1.0.0
|
|
41
|
+
Requires-Dist: tqdm>=4.66.0
|
|
42
|
+
Requires-Dist: pooch>=1.7.0
|
|
43
|
+
Requires-Dist: owslib>=0.31.0
|
|
44
|
+
Requires-Dist: folium>=0.17.0
|
|
45
|
+
Requires-Dist: pyqt6>=6.5.0 ; extra == 'draw'
|
|
46
|
+
Requires-Dist: jupyter>=1.0.0 ; extra == 'notebook'
|
|
47
|
+
Requires-Dist: ipykernel>=6.0.0 ; extra == 'notebook'
|
|
48
|
+
Requires-Python: >=3.12
|
|
49
|
+
Project-URL: Homepage, https://github.com/eslrgs/bathy
|
|
50
|
+
Project-URL: Repository, https://github.com/eslrgs/bathy
|
|
51
|
+
Project-URL: Documentation, https://eslrgs.github.io/bathy/
|
|
52
|
+
Project-URL: Issues, https://github.com/eslrgs/bathy/issues
|
|
53
|
+
Provides-Extra: draw
|
|
54
|
+
Provides-Extra: notebook
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
|
|
57
|
+
# 🌐 bathy
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
[](https://github.com/eslrgs/bathy/actions/workflows/ci.yml)
|
|
61
|
+
[](https://eslrgs.github.io/bathy)
|
|
62
|
+

|
|
63
|
+
[](LICENSE)
|
|
64
|
+
|
|
65
|
+
`bathy` — from Greek *βαθύς* (bathýs), "deep" — bathymetric analysis and visualisation in Python.
|
|
66
|
+
|
|
67
|
+
**[Documentation](https://eslrgs.github.io/bathy)** · [Installation](#installation) · [Features](#features) · [Examples](#examples)
|
|
68
|
+
|
|
69
|
+
## Motivation
|
|
70
|
+
|
|
71
|
+
I found creating bathymetric plots and profiles in Python surprisingly difficult. `bathy` provides a simple, high-level interface for loading, analysing, and visualising bathymetry data, so you can go from raw grid to reproducible quantitative analysis to finished figure with minimal effort.
|
|
72
|
+
|
|
73
|
+
## Basic usage
|
|
74
|
+
|
|
75
|
+
### Load data
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import bathy
|
|
79
|
+
|
|
80
|
+
# Load from file
|
|
81
|
+
data = bathy.load_bathymetry("GEBCO_2025.nc", lon_range=(-10, 0), lat_range=(50, 60))
|
|
82
|
+
|
|
83
|
+
# Or download GEBCO data via OPeNDAP
|
|
84
|
+
data = bathy.load_gebco_opendap(lon_range=(-10, 0), lat_range=(50, 60))
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Visualise
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
bathy.plot_bathy(data)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
<p align="center">
|
|
94
|
+
<img src="docs/assets/images/plot_bathy.png" width="600" alt="Bathymetry">
|
|
95
|
+
</p>
|
|
96
|
+
|
|
97
|
+
### Analysis overview
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
bathy.plot_overview(data)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
<p align="center">
|
|
104
|
+
<img src="docs/assets/images/plot_overview.png" width="600" alt="Overview">
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
### Profiles and canyon analysis
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
prof = bathy.extract_profile(data, (-11.3, 48.7), (-7.3, 47.2), name="Along-slope")
|
|
111
|
+
bathy.plot_profile(prof, show_map=True, bathymetry_data=data)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
<p align="center">
|
|
115
|
+
<img src="docs/assets/images/plot_profile.png" width="600" alt="Profile">
|
|
116
|
+
</p>
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
canyons = bathy.get_canyons(prof, prominence=100)
|
|
120
|
+
bathy.plot_canyons(prof, canyons)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
<p align="center">
|
|
124
|
+
<img src="docs/assets/images/plot_canyons.png" width="600" alt="Canyons">
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
## Installation
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install bathy
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or with uv:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
uv add bathy
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Features
|
|
140
|
+
|
|
141
|
+
| Category | Description |
|
|
142
|
+
|---|---|
|
|
143
|
+
| **IO** | Load from local files (NetCDF, GeoTIFF), GEBCO OPeNDAP, or EMODnet WCS. Export to GeoTIFF. 28 preset regions included. |
|
|
144
|
+
| **Analysis** | Slope, aspect, curvature, rugosity, BPI, geomorphons, contours, smoothing, hypsometric analysis |
|
|
145
|
+
| **Plotting** | Publication-ready bathymetry, hillshade, slope, aspect, overview, 3D surface, depth zones, histograms, interactive maps |
|
|
146
|
+
| **Profiles** | Extract profiles between points, generate cross-sections, load from file or GeoDataFrame |
|
|
147
|
+
| **Profile analysis** | Statistics, gradient, concavity, knickpoints, canyon detection, comparison across profiles |
|
|
148
|
+
| **Draw** | Interactive PyQt6 desktop tool for drawing and editing profiles with drag, undo, and waypoint editing |
|
|
149
|
+
|
|
150
|
+
See the [full API reference](https://eslrgs.github.io/bathy) for details.
|
|
151
|
+
|
|
152
|
+
## Examples
|
|
153
|
+
|
|
154
|
+
See [examples/basic_usage.ipynb](examples/basic_usage.ipynb), [examples/profiles.ipynb](examples/profiles.ipynb), and [examples/draw_profile.py](examples/draw_profile.py).
|
|
155
|
+
|
|
156
|
+
### Profile drawing
|
|
157
|
+
|
|
158
|
+
Draw profiles interactively in a PyQt6 desktop window. Requires `uv pip install bathy[draw]`.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
uv run bathy-draw path/to/data.nc
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- Left-click to add waypoints, right-click to finish a profile, double-click to stop
|
|
165
|
+
- Drag waypoints to reposition, press **z** to undo, shift-click to delete
|
|
166
|
+
- Save/load profiles as GeoPackage, toggle visibility per profile
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
git clone https://github.com/eslrgs/bathy.git
|
|
172
|
+
cd bathy
|
|
173
|
+
uv sync
|
|
174
|
+
pre-commit install
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
just format # Format and lint
|
|
179
|
+
just test # Run tests
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Use of AI
|
|
183
|
+
|
|
184
|
+
This project was developed with assistance from AI, which was used for code generation, documentation, and testing.
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
bathy-0.2.0/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# 🌐 bathy
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://github.com/eslrgs/bathy/actions/workflows/ci.yml)
|
|
5
|
+
[](https://eslrgs.github.io/bathy)
|
|
6
|
+

|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
`bathy` — from Greek *βαθύς* (bathýs), "deep" — bathymetric analysis and visualisation in Python.
|
|
10
|
+
|
|
11
|
+
**[Documentation](https://eslrgs.github.io/bathy)** · [Installation](#installation) · [Features](#features) · [Examples](#examples)
|
|
12
|
+
|
|
13
|
+
## Motivation
|
|
14
|
+
|
|
15
|
+
I found creating bathymetric plots and profiles in Python surprisingly difficult. `bathy` provides a simple, high-level interface for loading, analysing, and visualising bathymetry data, so you can go from raw grid to reproducible quantitative analysis to finished figure with minimal effort.
|
|
16
|
+
|
|
17
|
+
## Basic usage
|
|
18
|
+
|
|
19
|
+
### Load data
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import bathy
|
|
23
|
+
|
|
24
|
+
# Load from file
|
|
25
|
+
data = bathy.load_bathymetry("GEBCO_2025.nc", lon_range=(-10, 0), lat_range=(50, 60))
|
|
26
|
+
|
|
27
|
+
# Or download GEBCO data via OPeNDAP
|
|
28
|
+
data = bathy.load_gebco_opendap(lon_range=(-10, 0), lat_range=(50, 60))
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Visualise
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
bathy.plot_bathy(data)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="docs/assets/images/plot_bathy.png" width="600" alt="Bathymetry">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
### Analysis overview
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
bathy.plot_overview(data)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<img src="docs/assets/images/plot_overview.png" width="600" alt="Overview">
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
### Profiles and canyon analysis
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
prof = bathy.extract_profile(data, (-11.3, 48.7), (-7.3, 47.2), name="Along-slope")
|
|
55
|
+
bathy.plot_profile(prof, show_map=True, bathymetry_data=data)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<img src="docs/assets/images/plot_profile.png" width="600" alt="Profile">
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
canyons = bathy.get_canyons(prof, prominence=100)
|
|
64
|
+
bathy.plot_canyons(prof, canyons)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
<p align="center">
|
|
68
|
+
<img src="docs/assets/images/plot_canyons.png" width="600" alt="Canyons">
|
|
69
|
+
</p>
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install bathy
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or with uv:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv add bathy
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Features
|
|
84
|
+
|
|
85
|
+
| Category | Description |
|
|
86
|
+
|---|---|
|
|
87
|
+
| **IO** | Load from local files (NetCDF, GeoTIFF), GEBCO OPeNDAP, or EMODnet WCS. Export to GeoTIFF. 28 preset regions included. |
|
|
88
|
+
| **Analysis** | Slope, aspect, curvature, rugosity, BPI, geomorphons, contours, smoothing, hypsometric analysis |
|
|
89
|
+
| **Plotting** | Publication-ready bathymetry, hillshade, slope, aspect, overview, 3D surface, depth zones, histograms, interactive maps |
|
|
90
|
+
| **Profiles** | Extract profiles between points, generate cross-sections, load from file or GeoDataFrame |
|
|
91
|
+
| **Profile analysis** | Statistics, gradient, concavity, knickpoints, canyon detection, comparison across profiles |
|
|
92
|
+
| **Draw** | Interactive PyQt6 desktop tool for drawing and editing profiles with drag, undo, and waypoint editing |
|
|
93
|
+
|
|
94
|
+
See the [full API reference](https://eslrgs.github.io/bathy) for details.
|
|
95
|
+
|
|
96
|
+
## Examples
|
|
97
|
+
|
|
98
|
+
See [examples/basic_usage.ipynb](examples/basic_usage.ipynb), [examples/profiles.ipynb](examples/profiles.ipynb), and [examples/draw_profile.py](examples/draw_profile.py).
|
|
99
|
+
|
|
100
|
+
### Profile drawing
|
|
101
|
+
|
|
102
|
+
Draw profiles interactively in a PyQt6 desktop window. Requires `uv pip install bathy[draw]`.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
uv run bathy-draw path/to/data.nc
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- Left-click to add waypoints, right-click to finish a profile, double-click to stop
|
|
109
|
+
- Drag waypoints to reposition, press **z** to undo, shift-click to delete
|
|
110
|
+
- Save/load profiles as GeoPackage, toggle visibility per profile
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git clone https://github.com/eslrgs/bathy.git
|
|
116
|
+
cd bathy
|
|
117
|
+
uv sync
|
|
118
|
+
pre-commit install
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
just format # Format and lint
|
|
123
|
+
just test # Run tests
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Use of AI
|
|
127
|
+
|
|
128
|
+
This project was developed with assistance from AI, which was used for code generation, documentation, and testing.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "bathy"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Lightweight Python package for exploring bathymetry data."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "eslrgs", email = "euan-soutter@hotmail.co.uk" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
keywords = ["bathymetry", "geomorphology", "oceanography"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Intended Audience :: Science/Research",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Topic :: Scientific/Engineering",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
dependencies = [
|
|
23
|
+
"xarray>=2024.1.0",
|
|
24
|
+
"netcdf4>=1.6.0",
|
|
25
|
+
"numpy>=1.24.0",
|
|
26
|
+
"matplotlib>=3.8.0",
|
|
27
|
+
"scipy>=1.11.0",
|
|
28
|
+
"geographiclib>=2.0",
|
|
29
|
+
"geopandas>=0.14.0",
|
|
30
|
+
"pydap>=3.5.8",
|
|
31
|
+
"cmocean>=4.0.0",
|
|
32
|
+
"rioxarray>=0.15.0",
|
|
33
|
+
"polars>=1.0.0",
|
|
34
|
+
"tqdm>=4.66.0",
|
|
35
|
+
"pooch>=1.7.0",
|
|
36
|
+
"owslib>=0.31.0",
|
|
37
|
+
"folium>=0.17.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/eslrgs/bathy"
|
|
42
|
+
Repository = "https://github.com/eslrgs/bathy"
|
|
43
|
+
Documentation = "https://eslrgs.github.io/bathy/"
|
|
44
|
+
Issues = "https://github.com/eslrgs/bathy/issues"
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
bathy-draw = "bathy.__main__:main"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
draw = ["PyQt6>=6.5.0"]
|
|
51
|
+
notebook = [
|
|
52
|
+
"jupyter>=1.0.0",
|
|
53
|
+
"ipykernel>=6.0.0",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[dependency-groups]
|
|
57
|
+
dev = [
|
|
58
|
+
"pre-commit>=4.5.0",
|
|
59
|
+
"ruff>=0.14.8",
|
|
60
|
+
"pytest>=8.0.0",
|
|
61
|
+
"mkdocs>=1.6.1",
|
|
62
|
+
"mkdocs-material>=9.7.1",
|
|
63
|
+
"mkdocstrings[python]>=1.0.3",
|
|
64
|
+
"mkdocs-jupyter>=0.25.0",
|
|
65
|
+
"pytest-cov>=7.0.0",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[build-system]
|
|
69
|
+
requires = ["uv_build>=0.9.18,<0.10.0"]
|
|
70
|
+
build-backend = "uv_build"
|
|
71
|
+
|
|
72
|
+
[tool.uv.build-backend]
|
|
73
|
+
source-exclude = ["tests/", "examples/", "docs/", "data/", "site/", "**/.DS_Store"]
|
|
74
|
+
wheel-exclude = ["**/.DS_Store"]
|
|
75
|
+
|
|
76
|
+
[tool.ty.environment]
|
|
77
|
+
extra-paths = ["typings"]
|
|
78
|
+
|
|
79
|
+
[tool.pytest.ini_options]
|
|
80
|
+
filterwarnings = [
|
|
81
|
+
"ignore:numpy.ndarray size changed:RuntimeWarning",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
[tool.ruff]
|
|
85
|
+
line-length = 88
|
|
86
|
+
target-version = "py312"
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = ["E", "F", "I", "N", "W"]
|
|
90
|
+
ignore = []
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""Lightweight Python package for exploring bathymetry data."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from importlib.metadata import version
|
|
5
|
+
|
|
6
|
+
from bathy import profile
|
|
7
|
+
from bathy.analysis import (
|
|
8
|
+
aspect,
|
|
9
|
+
bpi,
|
|
10
|
+
contours,
|
|
11
|
+
curvature,
|
|
12
|
+
geomorphons,
|
|
13
|
+
hypsometric_curve,
|
|
14
|
+
hypsometric_index,
|
|
15
|
+
rugosity,
|
|
16
|
+
slope,
|
|
17
|
+
smooth,
|
|
18
|
+
summary,
|
|
19
|
+
)
|
|
20
|
+
from bathy.datasets import sample_data
|
|
21
|
+
from bathy.io import (
|
|
22
|
+
list_regions,
|
|
23
|
+
load_bathymetry,
|
|
24
|
+
load_emodnet_wcs,
|
|
25
|
+
load_gebco_opendap,
|
|
26
|
+
to_geotiff,
|
|
27
|
+
)
|
|
28
|
+
from bathy.plot import (
|
|
29
|
+
plot_aspect,
|
|
30
|
+
plot_bathy,
|
|
31
|
+
plot_bpi,
|
|
32
|
+
plot_curvature,
|
|
33
|
+
plot_depth_zones,
|
|
34
|
+
plot_geomorphons,
|
|
35
|
+
plot_hillshade,
|
|
36
|
+
plot_histogram,
|
|
37
|
+
plot_hypsometric_curve,
|
|
38
|
+
plot_interactive,
|
|
39
|
+
plot_overview,
|
|
40
|
+
plot_rugosity,
|
|
41
|
+
plot_slope,
|
|
42
|
+
plot_surface3d,
|
|
43
|
+
)
|
|
44
|
+
from bathy.profile import (
|
|
45
|
+
Profile,
|
|
46
|
+
compare_stats,
|
|
47
|
+
concavity_index,
|
|
48
|
+
cross_sections,
|
|
49
|
+
extract_profile,
|
|
50
|
+
get_canyons,
|
|
51
|
+
gradient,
|
|
52
|
+
knickpoints,
|
|
53
|
+
max_depth,
|
|
54
|
+
profile_from_coordinates,
|
|
55
|
+
profile_stats,
|
|
56
|
+
profiles_from_file,
|
|
57
|
+
profiles_from_gdf,
|
|
58
|
+
to_gdf,
|
|
59
|
+
)
|
|
60
|
+
from bathy.profile_plot import (
|
|
61
|
+
plot_canyons,
|
|
62
|
+
plot_gradient,
|
|
63
|
+
plot_knickpoints,
|
|
64
|
+
plot_profile,
|
|
65
|
+
plot_profiles,
|
|
66
|
+
plot_profiles_grid,
|
|
67
|
+
plot_profiles_map,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
__version__ = version("bathy")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def draw_profile(*args, **kwargs):
|
|
74
|
+
"""Lazy wrapper — see :func:`bathy.draw.draw_profile`."""
|
|
75
|
+
from bathy.draw import draw_profile as _draw_profile
|
|
76
|
+
|
|
77
|
+
return _draw_profile(*args, **kwargs)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
# Datasets
|
|
82
|
+
"sample_data",
|
|
83
|
+
# IO
|
|
84
|
+
"list_regions",
|
|
85
|
+
"load_bathymetry",
|
|
86
|
+
"load_emodnet_wcs",
|
|
87
|
+
"load_gebco_opendap",
|
|
88
|
+
"to_geotiff",
|
|
89
|
+
# Analysis
|
|
90
|
+
"summary",
|
|
91
|
+
"hypsometric_index",
|
|
92
|
+
"hypsometric_curve",
|
|
93
|
+
"slope",
|
|
94
|
+
"curvature",
|
|
95
|
+
"bpi",
|
|
96
|
+
"rugosity",
|
|
97
|
+
"aspect",
|
|
98
|
+
"geomorphons",
|
|
99
|
+
"contours",
|
|
100
|
+
"smooth",
|
|
101
|
+
# Plotting
|
|
102
|
+
"plot_bathy",
|
|
103
|
+
"plot_hillshade",
|
|
104
|
+
"plot_slope",
|
|
105
|
+
"plot_curvature",
|
|
106
|
+
"plot_bpi",
|
|
107
|
+
"plot_rugosity",
|
|
108
|
+
"plot_aspect",
|
|
109
|
+
"plot_geomorphons",
|
|
110
|
+
"plot_overview",
|
|
111
|
+
"plot_histogram",
|
|
112
|
+
"plot_depth_zones",
|
|
113
|
+
"plot_surface3d",
|
|
114
|
+
"plot_hypsometric_curve",
|
|
115
|
+
# Profile
|
|
116
|
+
"Profile",
|
|
117
|
+
"extract_profile",
|
|
118
|
+
"profile_from_coordinates",
|
|
119
|
+
"cross_sections",
|
|
120
|
+
"profiles_from_file",
|
|
121
|
+
"profiles_from_gdf",
|
|
122
|
+
"profile_stats",
|
|
123
|
+
"max_depth",
|
|
124
|
+
"gradient",
|
|
125
|
+
"concavity_index",
|
|
126
|
+
"knickpoints",
|
|
127
|
+
"get_canyons",
|
|
128
|
+
"compare_stats",
|
|
129
|
+
"to_gdf",
|
|
130
|
+
"plot_profile",
|
|
131
|
+
"plot_profiles",
|
|
132
|
+
"plot_profiles_grid",
|
|
133
|
+
"plot_profiles_map",
|
|
134
|
+
"plot_knickpoints",
|
|
135
|
+
"plot_gradient",
|
|
136
|
+
"plot_canyons",
|
|
137
|
+
# Interactive
|
|
138
|
+
"plot_interactive",
|
|
139
|
+
"draw_profile",
|
|
140
|
+
# Submodule
|
|
141
|
+
"profile",
|
|
142
|
+
"__version__",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
logging.getLogger("bathy").addHandler(logging.NullHandler())
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Launch the interactive profile drawer from the command line.
|
|
2
|
+
|
|
3
|
+
Usage
|
|
4
|
+
-----
|
|
5
|
+
uv run bathy-draw path/to/data.nc
|
|
6
|
+
uv run python -m bathy path/to/data.nc
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main() -> None:
|
|
14
|
+
if len(sys.argv) < 2:
|
|
15
|
+
print("Usage: bathy-draw <path/to/data.nc>")
|
|
16
|
+
sys.exit(1)
|
|
17
|
+
|
|
18
|
+
path = Path(sys.argv[1])
|
|
19
|
+
if not path.exists():
|
|
20
|
+
print(f"File not found: {path}")
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
from bathy.draw import draw_profile
|
|
24
|
+
from bathy.io import load_bathymetry
|
|
25
|
+
from bathy.profile import to_gdf
|
|
26
|
+
|
|
27
|
+
data = load_bathymetry(str(path))
|
|
28
|
+
profiles = draw_profile(data)
|
|
29
|
+
|
|
30
|
+
if not profiles:
|
|
31
|
+
print("No profiles drawn.")
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
out_path = path.with_name(f"{path.stem}_profiles.gpkg")
|
|
35
|
+
to_gdf(profiles).to_file(out_path)
|
|
36
|
+
|
|
37
|
+
print(f"\n{len(profiles)} profile(s) saved to {out_path}")
|
|
38
|
+
for p in profiles:
|
|
39
|
+
print(
|
|
40
|
+
f" {p.name}: {p.distances[-1] / 1000:.1f} km, "
|
|
41
|
+
f"min elevation {float(p.elevations.min()):.0f} m"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|