bathy 0.2.0__py3-none-any.whl

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/__init__.py ADDED
@@ -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())
bathy/__main__.py ADDED
@@ -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()