skyborn-plot 0.1.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.
- skyborn_plot-0.1.0/LICENSE +29 -0
- skyborn_plot-0.1.0/PKG-INFO +93 -0
- skyborn_plot-0.1.0/README.md +53 -0
- skyborn_plot-0.1.0/pyproject.toml +110 -0
- skyborn_plot-0.1.0/setup.cfg +4 -0
- skyborn_plot-0.1.0/setup.py +218 -0
- skyborn_plot-0.1.0/src/skyborn_plot.egg-info/PKG-INFO +93 -0
- skyborn_plot-0.1.0/src/skyborn_plot.egg-info/SOURCES.txt +50 -0
- skyborn_plot-0.1.0/src/skyborn_plot.egg-info/dependency_links.txt +1 -0
- skyborn_plot-0.1.0/src/skyborn_plot.egg-info/requires.txt +12 -0
- skyborn_plot-0.1.0/src/skyborn_plot.egg-info/top_level.txt +1 -0
- skyborn_plot-0.1.0/src/skybornplot/__init__.py +34 -0
- skyborn_plot-0.1.0/src/skybornplot/_adapters/__init__.py +1 -0
- skyborn_plot-0.1.0/src/skybornplot/_adapters/cartopy_vector.py +144 -0
- skyborn_plot-0.1.0/src/skybornplot/_adapters/curly_vector_entry.py +389 -0
- skyborn_plot-0.1.0/src/skybornplot/_adapters/dataset_vector.py +191 -0
- skyborn_plot-0.1.0/src/skybornplot/_adapters/grid_prepare.py +210 -0
- skyborn_plot-0.1.0/src/skybornplot/_artists/__init__.py +1 -0
- skyborn_plot-0.1.0/src/skybornplot/_artists/vector_artists.py +299 -0
- skyborn_plot-0.1.0/src/skybornplot/_artists/vector_key_artist.py +545 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/__init__.py +1 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/contour_arrows.py +708 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/geometry.py +277 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/legacy_stream.py +150 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/native.py +303 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/result.py +105 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/scatter_engine.py +564 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/thinning.py +132 -0
- skyborn_plot-0.1.0/src/skybornplot/_core/vector_engine.py +1154 -0
- skyborn_plot-0.1.0/src/skybornplot/_shared/__init__.py +1 -0
- skyborn_plot-0.1.0/src/skybornplot/_shared/axes.py +19 -0
- skyborn_plot-0.1.0/src/skybornplot/_shared/coords.py +387 -0
- skyborn_plot-0.1.0/src/skybornplot/_shared/style.py +215 -0
- skyborn_plot-0.1.0/src/skybornplot/_shared/types.py +9 -0
- skyborn_plot-0.1.0/src/skybornplot/contour.py +836 -0
- skyborn_plot-0.1.0/src/skybornplot/contour_core/__init__.py +7 -0
- skyborn_plot-0.1.0/src/skybornplot/nclcurly_core/__init__.py +34 -0
- skyborn_plot-0.1.0/src/skybornplot/plotting.py +447 -0
- skyborn_plot-0.1.0/src/skybornplot/scatter.py +171 -0
- skyborn_plot-0.1.0/src/skybornplot/vector.py +1377 -0
- skyborn_plot-0.1.0/tests/test_arrow_contour_label_robustness.py +200 -0
- skyborn_plot-0.1.0/tests/test_arrow_min_spacing.py +199 -0
- skyborn_plot-0.1.0/tests/test_contour_arrows_core_fixes.py +142 -0
- skyborn_plot-0.1.0/tests/test_edge_width_fix.py +108 -0
- skyborn_plot-0.1.0/tests/test_margin_recursion_fixes.py +54 -0
- skyborn_plot-0.1.0/tests/test_plot_curly_vector.py +2022 -0
- skyborn_plot-0.1.0/tests/test_plot_helper_coverage.py +3912 -0
- skyborn_plot-0.1.0/tests/test_plot_plotting.py +667 -0
- skyborn_plot-0.1.0/tests/test_plot_scatter_plot.py +538 -0
- skyborn_plot-0.1.0/tests/test_plot_shadow_contour.py +991 -0
- skyborn_plot-0.1.0/tests/test_plot_shadow_contour_coverage.py +911 -0
- skyborn_plot-0.1.0/tests/test_plot_vector_plot.py +2395 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Qianye Su
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the [copyright holder] nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: skyborn-plot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NCL-style atmospheric and climate vector, contour, and scatter plotting with compiled C kernels
|
|
5
|
+
Author-email: Qianye Su <suqianye2000@gmail.com>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/skyborn-org/skyborn-plot
|
|
8
|
+
Project-URL: Repository, https://github.com/skyborn-org/skyborn-plot
|
|
9
|
+
Project-URL: Documentation, https://skyborn.readthedocs.io/
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/skyborn-org/skyborn-plot/issues
|
|
11
|
+
Keywords: atmospheric-science,meteorology,climate,visualization,matplotlib,curly-vector,ncl
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Operating System :: MacOS
|
|
24
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
25
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: numpy>=1.24.0
|
|
30
|
+
Requires-Dist: matplotlib>=3.6.0
|
|
31
|
+
Provides-Extra: geo
|
|
32
|
+
Requires-Dist: cartopy; extra == "geo"
|
|
33
|
+
Requires-Dist: xarray; extra == "geo"
|
|
34
|
+
Requires-Dist: scipy; extra == "geo"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
37
|
+
Requires-Dist: xarray; extra == "dev"
|
|
38
|
+
Requires-Dist: scipy; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# skyborn-plot (`skybornplot`)
|
|
42
|
+
|
|
43
|
+
High-performance, NCL-style atmospheric & climate visualization toolkit for Matplotlib and Cartopy, powered by pure C99 native kernels.
|
|
44
|
+
|
|
45
|
+
Part of the [**Skyborn** (`skyborn-org`)](https://github.com/skyborn-org) ecosystem.
|
|
46
|
+
|
|
47
|
+
## Key Features
|
|
48
|
+
|
|
49
|
+
- **`curly_vector` & `curly_vector_key`**: Curved streamline-following vector fields with NCL-faithful thinning, closed-apex open/filled arrowheads, and L-shaped reference vector keys.
|
|
50
|
+
- **`arrow_contour` & `arrow_contour_clabel`**: Streamline-aligned directional contour arrows with automatic label avoidance.
|
|
51
|
+
- **`shadow_contourf`**: Shaded/hatched significance and terrain overlays.
|
|
52
|
+
- **`gradient_fill_between` / `GradientFillBetween`**: Smooth vertical/horizontal gradient fills and figure helpers (`createFigure`, `add_equal_axes`, `add_centered_axes`).
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install skyborn-plot
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Optional geospatial & xarray support:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "skyborn-plot[geo]"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or install the full Skyborn suite:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install skyborn
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import matplotlib.pyplot as plt
|
|
76
|
+
import skybornplot as splt
|
|
77
|
+
|
|
78
|
+
fig, ax = plt.subplots(figsize=(8, 4))
|
|
79
|
+
cv = splt.curly_vector(
|
|
80
|
+
ax, lon, lat, u, v,
|
|
81
|
+
density=1.2,
|
|
82
|
+
arrowstyle="->",
|
|
83
|
+
color=speed,
|
|
84
|
+
cmap="viridis",
|
|
85
|
+
)
|
|
86
|
+
splt.curly_vector_key(ax, cv, U=10.0, label="10 m s⁻¹")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Note: `skyborn.plot` in the `skyborn` package seamlessly re-exports `skybornplot`.
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
BSD 3-Clause License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# skyborn-plot (`skybornplot`)
|
|
2
|
+
|
|
3
|
+
High-performance, NCL-style atmospheric & climate visualization toolkit for Matplotlib and Cartopy, powered by pure C99 native kernels.
|
|
4
|
+
|
|
5
|
+
Part of the [**Skyborn** (`skyborn-org`)](https://github.com/skyborn-org) ecosystem.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **`curly_vector` & `curly_vector_key`**: Curved streamline-following vector fields with NCL-faithful thinning, closed-apex open/filled arrowheads, and L-shaped reference vector keys.
|
|
10
|
+
- **`arrow_contour` & `arrow_contour_clabel`**: Streamline-aligned directional contour arrows with automatic label avoidance.
|
|
11
|
+
- **`shadow_contourf`**: Shaded/hatched significance and terrain overlays.
|
|
12
|
+
- **`gradient_fill_between` / `GradientFillBetween`**: Smooth vertical/horizontal gradient fills and figure helpers (`createFigure`, `add_equal_axes`, `add_centered_axes`).
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install skyborn-plot
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Optional geospatial & xarray support:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install "skyborn-plot[geo]"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or install the full Skyborn suite:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install skyborn
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import matplotlib.pyplot as plt
|
|
36
|
+
import skybornplot as splt
|
|
37
|
+
|
|
38
|
+
fig, ax = plt.subplots(figsize=(8, 4))
|
|
39
|
+
cv = splt.curly_vector(
|
|
40
|
+
ax, lon, lat, u, v,
|
|
41
|
+
density=1.2,
|
|
42
|
+
arrowstyle="->",
|
|
43
|
+
color=speed,
|
|
44
|
+
cmap="viridis",
|
|
45
|
+
)
|
|
46
|
+
splt.curly_vector_key(ax, cv, U=10.0, label="10 m s⁻¹")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Note: `skyborn.plot` in the `skyborn` package seamlessly re-exports `skybornplot`.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
BSD 3-Clause License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=61.0",
|
|
4
|
+
"wheel",
|
|
5
|
+
"numpy>=1.24.0",
|
|
6
|
+
"meson",
|
|
7
|
+
"ninja",
|
|
8
|
+
]
|
|
9
|
+
build-backend = "setuptools.build_meta"
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "skyborn-plot"
|
|
13
|
+
dynamic = ["version"]
|
|
14
|
+
description = "NCL-style atmospheric and climate vector, contour, and scatter plotting with compiled C kernels"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
authors = [{ name = "Qianye Su", email = "suqianye2000@gmail.com" }]
|
|
17
|
+
license = "BSD-3-Clause"
|
|
18
|
+
license-files = ["LICENSE"]
|
|
19
|
+
requires-python = ">=3.9"
|
|
20
|
+
keywords = [
|
|
21
|
+
"atmospheric-science",
|
|
22
|
+
"meteorology",
|
|
23
|
+
"climate",
|
|
24
|
+
"visualization",
|
|
25
|
+
"matplotlib",
|
|
26
|
+
"curly-vector",
|
|
27
|
+
"ncl",
|
|
28
|
+
]
|
|
29
|
+
classifiers = [
|
|
30
|
+
"Development Status :: 4 - Beta",
|
|
31
|
+
"Intended Audience :: Science/Research",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Atmospheric Science",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
34
|
+
"Programming Language :: Python :: 3",
|
|
35
|
+
"Programming Language :: Python :: 3.9",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Programming Language :: Python :: 3.13",
|
|
40
|
+
"Programming Language :: Python :: 3.14",
|
|
41
|
+
"Operating System :: MacOS",
|
|
42
|
+
"Operating System :: Microsoft :: Windows",
|
|
43
|
+
"Operating System :: POSIX :: Linux",
|
|
44
|
+
]
|
|
45
|
+
dependencies = [
|
|
46
|
+
"numpy>=1.24.0",
|
|
47
|
+
"matplotlib>=3.6.0",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.optional-dependencies]
|
|
51
|
+
geo = [
|
|
52
|
+
"cartopy",
|
|
53
|
+
"xarray",
|
|
54
|
+
"scipy",
|
|
55
|
+
]
|
|
56
|
+
dev = [
|
|
57
|
+
"pytest>=7.0",
|
|
58
|
+
"xarray",
|
|
59
|
+
"scipy",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[project.urls]
|
|
63
|
+
"Homepage" = "https://github.com/skyborn-org/skyborn-plot"
|
|
64
|
+
"Repository" = "https://github.com/skyborn-org/skyborn-plot"
|
|
65
|
+
"Documentation" = "https://skyborn.readthedocs.io/"
|
|
66
|
+
"Bug Tracker" = "https://github.com/skyborn-org/skyborn-plot/issues"
|
|
67
|
+
|
|
68
|
+
[tool.setuptools]
|
|
69
|
+
package-dir = { "" = "src" }
|
|
70
|
+
include-package-data = false
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.packages.find]
|
|
73
|
+
where = ["src"]
|
|
74
|
+
exclude = [
|
|
75
|
+
"*.build*",
|
|
76
|
+
"*.build*.*",
|
|
77
|
+
"*.build",
|
|
78
|
+
"*.build.*",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[tool.setuptools.exclude-package-data]
|
|
82
|
+
"*" = [
|
|
83
|
+
"*.pyc",
|
|
84
|
+
"*.pyo",
|
|
85
|
+
"__pycache__/*",
|
|
86
|
+
"build/*",
|
|
87
|
+
"build_local/*",
|
|
88
|
+
"meson-private/*",
|
|
89
|
+
"meson-logs/*",
|
|
90
|
+
"meson-info/*",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[tool.setuptools.dynamic]
|
|
94
|
+
version = { attr = "skybornplot.__version__" }
|
|
95
|
+
|
|
96
|
+
[tool.black]
|
|
97
|
+
line-length = 88
|
|
98
|
+
target-version = ["py39", "py310", "py311", "py312", "py313", "py314"]
|
|
99
|
+
|
|
100
|
+
[tool.isort]
|
|
101
|
+
profile = "black"
|
|
102
|
+
line_length = 88
|
|
103
|
+
src_paths = ["src", "tests"]
|
|
104
|
+
|
|
105
|
+
[tool.pytest.ini_options]
|
|
106
|
+
minversion = "6.0"
|
|
107
|
+
testpaths = ["tests"]
|
|
108
|
+
python_files = ["test_*.py"]
|
|
109
|
+
python_classes = ["Test*"]
|
|
110
|
+
python_functions = ["test_*"]
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"""Setup script for skyborn-plot (pure C99 Meson extensions, zero Fortran deps)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from setuptools import Distribution, setup
|
|
12
|
+
from setuptools.command.build_ext import build_ext
|
|
13
|
+
from setuptools.command.develop import develop
|
|
14
|
+
from setuptools.command.install import install
|
|
15
|
+
from setuptools.command.install_lib import install_lib
|
|
16
|
+
from wheel.bdist_wheel import bdist_wheel
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _active_python_prefix() -> Path:
|
|
20
|
+
"""Return the active interpreter environment prefix."""
|
|
21
|
+
return Path(sys.prefix).resolve()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _parse_build_only_filter() -> set[str] | None:
|
|
25
|
+
"""Parse SKYBORN_BUILD_ONLY comma-separated module filter if set."""
|
|
26
|
+
raw = os.environ.get("SKYBORN_BUILD_ONLY", "").strip()
|
|
27
|
+
if not raw:
|
|
28
|
+
return None
|
|
29
|
+
return {item.strip() for item in raw.split(",") if item.strip()}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MesonBuildExt(build_ext):
|
|
33
|
+
"""Build pure-C Meson extensions with incremental Ninja cache support."""
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def _resolve_tool_command(executable_name: str, module_name: str, *args: str):
|
|
37
|
+
executable_path = shutil.which(executable_name)
|
|
38
|
+
if executable_path:
|
|
39
|
+
return [executable_path, *args]
|
|
40
|
+
return [sys.executable, "-m", module_name, *args]
|
|
41
|
+
|
|
42
|
+
@staticmethod
|
|
43
|
+
def _meson_command(*args: str):
|
|
44
|
+
return MesonBuildExt._resolve_tool_command(
|
|
45
|
+
"meson", "mesonbuild.mesonmain", *args
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
@staticmethod
|
|
49
|
+
def _ninja_command(*args: str):
|
|
50
|
+
return MesonBuildExt._resolve_tool_command("ninja", "ninja", *args)
|
|
51
|
+
|
|
52
|
+
@staticmethod
|
|
53
|
+
def _write_meson_native_file(build_dir: Path) -> Path:
|
|
54
|
+
native_file = (build_dir / "meson-python-native.ini").resolve()
|
|
55
|
+
python_executable = Path(os.path.abspath(sys.executable)).as_posix()
|
|
56
|
+
native_file.write_text(
|
|
57
|
+
"[binaries]\n"
|
|
58
|
+
f"python = '{python_executable}'\n"
|
|
59
|
+
f"build_python = '{python_executable}'\n",
|
|
60
|
+
encoding="utf-8",
|
|
61
|
+
)
|
|
62
|
+
return native_file
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def _write_build_python_shim(build_dir: Path) -> Path:
|
|
66
|
+
python_executable = shutil.which("python") or os.path.abspath(sys.executable)
|
|
67
|
+
if os.name == "nt":
|
|
68
|
+
shim_path = (build_dir / "build_python.bat").resolve()
|
|
69
|
+
with shim_path.open("w", encoding="utf-8", newline="\r\n") as handle:
|
|
70
|
+
handle.write("@echo off\r\n")
|
|
71
|
+
handle.write(f'"{python_executable}" %*\r\n')
|
|
72
|
+
else:
|
|
73
|
+
shim_path = (build_dir / "build_python").resolve()
|
|
74
|
+
python_executable = Path(os.path.abspath(python_executable)).as_posix()
|
|
75
|
+
with shim_path.open("w", encoding="utf-8", newline="\n") as handle:
|
|
76
|
+
handle.write("#!/bin/sh\n")
|
|
77
|
+
handle.write(f'exec "{python_executable}" "$@"\n')
|
|
78
|
+
shim_path.chmod(0o755)
|
|
79
|
+
return shim_path
|
|
80
|
+
|
|
81
|
+
def run(self):
|
|
82
|
+
self.build_meson_modules()
|
|
83
|
+
super().run()
|
|
84
|
+
|
|
85
|
+
def build_meson_modules(self):
|
|
86
|
+
only_filter = _parse_build_only_filter()
|
|
87
|
+
for module in self._discover_meson_modules():
|
|
88
|
+
if only_filter is not None and module["name"] not in only_filter:
|
|
89
|
+
continue
|
|
90
|
+
self.build_meson_module(module)
|
|
91
|
+
|
|
92
|
+
def _discover_meson_modules(self):
|
|
93
|
+
pkg_root = Path("src") / "skybornplot"
|
|
94
|
+
modules = []
|
|
95
|
+
for meson_file in sorted(pkg_root.rglob("meson.build")):
|
|
96
|
+
rel_dir = meson_file.parent.relative_to(pkg_root)
|
|
97
|
+
name = ".".join(rel_dir.parts) if rel_dir.parts else "skybornplot"
|
|
98
|
+
modules.append({"name": name, "path": meson_file.parent})
|
|
99
|
+
return modules
|
|
100
|
+
|
|
101
|
+
def build_meson_module(self, module):
|
|
102
|
+
module_path = module["path"]
|
|
103
|
+
build_dir = module_path / "build"
|
|
104
|
+
clean_requested = os.environ.get("SKYBORN_CLEAN_BUILD") == "1"
|
|
105
|
+
can_reuse = (
|
|
106
|
+
bool(self.inplace)
|
|
107
|
+
and not clean_requested
|
|
108
|
+
and (build_dir / "build.ninja").exists()
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
env = os.environ.copy()
|
|
112
|
+
build_dir_path = str(build_dir.resolve())
|
|
113
|
+
current_path = env.get("PATH", "")
|
|
114
|
+
path_sep = ";" if os.name == "nt" else ":"
|
|
115
|
+
env["PATH"] = (
|
|
116
|
+
f"{build_dir_path}{path_sep}{current_path}"
|
|
117
|
+
if current_path
|
|
118
|
+
else build_dir_path
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
if not can_reuse:
|
|
122
|
+
if build_dir.exists():
|
|
123
|
+
shutil.rmtree(build_dir)
|
|
124
|
+
build_dir.mkdir(parents=True, exist_ok=True)
|
|
125
|
+
native_file = self._write_meson_native_file(build_dir)
|
|
126
|
+
self._write_build_python_shim(build_dir)
|
|
127
|
+
|
|
128
|
+
setup_cmd = self._meson_command(
|
|
129
|
+
"setup",
|
|
130
|
+
"build",
|
|
131
|
+
".",
|
|
132
|
+
"--buildtype=release",
|
|
133
|
+
"--native-file",
|
|
134
|
+
str(native_file),
|
|
135
|
+
)
|
|
136
|
+
setup_cmd.append("-Db_lto=true" if self.inplace else "-Db_lto=false")
|
|
137
|
+
|
|
138
|
+
if not self.inplace and getattr(self, "build_lib", None):
|
|
139
|
+
build_lib_path = Path(self.build_lib).resolve()
|
|
140
|
+
setup_cmd.extend(
|
|
141
|
+
[
|
|
142
|
+
f"--python.purelibdir={build_lib_path}",
|
|
143
|
+
f"--python.platlibdir={build_lib_path}",
|
|
144
|
+
]
|
|
145
|
+
)
|
|
146
|
+
subprocess.run(setup_cmd, cwd=str(module_path), check=True, env=env)
|
|
147
|
+
|
|
148
|
+
build_cmd = self._meson_command("compile", "-C", "build")
|
|
149
|
+
subprocess.run(build_cmd, cwd=str(module_path), check=True, env=env)
|
|
150
|
+
|
|
151
|
+
if not self.inplace and getattr(self, "build_lib", None):
|
|
152
|
+
install_cmd = self._meson_command("install", "-C", "build", "--only-changed")
|
|
153
|
+
subprocess.run(install_cmd, cwd=str(module_path), check=True, env=env)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class CustomDevelop(develop):
|
|
157
|
+
def run(self):
|
|
158
|
+
self.run_command("build_ext")
|
|
159
|
+
super().run()
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class CustomInstall(install):
|
|
163
|
+
def run(self):
|
|
164
|
+
self.run_command("build_ext")
|
|
165
|
+
super().run()
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class CustomInstallLib(install_lib):
|
|
169
|
+
"""Prune transient build artifacts and bytecode from installed package trees."""
|
|
170
|
+
|
|
171
|
+
_PRUNE_DIR_NAMES = {
|
|
172
|
+
"__pycache__",
|
|
173
|
+
"build",
|
|
174
|
+
"build_local",
|
|
175
|
+
"meson-private",
|
|
176
|
+
"meson-logs",
|
|
177
|
+
"meson-info",
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
def run(self):
|
|
181
|
+
super().run()
|
|
182
|
+
package_root = Path(self.install_dir) / "skybornplot"
|
|
183
|
+
if not package_root.exists():
|
|
184
|
+
return
|
|
185
|
+
for path in sorted(
|
|
186
|
+
package_root.rglob("*"), key=lambda item: len(item.parts), reverse=True
|
|
187
|
+
):
|
|
188
|
+
if path.is_dir() and (
|
|
189
|
+
path.name in self._PRUNE_DIR_NAMES or path.name.startswith("build_")
|
|
190
|
+
):
|
|
191
|
+
shutil.rmtree(path, ignore_errors=True)
|
|
192
|
+
elif path.is_file() and path.suffix.lower() in {".pyc", ".pyo"}:
|
|
193
|
+
path.unlink()
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class BinaryDistribution(Distribution):
|
|
197
|
+
def has_ext_modules(self):
|
|
198
|
+
return True
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class CustomBdistWheel(bdist_wheel):
|
|
202
|
+
def finalize_options(self):
|
|
203
|
+
super().finalize_options()
|
|
204
|
+
self.root_is_pure = False
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if __name__ == "__main__":
|
|
208
|
+
setup(
|
|
209
|
+
cmdclass={
|
|
210
|
+
"bdist_wheel": CustomBdistWheel,
|
|
211
|
+
"build_ext": MesonBuildExt,
|
|
212
|
+
"develop": CustomDevelop,
|
|
213
|
+
"install": CustomInstall,
|
|
214
|
+
"install_lib": CustomInstallLib,
|
|
215
|
+
},
|
|
216
|
+
distclass=BinaryDistribution,
|
|
217
|
+
ext_modules=[],
|
|
218
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: skyborn-plot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NCL-style atmospheric and climate vector, contour, and scatter plotting with compiled C kernels
|
|
5
|
+
Author-email: Qianye Su <suqianye2000@gmail.com>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/skyborn-org/skyborn-plot
|
|
8
|
+
Project-URL: Repository, https://github.com/skyborn-org/skyborn-plot
|
|
9
|
+
Project-URL: Documentation, https://skyborn.readthedocs.io/
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/skyborn-org/skyborn-plot/issues
|
|
11
|
+
Keywords: atmospheric-science,meteorology,climate,visualization,matplotlib,curly-vector,ncl
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Operating System :: MacOS
|
|
24
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
25
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: numpy>=1.24.0
|
|
30
|
+
Requires-Dist: matplotlib>=3.6.0
|
|
31
|
+
Provides-Extra: geo
|
|
32
|
+
Requires-Dist: cartopy; extra == "geo"
|
|
33
|
+
Requires-Dist: xarray; extra == "geo"
|
|
34
|
+
Requires-Dist: scipy; extra == "geo"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
37
|
+
Requires-Dist: xarray; extra == "dev"
|
|
38
|
+
Requires-Dist: scipy; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# skyborn-plot (`skybornplot`)
|
|
42
|
+
|
|
43
|
+
High-performance, NCL-style atmospheric & climate visualization toolkit for Matplotlib and Cartopy, powered by pure C99 native kernels.
|
|
44
|
+
|
|
45
|
+
Part of the [**Skyborn** (`skyborn-org`)](https://github.com/skyborn-org) ecosystem.
|
|
46
|
+
|
|
47
|
+
## Key Features
|
|
48
|
+
|
|
49
|
+
- **`curly_vector` & `curly_vector_key`**: Curved streamline-following vector fields with NCL-faithful thinning, closed-apex open/filled arrowheads, and L-shaped reference vector keys.
|
|
50
|
+
- **`arrow_contour` & `arrow_contour_clabel`**: Streamline-aligned directional contour arrows with automatic label avoidance.
|
|
51
|
+
- **`shadow_contourf`**: Shaded/hatched significance and terrain overlays.
|
|
52
|
+
- **`gradient_fill_between` / `GradientFillBetween`**: Smooth vertical/horizontal gradient fills and figure helpers (`createFigure`, `add_equal_axes`, `add_centered_axes`).
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install skyborn-plot
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Optional geospatial & xarray support:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "skyborn-plot[geo]"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or install the full Skyborn suite:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install skyborn
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import matplotlib.pyplot as plt
|
|
76
|
+
import skybornplot as splt
|
|
77
|
+
|
|
78
|
+
fig, ax = plt.subplots(figsize=(8, 4))
|
|
79
|
+
cv = splt.curly_vector(
|
|
80
|
+
ax, lon, lat, u, v,
|
|
81
|
+
density=1.2,
|
|
82
|
+
arrowstyle="->",
|
|
83
|
+
color=speed,
|
|
84
|
+
cmap="viridis",
|
|
85
|
+
)
|
|
86
|
+
splt.curly_vector_key(ax, cv, U=10.0, label="10 m s⁻¹")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Note: `skyborn.plot` in the `skyborn` package seamlessly re-exports `skybornplot`.
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
BSD 3-Clause License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
src/skyborn_plot.egg-info/PKG-INFO
|
|
6
|
+
src/skyborn_plot.egg-info/SOURCES.txt
|
|
7
|
+
src/skyborn_plot.egg-info/dependency_links.txt
|
|
8
|
+
src/skyborn_plot.egg-info/requires.txt
|
|
9
|
+
src/skyborn_plot.egg-info/top_level.txt
|
|
10
|
+
src/skybornplot/__init__.py
|
|
11
|
+
src/skybornplot/contour.py
|
|
12
|
+
src/skybornplot/plotting.py
|
|
13
|
+
src/skybornplot/scatter.py
|
|
14
|
+
src/skybornplot/vector.py
|
|
15
|
+
src/skybornplot/_adapters/__init__.py
|
|
16
|
+
src/skybornplot/_adapters/cartopy_vector.py
|
|
17
|
+
src/skybornplot/_adapters/curly_vector_entry.py
|
|
18
|
+
src/skybornplot/_adapters/dataset_vector.py
|
|
19
|
+
src/skybornplot/_adapters/grid_prepare.py
|
|
20
|
+
src/skybornplot/_artists/__init__.py
|
|
21
|
+
src/skybornplot/_artists/vector_artists.py
|
|
22
|
+
src/skybornplot/_artists/vector_key_artist.py
|
|
23
|
+
src/skybornplot/_core/__init__.py
|
|
24
|
+
src/skybornplot/_core/contour_arrows.py
|
|
25
|
+
src/skybornplot/_core/geometry.py
|
|
26
|
+
src/skybornplot/_core/legacy_stream.py
|
|
27
|
+
src/skybornplot/_core/native.py
|
|
28
|
+
src/skybornplot/_core/result.py
|
|
29
|
+
src/skybornplot/_core/scatter_engine.py
|
|
30
|
+
src/skybornplot/_core/thinning.py
|
|
31
|
+
src/skybornplot/_core/vector_engine.py
|
|
32
|
+
src/skybornplot/_shared/__init__.py
|
|
33
|
+
src/skybornplot/_shared/axes.py
|
|
34
|
+
src/skybornplot/_shared/coords.py
|
|
35
|
+
src/skybornplot/_shared/style.py
|
|
36
|
+
src/skybornplot/_shared/types.py
|
|
37
|
+
src/skybornplot/contour_core/__init__.py
|
|
38
|
+
src/skybornplot/nclcurly_core/__init__.py
|
|
39
|
+
tests/test_arrow_contour_label_robustness.py
|
|
40
|
+
tests/test_arrow_min_spacing.py
|
|
41
|
+
tests/test_contour_arrows_core_fixes.py
|
|
42
|
+
tests/test_edge_width_fix.py
|
|
43
|
+
tests/test_margin_recursion_fixes.py
|
|
44
|
+
tests/test_plot_curly_vector.py
|
|
45
|
+
tests/test_plot_helper_coverage.py
|
|
46
|
+
tests/test_plot_plotting.py
|
|
47
|
+
tests/test_plot_scatter_plot.py
|
|
48
|
+
tests/test_plot_shadow_contour.py
|
|
49
|
+
tests/test_plot_shadow_contour_coverage.py
|
|
50
|
+
tests/test_plot_vector_plot.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
skybornplot
|