python-gdb 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joseph Capriotti
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
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,183 @@
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
+ # pygdb
29
+
30
+ A clean-room Python reader for Geosoft's proprietary `.gdb` ("Geosoft
31
+ Database") binary format and the sibling `.grd` grid format.
32
+
33
+ > [!IMPORTANT]
34
+ > This project has **no affiliation with, and is not endorsed,
35
+ > sponsored, or certified by, Geosoft Inc., Seequent, Bentley Systems,
36
+ > or any of their successors.** "Geosoft" and "Oasis montaj" are
37
+ > trademarks of their respective owners. This is an independent,
38
+ > third-party implementation produced entirely by clean-room means —
39
+ > see [Provenance](docs/provenance/index.md) for the full research
40
+ > trail.
41
+
42
+ It was built using only publicly available information: vendor-published
43
+ open-source code and documentation, independent third-party format
44
+ readers, one openly-specified independent successor format (`.geoh5`,
45
+ read via the third-party `geoh5py` library), and byte-level analysis of
46
+ real, publicly downloaded `.gdb` files. No Geosoft software of any kind
47
+ (the `geosoft`/`gxapi`/`gxpy` compiled package, Oasis montaj, Geosoft
48
+ Desktop, or the free Geosoft Viewer) was installed, imported, or
49
+ executed at any point in producing it.
50
+
51
+ Reading only — writing or mutating `.gdb`/`.grd` files is out of scope.
52
+
53
+ ## Installation
54
+
55
+ ```sh
56
+ pip install python-gdb
57
+ ```
58
+
59
+ The distribution is named `python-gdb` on PyPI (`pygdb` was already
60
+ registered there for an unrelated project), but the importable package
61
+ is `pygdb`. On a platform/Python version this project publishes a
62
+ prebuilt wheel for, that automatically includes the optional Rust
63
+ accelerator (see below) -- nothing extra to install or configure.
64
+ Elsewhere, `pip` falls back to building from source, which needs a Rust
65
+ toolchain. `numpy` is the one required dependency (used to return
66
+ correctly-shaped arrays -- see Quick start below); everything else is
67
+ optional.
68
+
69
+ ## Quick start
70
+
71
+ ```python
72
+ from pygdb import GDB
73
+
74
+ db = GDB("example.gdb")
75
+
76
+ db.compression # CompressionInfo(code=0, name='DB_COMP_NONE', ...)
77
+ db.coordinate_systems # ['NAD83 / UTM zone 11N', 'WGS 84'] (best-effort, may be [])
78
+
79
+ db.line_names[:5] # ['L1000', 'L1001', 'L1010', 'L1020', 'L1030']
80
+ db.channels_on_line("L1000") # channels that actually have data on this line
81
+ db.read("L1000", "Easting") # random access by (line name, channel name)
82
+ # -> ndarray, shape (n_rows,) for a scalar
83
+ # channel, (n_rows, array_width) for a
84
+ # VA/array channel (docs/spec.md section 5)
85
+ ```
86
+
87
+ See [the docs](docs/index.md) for the lower-level, slot-index-based
88
+ functions `GDB` is built on.
89
+
90
+ `db.to_xarray("L1000")` exports one line to an `xarray.Dataset`
91
+ (`pip install python-gdb[xarray]`, an optional dependency) — see
92
+ [the docs](docs/index.md#exporting-to-xarray) for how VA/array channels
93
+ and duplicate channel names come through.
94
+
95
+ ## Optional Rust-accelerated backend
96
+
97
+ The pure-Python code in `pygdb/` is always the reference implementation
98
+ and always fully correct and usable on its own — nothing here depends
99
+ on Rust. This package is built with [`maturin`](https://www.maturin.rs/)
100
+ so that an optional Rust extension (`pygdb._native`, source under
101
+ [`rust/`](rust/)) rides along and is used automatically when present:
102
+ it accelerates the two real CPU-bound hot paths profiling found in this
103
+ reader — LZRW1 decompression and fixed-width string decoding — roughly
104
+ 3-6x on real files, measured against this project's own sample corpus.
105
+ `pygdb/lzrw1.py`/`pygdb/gdb_reader.py` detect it at import time and fall
106
+ back to plain Python transparently if it isn't there.
107
+
108
+ Building it yourself (e.g. for local development, or a platform without
109
+ a published wheel) needs a Rust toolchain:
110
+
111
+ ```sh
112
+ pip install -e ".[dev]" # compiles pygdb._native as part of the install
113
+ ```
114
+
115
+ or, for a release-optimized build without an editable install:
116
+
117
+ ```sh
118
+ pip install maturin
119
+ maturin build --release --manifest-path rust/Cargo.toml
120
+ ```
121
+
122
+ See [`rust/src/lib.rs`](rust/src/lib.rs) for what's implemented (and,
123
+ just as importantly, what was tried and deliberately left out after
124
+ being benchmarked as not worth it — a parallel batch decoder and a
125
+ memory-mapped-file I/O path, both documented there with real numbers),
126
+ and [`.github/workflows/wheels.yml`](.github/workflows/wheels.yml) for
127
+ the released wheel matrix: an `abi3` wheel per platform covering every
128
+ non-free-threaded CPython ≥3.12, an `abi3.abi3t` wheel per platform
129
+ (PEP 803) covering both the GIL-enabled and free-threaded builds of
130
+ CPython ≥3.15 with a single wheel, and one version-specific wheel per
131
+ platform for 3.14's free-threaded build (`3.14t` has no stable-ABI
132
+ option — `abi3t` only exists from 3.15 onward).
133
+
134
+ ## Documentation
135
+
136
+ Full documentation — the format specification, usage, contributing
137
+ guide, and research provenance — lives under [`docs/`](docs/index.md)
138
+ and is built with [Zensical](https://zensical.org/). To view it
139
+ locally:
140
+
141
+ ```sh
142
+ pip install -e ".[docs]"
143
+ zensical serve
144
+ ```
145
+
146
+ - [`docs/spec.md`](docs/spec.md) — the living reference specification
147
+ for the `.gdb`/`.grd` on-disk format, with a confidence rating
148
+ (confirmed / likely / guess / unknown) on every field. Updated as
149
+ more real example files are tested against it.
150
+ - [`docs/contributing.md`](docs/contributing.md) — how to report bugs
151
+ (reproducible example files welcome) and this project's hard
152
+ boundary on reverse engineering.
153
+ - [`docs/provenance/`](docs/provenance/index.md) — the original
154
+ research log and write-up this implementation was derived from.
155
+
156
+ ## Testing
157
+
158
+ ```sh
159
+ pip install -e ".[dev]"
160
+ pytest
161
+ ```
162
+
163
+ Most of the suite is synthetic-fixture unit tests (`tests/test_*.py`,
164
+ minus `test_integration_samples.py`) that build minimal `.gdb`/`.grd`
165
+ byte layouts by hand — no sample data required, safe to run anywhere
166
+ including CI. `tests/test_integration_samples.py` additionally
167
+ cross-checks the reader against real files in a local, gitignored
168
+ `samples/` directory when present, and skips (not fails) when it's
169
+ absent.
170
+
171
+ ## Sample data
172
+
173
+ Real `.gdb`/`.grd` sample files used during development are **not**
174
+ committed to this repository or otherwise redistributed — we don't
175
+ necessarily have redistribution rights for them. See
176
+ [`docs/provenance/notes.md`](docs/provenance/notes.md) for exact
177
+ provenance (source URL/DOI/portal, size) for every sample used, so they
178
+ can be re-downloaded independently.
179
+
180
+ ## License
181
+
182
+ [MIT](LICENSE) — Copyright (c) 2026 Joseph Capriotti.
183
+
@@ -0,0 +1,155 @@
1
+ # pygdb
2
+
3
+ A clean-room Python reader for Geosoft's proprietary `.gdb` ("Geosoft
4
+ Database") binary format and the sibling `.grd` grid format.
5
+
6
+ > [!IMPORTANT]
7
+ > This project has **no affiliation with, and is not endorsed,
8
+ > sponsored, or certified by, Geosoft Inc., Seequent, Bentley Systems,
9
+ > or any of their successors.** "Geosoft" and "Oasis montaj" are
10
+ > trademarks of their respective owners. This is an independent,
11
+ > third-party implementation produced entirely by clean-room means —
12
+ > see [Provenance](docs/provenance/index.md) for the full research
13
+ > trail.
14
+
15
+ It was built using only publicly available information: vendor-published
16
+ open-source code and documentation, independent third-party format
17
+ readers, one openly-specified independent successor format (`.geoh5`,
18
+ read via the third-party `geoh5py` library), and byte-level analysis of
19
+ real, publicly downloaded `.gdb` files. No Geosoft software of any kind
20
+ (the `geosoft`/`gxapi`/`gxpy` compiled package, Oasis montaj, Geosoft
21
+ Desktop, or the free Geosoft Viewer) was installed, imported, or
22
+ executed at any point in producing it.
23
+
24
+ Reading only — writing or mutating `.gdb`/`.grd` files is out of scope.
25
+
26
+ ## Installation
27
+
28
+ ```sh
29
+ pip install python-gdb
30
+ ```
31
+
32
+ The distribution is named `python-gdb` on PyPI (`pygdb` was already
33
+ registered there for an unrelated project), but the importable package
34
+ is `pygdb`. On a platform/Python version this project publishes a
35
+ prebuilt wheel for, that automatically includes the optional Rust
36
+ accelerator (see below) -- nothing extra to install or configure.
37
+ Elsewhere, `pip` falls back to building from source, which needs a Rust
38
+ toolchain. `numpy` is the one required dependency (used to return
39
+ correctly-shaped arrays -- see Quick start below); everything else is
40
+ optional.
41
+
42
+ ## Quick start
43
+
44
+ ```python
45
+ from pygdb import GDB
46
+
47
+ db = GDB("example.gdb")
48
+
49
+ db.compression # CompressionInfo(code=0, name='DB_COMP_NONE', ...)
50
+ db.coordinate_systems # ['NAD83 / UTM zone 11N', 'WGS 84'] (best-effort, may be [])
51
+
52
+ db.line_names[:5] # ['L1000', 'L1001', 'L1010', 'L1020', 'L1030']
53
+ db.channels_on_line("L1000") # channels that actually have data on this line
54
+ db.read("L1000", "Easting") # random access by (line name, channel name)
55
+ # -> ndarray, shape (n_rows,) for a scalar
56
+ # channel, (n_rows, array_width) for a
57
+ # VA/array channel (docs/spec.md section 5)
58
+ ```
59
+
60
+ See [the docs](docs/index.md) for the lower-level, slot-index-based
61
+ functions `GDB` is built on.
62
+
63
+ `db.to_xarray("L1000")` exports one line to an `xarray.Dataset`
64
+ (`pip install python-gdb[xarray]`, an optional dependency) — see
65
+ [the docs](docs/index.md#exporting-to-xarray) for how VA/array channels
66
+ and duplicate channel names come through.
67
+
68
+ ## Optional Rust-accelerated backend
69
+
70
+ The pure-Python code in `pygdb/` is always the reference implementation
71
+ and always fully correct and usable on its own — nothing here depends
72
+ on Rust. This package is built with [`maturin`](https://www.maturin.rs/)
73
+ so that an optional Rust extension (`pygdb._native`, source under
74
+ [`rust/`](rust/)) rides along and is used automatically when present:
75
+ it accelerates the two real CPU-bound hot paths profiling found in this
76
+ reader — LZRW1 decompression and fixed-width string decoding — roughly
77
+ 3-6x on real files, measured against this project's own sample corpus.
78
+ `pygdb/lzrw1.py`/`pygdb/gdb_reader.py` detect it at import time and fall
79
+ back to plain Python transparently if it isn't there.
80
+
81
+ Building it yourself (e.g. for local development, or a platform without
82
+ a published wheel) needs a Rust toolchain:
83
+
84
+ ```sh
85
+ pip install -e ".[dev]" # compiles pygdb._native as part of the install
86
+ ```
87
+
88
+ or, for a release-optimized build without an editable install:
89
+
90
+ ```sh
91
+ pip install maturin
92
+ maturin build --release --manifest-path rust/Cargo.toml
93
+ ```
94
+
95
+ See [`rust/src/lib.rs`](rust/src/lib.rs) for what's implemented (and,
96
+ just as importantly, what was tried and deliberately left out after
97
+ being benchmarked as not worth it — a parallel batch decoder and a
98
+ memory-mapped-file I/O path, both documented there with real numbers),
99
+ and [`.github/workflows/wheels.yml`](.github/workflows/wheels.yml) for
100
+ the released wheel matrix: an `abi3` wheel per platform covering every
101
+ non-free-threaded CPython ≥3.12, an `abi3.abi3t` wheel per platform
102
+ (PEP 803) covering both the GIL-enabled and free-threaded builds of
103
+ CPython ≥3.15 with a single wheel, and one version-specific wheel per
104
+ platform for 3.14's free-threaded build (`3.14t` has no stable-ABI
105
+ option — `abi3t` only exists from 3.15 onward).
106
+
107
+ ## Documentation
108
+
109
+ Full documentation — the format specification, usage, contributing
110
+ guide, and research provenance — lives under [`docs/`](docs/index.md)
111
+ and is built with [Zensical](https://zensical.org/). To view it
112
+ locally:
113
+
114
+ ```sh
115
+ pip install -e ".[docs]"
116
+ zensical serve
117
+ ```
118
+
119
+ - [`docs/spec.md`](docs/spec.md) — the living reference specification
120
+ for the `.gdb`/`.grd` on-disk format, with a confidence rating
121
+ (confirmed / likely / guess / unknown) on every field. Updated as
122
+ more real example files are tested against it.
123
+ - [`docs/contributing.md`](docs/contributing.md) — how to report bugs
124
+ (reproducible example files welcome) and this project's hard
125
+ boundary on reverse engineering.
126
+ - [`docs/provenance/`](docs/provenance/index.md) — the original
127
+ research log and write-up this implementation was derived from.
128
+
129
+ ## Testing
130
+
131
+ ```sh
132
+ pip install -e ".[dev]"
133
+ pytest
134
+ ```
135
+
136
+ Most of the suite is synthetic-fixture unit tests (`tests/test_*.py`,
137
+ minus `test_integration_samples.py`) that build minimal `.gdb`/`.grd`
138
+ byte layouts by hand — no sample data required, safe to run anywhere
139
+ including CI. `tests/test_integration_samples.py` additionally
140
+ cross-checks the reader against real files in a local, gitignored
141
+ `samples/` directory when present, and skips (not fails) when it's
142
+ absent.
143
+
144
+ ## Sample data
145
+
146
+ Real `.gdb`/`.grd` sample files used during development are **not**
147
+ committed to this repository or otherwise redistributed — we don't
148
+ necessarily have redistribution rights for them. See
149
+ [`docs/provenance/notes.md`](docs/provenance/notes.md) for exact
150
+ provenance (source URL/DOI/portal, size) for every sample used, so they
151
+ can be re-downloaded independently.
152
+
153
+ ## License
154
+
155
+ [MIT](LICENSE) — Copyright (c) 2026 Joseph Capriotti.
@@ -0,0 +1,60 @@
1
+ """
2
+ pygdb: a clean-room Python reader for Geosoft's proprietary `.gdb`
3
+ ("Geosoft Database") and sibling `.grd` grid file formats.
4
+
5
+ This package is an independent, third-party implementation produced by
6
+ reverse-engineering the on-disk format using only publicly available
7
+ information (vendor-published open-source code/docs, independent
8
+ third-party readers, and byte-level analysis of real, publicly
9
+ downloaded sample files). It has no affiliation with, and is not
10
+ endorsed by, Geosoft Inc., Seequent, or Bentley Systems -- see
11
+ docs/provenance/ for the full research trail behind this
12
+ implementation.
13
+
14
+ Reading only: writing/mutating `.gdb` or `.grd` files is out of scope.
15
+ """
16
+
17
+ from .gdb import GDB, CompressionInfo
18
+ from .gdb_reader import (
19
+ BlobHeader,
20
+ ChannelRecord,
21
+ GDBParseWarning,
22
+ LineRecord,
23
+ check_magic,
24
+ find_blob,
25
+ find_channel_table,
26
+ find_line_table,
27
+ header_fields,
28
+ iter_blobs,
29
+ read_blob_values,
30
+ read_channels,
31
+ read_lines,
32
+ )
33
+ from .grd_reader import GrdHeader, GRDParseWarning, read_grd
34
+ from .lzrw1 import LZRW1DecodeError
35
+ from .registry import find_coordinate_systems
36
+
37
+ __all__ = [
38
+ "GDB",
39
+ "BlobHeader",
40
+ "ChannelRecord",
41
+ "CompressionInfo",
42
+ "GDBParseWarning",
43
+ "GRDParseWarning",
44
+ "GrdHeader",
45
+ "LZRW1DecodeError",
46
+ "LineRecord",
47
+ "check_magic",
48
+ "find_blob",
49
+ "find_channel_table",
50
+ "find_coordinate_systems",
51
+ "find_line_table",
52
+ "header_fields",
53
+ "iter_blobs",
54
+ "read_blob_values",
55
+ "read_channels",
56
+ "read_grd",
57
+ "read_lines",
58
+ ]
59
+
60
+ __version__ = "0.1.0"