python-gdb 0.1.0__tar.gz → 0.2.1__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.
- python_gdb-0.1.0/README.md → python_gdb-0.2.1/PKG-INFO +78 -11
- python_gdb-0.1.0/PKG-INFO → python_gdb-0.2.1/README.md +39 -39
- {python_gdb-0.1.0 → python_gdb-0.2.1}/pygdb/__init__.py +10 -1
- python_gdb-0.2.1/pygdb/gdb.py +1943 -0
- python_gdb-0.2.1/pygdb/gdb_reader.py +1945 -0
- {python_gdb-0.1.0 → python_gdb-0.2.1}/pygdb/grd_reader.py +174 -54
- python_gdb-0.2.1/pygdb/lzrw1.py +584 -0
- python_gdb-0.2.1/pygdb/registry.py +272 -0
- {python_gdb-0.1.0 → python_gdb-0.2.1}/pyproject.toml +28 -1
- {python_gdb-0.1.0 → python_gdb-0.2.1}/rust/Cargo.lock +17 -1
- {python_gdb-0.1.0 → python_gdb-0.2.1}/rust/Cargo.toml +13 -2
- python_gdb-0.2.1/rust/src/lib.rs +660 -0
- python_gdb-0.1.0/pygdb/gdb.py +0 -641
- python_gdb-0.1.0/pygdb/gdb_reader.py +0 -1368
- python_gdb-0.1.0/pygdb/lzrw1.py +0 -323
- python_gdb-0.1.0/pygdb/registry.py +0 -104
- python_gdb-0.1.0/rust/src/lib.rs +0 -162
- {python_gdb-0.1.0 → python_gdb-0.2.1}/LICENSE +0 -0
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-gdb
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
7
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Dist: numpy>=2.2
|
|
14
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
15
|
+
Requires-Dist: xarray ; extra == 'dev'
|
|
16
|
+
Requires-Dist: geoh5py ; extra == 'dev'
|
|
17
|
+
Requires-Dist: pandas ; extra == 'dev'
|
|
18
|
+
Requires-Dist: zensical ; extra == 'docs'
|
|
19
|
+
Requires-Dist: mkdocstrings-python ; extra == 'docs'
|
|
20
|
+
Requires-Dist: geoh5py ; extra == 'geoh5'
|
|
21
|
+
Requires-Dist: pandas ; extra == 'pandas'
|
|
22
|
+
Requires-Dist: xarray ; extra == 'xarray'
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Provides-Extra: docs
|
|
25
|
+
Provides-Extra: geoh5
|
|
26
|
+
Provides-Extra: pandas
|
|
27
|
+
Provides-Extra: xarray
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Summary: A clean-room Python reader for Geosoft .gdb database and .grd grid files
|
|
30
|
+
Author-email: Joseph Capriotti <josephrcapriotti@gmail.com>
|
|
31
|
+
License-Expression: MIT
|
|
32
|
+
Requires-Python: >=3.12
|
|
33
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
34
|
+
Project-URL: Documentation, https://jcapriot.github.io/pygdb/
|
|
35
|
+
Project-URL: Homepage, https://github.com/jcapriot/pygdb
|
|
36
|
+
Project-URL: Issues, https://github.com/jcapriot/pygdb/issues
|
|
37
|
+
Project-URL: Repository, https://github.com/jcapriot/pygdb
|
|
38
|
+
|
|
1
39
|
# pygdb
|
|
2
40
|
|
|
3
41
|
A clean-room Python reader for Geosoft's proprietary `.gdb` ("Geosoft
|
|
@@ -21,7 +59,10 @@ real, publicly downloaded `.gdb` files. No Geosoft software of any kind
|
|
|
21
59
|
Desktop, or the free Geosoft Viewer) was installed, imported, or
|
|
22
60
|
executed at any point in producing it.
|
|
23
61
|
|
|
24
|
-
Reading only — writing or mutating `.gdb`/`.grd` files
|
|
62
|
+
Reading only — writing or mutating `.gdb`/`.grd` files (Geosoft's own
|
|
63
|
+
proprietary formats) is out of scope. Exporting what's been read into a
|
|
64
|
+
different, openly-specified format is a separate concern and *is*
|
|
65
|
+
supported -- see `to_xarray`/`to_geoh5`/`to_dataframe` below.
|
|
25
66
|
|
|
26
67
|
## Installation
|
|
27
68
|
|
|
@@ -48,6 +89,8 @@ db = GDB("example.gdb")
|
|
|
48
89
|
|
|
49
90
|
db.compression # CompressionInfo(code=0, name='DB_COMP_NONE', ...)
|
|
50
91
|
db.coordinate_systems # ['NAD83 / UTM zone 11N', 'WGS 84'] (best-effort, may be [])
|
|
92
|
+
db.coordinate_channels # {'X': 'Easting', 'Y': 'Northing', 'Z': None} (from the
|
|
93
|
+
# file's own internal registry, may be all-None)
|
|
51
94
|
|
|
52
95
|
db.line_names[:5] # ['L1000', 'L1001', 'L1010', 'L1020', 'L1030']
|
|
53
96
|
db.channels_on_line("L1000") # channels that actually have data on this line
|
|
@@ -60,10 +103,23 @@ db.read("L1000", "Easting") # random access by (line name, channel name)
|
|
|
60
103
|
See [the docs](docs/index.md) for the lower-level, slot-index-based
|
|
61
104
|
functions `GDB` is built on.
|
|
62
105
|
|
|
63
|
-
`db.to_xarray("L1000")` exports one line
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
106
|
+
`db.to_xarray("L1000")` exports one line (or `db.to_xarray()` for the
|
|
107
|
+
whole file, every line stacked along a `"line"` coordinate) to an
|
|
108
|
+
`xarray.Dataset` (`pip install python-gdb[xarray]`, an optional
|
|
109
|
+
dependency) — see
|
|
110
|
+
[the docs](docs/index.md#exporting-to-xarray) for how VA/array channels,
|
|
111
|
+
duplicate channel names, and whole-file fill values come through.
|
|
112
|
+
|
|
113
|
+
`db.to_geoh5("survey.geoh5")` exports the whole file to a
|
|
114
|
+
`geoh5py.Workspace` (`pip install python-gdb[geoh5]`, an optional
|
|
115
|
+
dependency) — see [the docs](docs/index.md#exporting-to-geoh5) for how
|
|
116
|
+
line geometry and VA/array channels come through.
|
|
117
|
+
|
|
118
|
+
`db.to_dataframe()` exports the whole file (or `db.to_dataframe("L1000")`
|
|
119
|
+
for just one line) to a `pandas.DataFrame` (`pip install
|
|
120
|
+
python-gdb[pandas]`, an optional dependency) — see
|
|
121
|
+
[the docs](docs/index.md#exporting-to-pandas) for how row-count
|
|
122
|
+
mismatches and VA/array channels come through.
|
|
67
123
|
|
|
68
124
|
## Optional Rust-accelerated backend
|
|
69
125
|
|
|
@@ -74,9 +130,12 @@ so that an optional Rust extension (`pygdb._native`, source under
|
|
|
74
130
|
[`rust/`](rust/)) rides along and is used automatically when present:
|
|
75
131
|
it accelerates the two real CPU-bound hot paths profiling found in this
|
|
76
132
|
reader — LZRW1 decompression and fixed-width string decoding — roughly
|
|
77
|
-
3-6x on real files, measured against this project's own sample corpus
|
|
78
|
-
`
|
|
79
|
-
|
|
133
|
+
3-6x on real files, measured against this project's own sample corpus,
|
|
134
|
+
and decompresses `DB_COMP_SIZE` (zlib) data ~11% faster than the stdlib
|
|
135
|
+
fallback with one fewer copy, using the `flate2` crate on its
|
|
136
|
+
`zlib-rs` backend. `pygdb/lzrw1.py`/`pygdb/gdb_reader.py` detect it at
|
|
137
|
+
import time and fall back to plain Python transparently if it isn't
|
|
138
|
+
there.
|
|
80
139
|
|
|
81
140
|
Building it yourself (e.g. for local development, or a platform without
|
|
82
141
|
a published wheel) needs a Rust toolchain:
|
|
@@ -107,9 +166,12 @@ option — `abi3t` only exists from 3.15 onward).
|
|
|
107
166
|
## Documentation
|
|
108
167
|
|
|
109
168
|
Full documentation — the format specification, usage, contributing
|
|
110
|
-
guide, and research provenance —
|
|
111
|
-
|
|
112
|
-
|
|
169
|
+
guide, and research provenance — is published at
|
|
170
|
+
**[jcapriot.github.io/pygdb](https://jcapriot.github.io/pygdb/)**,
|
|
171
|
+
built from [`docs/`](docs/index.md) with [Zensical](https://zensical.org/)
|
|
172
|
+
(published on every GitHub Release — see
|
|
173
|
+
[`.github/workflows/docs.yml`](.github/workflows/docs.yml)). To view a
|
|
174
|
+
work-in-progress version locally instead:
|
|
113
175
|
|
|
114
176
|
```sh
|
|
115
177
|
pip install -e ".[docs]"
|
|
@@ -120,11 +182,15 @@ zensical serve
|
|
|
120
182
|
for the `.gdb`/`.grd` on-disk format, with a confidence rating
|
|
121
183
|
(confirmed / likely / guess / unknown) on every field. Updated as
|
|
122
184
|
more real example files are tested against it.
|
|
185
|
+
- [`docs/reference.md`](docs/reference.md) — API reference for
|
|
186
|
+
`pygdb`'s public surface, generated from its own numpydoc-style
|
|
187
|
+
docstrings via [`mkdocstrings`](https://mkdocstrings.github.io/).
|
|
123
188
|
- [`docs/contributing.md`](docs/contributing.md) — how to report bugs
|
|
124
189
|
(reproducible example files welcome) and this project's hard
|
|
125
190
|
boundary on reverse engineering.
|
|
126
191
|
- [`docs/provenance/`](docs/provenance/index.md) — the original
|
|
127
192
|
research log and write-up this implementation was derived from.
|
|
193
|
+
- [`CHANGELOG.md`](CHANGELOG.md) — what changed in each release.
|
|
128
194
|
|
|
129
195
|
## Testing
|
|
130
196
|
|
|
@@ -153,3 +219,4 @@ can be re-downloaded independently.
|
|
|
153
219
|
## License
|
|
154
220
|
|
|
155
221
|
[MIT](LICENSE) — Copyright (c) 2026 Joseph Capriotti.
|
|
222
|
+
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: python-gdb
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Classifier: Development Status :: 3 - Alpha
|
|
5
|
-
Classifier: Intended Audience :: Science/Research
|
|
6
|
-
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
7
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Requires-Dist: numpy>=2.2
|
|
14
|
-
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
15
|
-
Requires-Dist: xarray ; extra == 'dev'
|
|
16
|
-
Requires-Dist: zensical ; extra == 'docs'
|
|
17
|
-
Requires-Dist: xarray ; extra == 'xarray'
|
|
18
|
-
Provides-Extra: dev
|
|
19
|
-
Provides-Extra: docs
|
|
20
|
-
Provides-Extra: xarray
|
|
21
|
-
License-File: LICENSE
|
|
22
|
-
Summary: A clean-room Python reader for Geosoft .gdb database and .grd grid files
|
|
23
|
-
Author-email: Joseph Capriotti <josephrcapriotti@gmail.com>
|
|
24
|
-
License-Expression: MIT
|
|
25
|
-
Requires-Python: >=3.12
|
|
26
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
27
|
-
|
|
28
1
|
# pygdb
|
|
29
2
|
|
|
30
3
|
A clean-room Python reader for Geosoft's proprietary `.gdb` ("Geosoft
|
|
@@ -48,7 +21,10 @@ real, publicly downloaded `.gdb` files. No Geosoft software of any kind
|
|
|
48
21
|
Desktop, or the free Geosoft Viewer) was installed, imported, or
|
|
49
22
|
executed at any point in producing it.
|
|
50
23
|
|
|
51
|
-
Reading only — writing or mutating `.gdb`/`.grd` files
|
|
24
|
+
Reading only — writing or mutating `.gdb`/`.grd` files (Geosoft's own
|
|
25
|
+
proprietary formats) is out of scope. Exporting what's been read into a
|
|
26
|
+
different, openly-specified format is a separate concern and *is*
|
|
27
|
+
supported -- see `to_xarray`/`to_geoh5`/`to_dataframe` below.
|
|
52
28
|
|
|
53
29
|
## Installation
|
|
54
30
|
|
|
@@ -75,6 +51,8 @@ db = GDB("example.gdb")
|
|
|
75
51
|
|
|
76
52
|
db.compression # CompressionInfo(code=0, name='DB_COMP_NONE', ...)
|
|
77
53
|
db.coordinate_systems # ['NAD83 / UTM zone 11N', 'WGS 84'] (best-effort, may be [])
|
|
54
|
+
db.coordinate_channels # {'X': 'Easting', 'Y': 'Northing', 'Z': None} (from the
|
|
55
|
+
# file's own internal registry, may be all-None)
|
|
78
56
|
|
|
79
57
|
db.line_names[:5] # ['L1000', 'L1001', 'L1010', 'L1020', 'L1030']
|
|
80
58
|
db.channels_on_line("L1000") # channels that actually have data on this line
|
|
@@ -87,10 +65,23 @@ db.read("L1000", "Easting") # random access by (line name, channel name)
|
|
|
87
65
|
See [the docs](docs/index.md) for the lower-level, slot-index-based
|
|
88
66
|
functions `GDB` is built on.
|
|
89
67
|
|
|
90
|
-
`db.to_xarray("L1000")` exports one line
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
68
|
+
`db.to_xarray("L1000")` exports one line (or `db.to_xarray()` for the
|
|
69
|
+
whole file, every line stacked along a `"line"` coordinate) to an
|
|
70
|
+
`xarray.Dataset` (`pip install python-gdb[xarray]`, an optional
|
|
71
|
+
dependency) — see
|
|
72
|
+
[the docs](docs/index.md#exporting-to-xarray) for how VA/array channels,
|
|
73
|
+
duplicate channel names, and whole-file fill values come through.
|
|
74
|
+
|
|
75
|
+
`db.to_geoh5("survey.geoh5")` exports the whole file to a
|
|
76
|
+
`geoh5py.Workspace` (`pip install python-gdb[geoh5]`, an optional
|
|
77
|
+
dependency) — see [the docs](docs/index.md#exporting-to-geoh5) for how
|
|
78
|
+
line geometry and VA/array channels come through.
|
|
79
|
+
|
|
80
|
+
`db.to_dataframe()` exports the whole file (or `db.to_dataframe("L1000")`
|
|
81
|
+
for just one line) to a `pandas.DataFrame` (`pip install
|
|
82
|
+
python-gdb[pandas]`, an optional dependency) — see
|
|
83
|
+
[the docs](docs/index.md#exporting-to-pandas) for how row-count
|
|
84
|
+
mismatches and VA/array channels come through.
|
|
94
85
|
|
|
95
86
|
## Optional Rust-accelerated backend
|
|
96
87
|
|
|
@@ -101,9 +92,12 @@ so that an optional Rust extension (`pygdb._native`, source under
|
|
|
101
92
|
[`rust/`](rust/)) rides along and is used automatically when present:
|
|
102
93
|
it accelerates the two real CPU-bound hot paths profiling found in this
|
|
103
94
|
reader — LZRW1 decompression and fixed-width string decoding — roughly
|
|
104
|
-
3-6x on real files, measured against this project's own sample corpus
|
|
105
|
-
`
|
|
106
|
-
|
|
95
|
+
3-6x on real files, measured against this project's own sample corpus,
|
|
96
|
+
and decompresses `DB_COMP_SIZE` (zlib) data ~11% faster than the stdlib
|
|
97
|
+
fallback with one fewer copy, using the `flate2` crate on its
|
|
98
|
+
`zlib-rs` backend. `pygdb/lzrw1.py`/`pygdb/gdb_reader.py` detect it at
|
|
99
|
+
import time and fall back to plain Python transparently if it isn't
|
|
100
|
+
there.
|
|
107
101
|
|
|
108
102
|
Building it yourself (e.g. for local development, or a platform without
|
|
109
103
|
a published wheel) needs a Rust toolchain:
|
|
@@ -134,9 +128,12 @@ option — `abi3t` only exists from 3.15 onward).
|
|
|
134
128
|
## Documentation
|
|
135
129
|
|
|
136
130
|
Full documentation — the format specification, usage, contributing
|
|
137
|
-
guide, and research provenance —
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
guide, and research provenance — is published at
|
|
132
|
+
**[jcapriot.github.io/pygdb](https://jcapriot.github.io/pygdb/)**,
|
|
133
|
+
built from [`docs/`](docs/index.md) with [Zensical](https://zensical.org/)
|
|
134
|
+
(published on every GitHub Release — see
|
|
135
|
+
[`.github/workflows/docs.yml`](.github/workflows/docs.yml)). To view a
|
|
136
|
+
work-in-progress version locally instead:
|
|
140
137
|
|
|
141
138
|
```sh
|
|
142
139
|
pip install -e ".[docs]"
|
|
@@ -147,11 +144,15 @@ zensical serve
|
|
|
147
144
|
for the `.gdb`/`.grd` on-disk format, with a confidence rating
|
|
148
145
|
(confirmed / likely / guess / unknown) on every field. Updated as
|
|
149
146
|
more real example files are tested against it.
|
|
147
|
+
- [`docs/reference.md`](docs/reference.md) — API reference for
|
|
148
|
+
`pygdb`'s public surface, generated from its own numpydoc-style
|
|
149
|
+
docstrings via [`mkdocstrings`](https://mkdocstrings.github.io/).
|
|
150
150
|
- [`docs/contributing.md`](docs/contributing.md) — how to report bugs
|
|
151
151
|
(reproducible example files welcome) and this project's hard
|
|
152
152
|
boundary on reverse engineering.
|
|
153
153
|
- [`docs/provenance/`](docs/provenance/index.md) — the original
|
|
154
154
|
research log and write-up this implementation was derived from.
|
|
155
|
+
- [`CHANGELOG.md`](CHANGELOG.md) — what changed in each release.
|
|
155
156
|
|
|
156
157
|
## Testing
|
|
157
158
|
|
|
@@ -180,4 +181,3 @@ can be re-downloaded independently.
|
|
|
180
181
|
## License
|
|
181
182
|
|
|
182
183
|
[MIT](LICENSE) — Copyright (c) 2026 Joseph Capriotti.
|
|
183
|
-
|
|
@@ -57,4 +57,13 @@ __all__ = [
|
|
|
57
57
|
"read_lines",
|
|
58
58
|
]
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
# Reads the installed distribution's metadata -- itself sourced
|
|
64
|
+
# from rust/Cargo.toml's [package].version via pyproject.toml's
|
|
65
|
+
# dynamic version (see [project] there), so this never needs its
|
|
66
|
+
# own hardcoded copy to keep in sync.
|
|
67
|
+
__version__ = version("python-gdb")
|
|
68
|
+
except PackageNotFoundError: # pragma: no cover -- only when not installed
|
|
69
|
+
__version__ = "0.0.0+unknown"
|