interpies-lite 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.
@@ -0,0 +1,28 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build-and-publish:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ id-token: write # required for OIDC trusted publishing
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.x"
20
+
21
+ - name: Install build tools
22
+ run: python -m pip install --upgrade build
23
+
24
+ - name: Build sdist and wheel
25
+ run: python -m build
26
+
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,29 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ *.egg
11
+
12
+ # Jupyter
13
+ .ipynb_checkpoints/
14
+
15
+ # Editors
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+
20
+ # OS
21
+ .DS_Store
22
+ Thumbs.db
23
+
24
+ # Test/cache outputs
25
+ .pytest_cache/
26
+ .mypy_cache/
27
+ *.tif
28
+ *.png
29
+ !docs/*.png
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, interpies-lite contributors
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,189 @@
1
+ Metadata-Version: 2.5
2
+ Name: interpies-lite
3
+ Version: 0.1.0
4
+ Summary: Lightweight reimplementation of interpies: potential-field grid transforms and plotting (derivatives, ISVD, upward continuation, edge enhancement).
5
+ Project-URL: Homepage, https://github.com/xyt556/interpies-lite
6
+ Project-URL: Repository, https://github.com/xyt556/interpies-lite
7
+ Project-URL: Issues, https://github.com/xyt556/interpies-lite/issues
8
+ Author-email: Yantao XI <xyt556@gmail.com>
9
+ License: BSD 3-Clause License
10
+
11
+ Copyright (c) 2026, interpies-lite contributors
12
+ All rights reserved.
13
+
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted provided that the following conditions are met:
16
+
17
+ 1. Redistributions of source code must retain the above copyright notice, this
18
+ list of conditions and the following disclaimer.
19
+
20
+ 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+
24
+ 3. Neither the name of the copyright holder nor the names of its
25
+ contributors may be used to endorse or promote products derived from
26
+ this software without specific prior written permission.
27
+
28
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ License-File: LICENSE
39
+ Keywords: derivatives,edge-detection,geophysics,gravity,isvd,magnetics,potential-field,raster,remote-sensing,tilt,upward-continuation
40
+ Classifier: Development Status :: 4 - Beta
41
+ Classifier: Intended Audience :: Science/Research
42
+ Classifier: License :: OSI Approved :: BSD License
43
+ Classifier: Operating System :: OS Independent
44
+ Classifier: Programming Language :: Python :: 3
45
+ Classifier: Programming Language :: Python :: 3.10
46
+ Classifier: Programming Language :: Python :: 3.11
47
+ Classifier: Programming Language :: Python :: 3.12
48
+ Classifier: Topic :: Scientific/Engineering :: GIS
49
+ Classifier: Topic :: Scientific/Engineering :: Physics
50
+ Requires-Python: >=3.10
51
+ Requires-Dist: matplotlib>=3.7
52
+ Requires-Dist: numpy>=1.24
53
+ Requires-Dist: scikit-learn>=1.2
54
+ Requires-Dist: scipy>=1.10
55
+ Provides-Extra: dev
56
+ Requires-Dist: build>=1.2; extra == 'dev'
57
+ Requires-Dist: pytest>=8.0; extra == 'dev'
58
+ Requires-Dist: twine>=5.0; extra == 'dev'
59
+ Provides-Extra: geo
60
+ Requires-Dist: pyproj>=3.5; extra == 'geo'
61
+ Requires-Dist: rasterio>=1.3; extra == 'geo'
62
+ Description-Content-Type: text/markdown
63
+
64
+ # interpies_lite
65
+
66
+ 对原 `interpies` 库的轻量重实现。目标:解决原库依赖钉死(`gdal==3.8.4`)、久未更新的问题,保留核心功能与 API 习惯。
67
+
68
+ ## 与原库的差异
69
+
70
+ | 维度 | 原 interpies | interpies_lite |
71
+ | --- | --- | --- |
72
+ | 栅格读写 | rasterio + 钉死 gdal==3.8.4 | rasterio>=1.3(可选,未装时只能用 `Grid.from_array`) |
73
+ | SEGY 模块 | obspy 依赖 | 砍掉 |
74
+ | 色表数据 | 35 KB 硬编码 LUT | 内置 Geosoft clra / parula 近似色表,其他直接用 matplotlib 色表 |
75
+ | Grid 实现 | 普通类 + 手写属性 | `@dataclass` + property,类型注解完整 |
76
+ | 依赖 | numpy/scipy/matplotlib/rasterio/gdal/scikit-image/scikit-learn | numpy/scipy/matplotlib/scikit-learn(rasterio/pyproj 可选) |
77
+ | Python | >=3.10 | >=3.10 |
78
+
79
+ ## 模块
80
+
81
+ ```
82
+ interpies_lite/
83
+ ├── __init__.py # open() / Grid
84
+ ├── grid.py # Grid 类:IO、几何、预处理、全部位场方法
85
+ ├── transforms.py # 纯算法:导数、ISVD、傅里叶变换、延拓、平滑
86
+ ├── graphics.py # show / save_image:晕渲、色图、等值线
87
+ ├── colors.py # 内置色表
88
+ ├── spatial.py # pyproj 点投影(可选)
89
+ └── io.py # rasterio 封装
90
+ ```
91
+
92
+ ## 快速开始
93
+
94
+ ```python
95
+ import interpies_lite as ip
96
+
97
+ # 从文件加载(需要 rasterio)
98
+ g = ip.open("data/brtpgrd.gxf")
99
+ g.info()
100
+
101
+ # 从 numpy 数组构造(无任何重依赖)
102
+ import numpy as np
103
+ data = np.random.randn(100, 100)
104
+ g = ip.Grid.from_array(data, west=0, north=0, cellsize=100, crs="EPSG:32633")
105
+
106
+ # 链式调用:去趋势 → 平滑 → 边界识别
107
+ out = g.detrend(degree=1).smooth(win=5).tilt()
108
+ out.show()
109
+
110
+ # 可用变换(全部返回新 Grid):
111
+ # dx / dy / dx2 / dy2 / dxdy / dz / isvd / vi
112
+ # hgm / tilt / tg / lw / tahg
113
+ # up(z) / hp_filter_uc(z) / laplacian
114
+ # clip / resample / scale / detrend / fill_nodata / smooth
115
+ ```
116
+
117
+ ## 安装
118
+
119
+ 本包暂未发布到 PyPI,可通过以下任一方式安装:
120
+
121
+ ### 方式 1:从 GitHub 直接安装(推荐)
122
+
123
+ 公开仓库,无需下载,pip 自动拉取最新代码:
124
+
125
+ ```bash
126
+ pip install git+https://github.com/xyt556/interpies-lite.git
127
+ ```
128
+
129
+ 指定版本/分支:
130
+
131
+ ```bash
132
+ pip install git+https://github.com/xyt556/interpies-lite.git@main
133
+ ```
134
+
135
+ ### 方式 2:从本地目录安装
136
+
137
+ ```bash
138
+ cd path/to/interpies_lite
139
+ pip install .
140
+ ```
141
+
142
+ ### 方式 3:从 wheel 文件安装
143
+
144
+ ```bash
145
+ pip install dist/interpies_lite-0.1.0-py3-none-any.whl
146
+ ```
147
+
148
+ ### 方式 4:开发模式(可编辑,改代码即时生效)
149
+
150
+ ```bash
151
+ cd path/to/interpies_lite
152
+ pip install -e .
153
+ ```
154
+
155
+ ### 可选依赖(读写 GeoTIFF/GXF)
156
+
157
+ ```bash
158
+ pip install "interpies-lite[geo]"
159
+ # 等价于
160
+ pip install rasterio pyproj
161
+ ```
162
+
163
+ 核心依赖(必装):numpy、scipy、matplotlib、scikit-learn。
164
+
165
+ ## 示例
166
+
167
+ 仓库自带两个 notebook:
168
+
169
+ | Notebook | 数据 | 内容 |
170
+ | --- | --- | --- |
171
+ | `notebooks/interpies_lite_demo.ipynb` | 合成数据 | 快速上手,无需 rasterio,开箱即跑 |
172
+ | `notebooks/interpies_lite_brtpgrd_demo.ipynb` | `data/brtpgrd.gxf`(真实航磁) | 课堂版完整教程,含算法原理与公式 |
173
+
174
+ 克隆仓库后:
175
+
176
+ ```bash
177
+ cd interpies_lite
178
+ pip install -e .[geo]
179
+ jupyter notebook notebooks/
180
+ ```
181
+
182
+ `data/brtpgrd.gxf` 为 Colorado 地区航磁数据(707×629,50 m,NAD27/UTM13N),来自原 interpies 项目示例。
183
+
184
+ ## 冒烟测试
185
+
186
+ ```bash
187
+ python smoke_test.py
188
+ # 在合成网格上跑通全部变换,输出 smoke_test_output.png
189
+ ```
@@ -0,0 +1,126 @@
1
+ # interpies_lite
2
+
3
+ 对原 `interpies` 库的轻量重实现。目标:解决原库依赖钉死(`gdal==3.8.4`)、久未更新的问题,保留核心功能与 API 习惯。
4
+
5
+ ## 与原库的差异
6
+
7
+ | 维度 | 原 interpies | interpies_lite |
8
+ | --- | --- | --- |
9
+ | 栅格读写 | rasterio + 钉死 gdal==3.8.4 | rasterio>=1.3(可选,未装时只能用 `Grid.from_array`) |
10
+ | SEGY 模块 | obspy 依赖 | 砍掉 |
11
+ | 色表数据 | 35 KB 硬编码 LUT | 内置 Geosoft clra / parula 近似色表,其他直接用 matplotlib 色表 |
12
+ | Grid 实现 | 普通类 + 手写属性 | `@dataclass` + property,类型注解完整 |
13
+ | 依赖 | numpy/scipy/matplotlib/rasterio/gdal/scikit-image/scikit-learn | numpy/scipy/matplotlib/scikit-learn(rasterio/pyproj 可选) |
14
+ | Python | >=3.10 | >=3.10 |
15
+
16
+ ## 模块
17
+
18
+ ```
19
+ interpies_lite/
20
+ ├── __init__.py # open() / Grid
21
+ ├── grid.py # Grid 类:IO、几何、预处理、全部位场方法
22
+ ├── transforms.py # 纯算法:导数、ISVD、傅里叶变换、延拓、平滑
23
+ ├── graphics.py # show / save_image:晕渲、色图、等值线
24
+ ├── colors.py # 内置色表
25
+ ├── spatial.py # pyproj 点投影(可选)
26
+ └── io.py # rasterio 封装
27
+ ```
28
+
29
+ ## 快速开始
30
+
31
+ ```python
32
+ import interpies_lite as ip
33
+
34
+ # 从文件加载(需要 rasterio)
35
+ g = ip.open("data/brtpgrd.gxf")
36
+ g.info()
37
+
38
+ # 从 numpy 数组构造(无任何重依赖)
39
+ import numpy as np
40
+ data = np.random.randn(100, 100)
41
+ g = ip.Grid.from_array(data, west=0, north=0, cellsize=100, crs="EPSG:32633")
42
+
43
+ # 链式调用:去趋势 → 平滑 → 边界识别
44
+ out = g.detrend(degree=1).smooth(win=5).tilt()
45
+ out.show()
46
+
47
+ # 可用变换(全部返回新 Grid):
48
+ # dx / dy / dx2 / dy2 / dxdy / dz / isvd / vi
49
+ # hgm / tilt / tg / lw / tahg
50
+ # up(z) / hp_filter_uc(z) / laplacian
51
+ # clip / resample / scale / detrend / fill_nodata / smooth
52
+ ```
53
+
54
+ ## 安装
55
+
56
+ 本包暂未发布到 PyPI,可通过以下任一方式安装:
57
+
58
+ ### 方式 1:从 GitHub 直接安装(推荐)
59
+
60
+ 公开仓库,无需下载,pip 自动拉取最新代码:
61
+
62
+ ```bash
63
+ pip install git+https://github.com/xyt556/interpies-lite.git
64
+ ```
65
+
66
+ 指定版本/分支:
67
+
68
+ ```bash
69
+ pip install git+https://github.com/xyt556/interpies-lite.git@main
70
+ ```
71
+
72
+ ### 方式 2:从本地目录安装
73
+
74
+ ```bash
75
+ cd path/to/interpies_lite
76
+ pip install .
77
+ ```
78
+
79
+ ### 方式 3:从 wheel 文件安装
80
+
81
+ ```bash
82
+ pip install dist/interpies_lite-0.1.0-py3-none-any.whl
83
+ ```
84
+
85
+ ### 方式 4:开发模式(可编辑,改代码即时生效)
86
+
87
+ ```bash
88
+ cd path/to/interpies_lite
89
+ pip install -e .
90
+ ```
91
+
92
+ ### 可选依赖(读写 GeoTIFF/GXF)
93
+
94
+ ```bash
95
+ pip install "interpies-lite[geo]"
96
+ # 等价于
97
+ pip install rasterio pyproj
98
+ ```
99
+
100
+ 核心依赖(必装):numpy、scipy、matplotlib、scikit-learn。
101
+
102
+ ## 示例
103
+
104
+ 仓库自带两个 notebook:
105
+
106
+ | Notebook | 数据 | 内容 |
107
+ | --- | --- | --- |
108
+ | `notebooks/interpies_lite_demo.ipynb` | 合成数据 | 快速上手,无需 rasterio,开箱即跑 |
109
+ | `notebooks/interpies_lite_brtpgrd_demo.ipynb` | `data/brtpgrd.gxf`(真实航磁) | 课堂版完整教程,含算法原理与公式 |
110
+
111
+ 克隆仓库后:
112
+
113
+ ```bash
114
+ cd interpies_lite
115
+ pip install -e .[geo]
116
+ jupyter notebook notebooks/
117
+ ```
118
+
119
+ `data/brtpgrd.gxf` 为 Colorado 地区航磁数据(707×629,50 m,NAD27/UTM13N),来自原 interpies 项目示例。
120
+
121
+ ## 冒烟测试
122
+
123
+ ```bash
124
+ python smoke_test.py
125
+ # 在合成网格上跑通全部变换,输出 smoke_test_output.png
126
+ ```