geostats-datasets 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,5 @@
1
+ .venv/
2
+ dist/
3
+ __pycache__/
4
+ oil-gas/3d/f3-survey/*.csv
5
+ oil-gas/3d/f3-survey/*.sgy
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gustavo Pretto Scholze
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,40 @@
1
+ Metadata-Version: 2.5
2
+ Name: geostats-datasets
3
+ Version: 0.1.0
4
+ Summary: Download mining and oil & gas geostatistics datasets by name.
5
+ Project-URL: Homepage, https://github.com/gstvschlz/datasets
6
+ Project-URL: Issues, https://github.com/gstvschlz/datasets/issues
7
+ Author: Gustavo Pretto Scholze
8
+ License-Expression: MIT
9
+ License-File: LICENSE-CODE
10
+ Keywords: datasets,drill holes,geostatistics,kriging,mining,oil and gas,training images
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: GIS
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: pooch>=1.7
18
+ Description-Content-Type: text/markdown
19
+
20
+ # geostats-datasets
21
+
22
+ Download 2D and 3D geostatistics datasets for mining and oil & gas by name: classic public
23
+ sets (Walker Lake, Jura, Strebelle and other training images, the F3 survey) and synthetic
24
+ case studies (drill holes, blastholes, block models, well logs, solids).
25
+
26
+ ```python
27
+ import geostats_datasets as gd
28
+
29
+ gd.list() # ['bangladesh', 'coal-seam', ...]
30
+ folder = gd.fetch("walker-lake") # downloads once, returns the local folder
31
+ sample = gd.fetch("walker-lake", "sample.csv")
32
+ ```
33
+
34
+ Or from the shell: `python -m geostats_datasets fetch walker-lake`.
35
+
36
+ Each dataset comes as a zip from the repository's GitHub data release, checked against its
37
+ sha256 and cached per user (set `GEOSTATS_DATASETS_DIR` to move the cache). Every folder has a
38
+ README with each file, each column, units, ranges and suggested exercises.
39
+
40
+ Catalogue, previews and licenses: https://github.com/gstvschlz/datasets
@@ -0,0 +1,62 @@
1
+ [project]
2
+ name = "geostats-datasets"
3
+ dynamic = ["version"]
4
+ description = "Download mining and oil & gas geostatistics datasets by name."
5
+ readme = { content-type = "text/markdown", text = """
6
+ # geostats-datasets
7
+
8
+ Download 2D and 3D geostatistics datasets for mining and oil & gas by name: classic public
9
+ sets (Walker Lake, Jura, Strebelle and other training images, the F3 survey) and synthetic
10
+ case studies (drill holes, blastholes, block models, well logs, solids).
11
+
12
+ ```python
13
+ import geostats_datasets as gd
14
+
15
+ gd.list() # ['bangladesh', 'coal-seam', ...]
16
+ folder = gd.fetch("walker-lake") # downloads once, returns the local folder
17
+ sample = gd.fetch("walker-lake", "sample.csv")
18
+ ```
19
+
20
+ Or from the shell: `python -m geostats_datasets fetch walker-lake`.
21
+
22
+ Each dataset comes as a zip from the repository's GitHub data release, checked against its
23
+ sha256 and cached per user (set `GEOSTATS_DATASETS_DIR` to move the cache). Every folder has a
24
+ README with each file, each column, units, ranges and suggested exercises.
25
+
26
+ Catalogue, previews and licenses: https://github.com/gstvschlz/datasets
27
+ """ }
28
+ license = "MIT"
29
+ license-files = ["LICENSE-CODE"]
30
+ authors = [{ name = "Gustavo Pretto Scholze" }]
31
+ requires-python = ">=3.10"
32
+ dependencies = ["pooch>=1.7"]
33
+ keywords = ["geostatistics", "datasets", "mining", "oil and gas", "kriging", "training images", "drill holes"]
34
+ classifiers = [
35
+ "Development Status :: 4 - Beta",
36
+ "Intended Audience :: Science/Research",
37
+ "Intended Audience :: Education",
38
+ "Programming Language :: Python :: 3",
39
+ "Topic :: Scientific/Engineering :: GIS",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/gstvschlz/datasets"
44
+ Issues = "https://github.com/gstvschlz/datasets/issues"
45
+
46
+ [dependency-groups]
47
+ dev = ["pytest>=8", "ruff>=0.6"]
48
+
49
+ [build-system]
50
+ requires = ["hatchling"]
51
+ build-backend = "hatchling.build"
52
+
53
+ [tool.hatch.version]
54
+ path = "src/geostats_datasets/__init__.py"
55
+
56
+ [tool.hatch.build.targets.sdist]
57
+ include = ["src"]
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ # Dataset scripts are data provenance: reformatting them would change their published zips.
62
+ extend-exclude = ["mining", "oil-gas"]
@@ -0,0 +1,51 @@
1
+ """Download mining and oil & gas geostatistics datasets by name and cache them locally."""
2
+
3
+ import os
4
+ import shutil
5
+ import zipfile
6
+ from pathlib import Path
7
+
8
+ import pooch
9
+
10
+ __version__ = "0.1.0"
11
+
12
+ # The GitHub release holding one <dataset>.zip per dataset.
13
+ DATA_RELEASE = "data-v1.0.0"
14
+
15
+ _DATA = pooch.create(
16
+ path=Path(os.environ.get("GEOSTATS_DATASETS_DIR") or pooch.os_cache("geostats-datasets"))
17
+ / DATA_RELEASE,
18
+ base_url=f"https://github.com/gstvschlz/datasets/releases/download/{DATA_RELEASE}/",
19
+ )
20
+ _DATA.load_registry(Path(__file__).with_name("registry.txt"))
21
+
22
+
23
+ def list():
24
+ """Names of all datasets, e.g. 'walker-lake'."""
25
+ return sorted(name.removesuffix(".zip") for name in _DATA.registry)
26
+
27
+
28
+ def fetch(name, file=None):
29
+ """Download a dataset and return the local path of its folder, or of one of its files.
30
+
31
+ The zip is checked against its sha256, downloaded once and unpacked into the cache.
32
+ """
33
+ if f"{name}.zip" not in _DATA.registry:
34
+ raise ValueError(f"Unknown dataset {name!r}; see geostats_datasets.list() for names.")
35
+ archive = Path(_DATA.fetch(f"{name}.zip"))
36
+ folder = archive.with_suffix("")
37
+ if not folder.exists():
38
+ # Unpack beside the cache and move into place, so an interrupted unpack leaves no folder.
39
+ partial = archive.with_suffix(".partial")
40
+ shutil.rmtree(partial, ignore_errors=True)
41
+ with zipfile.ZipFile(archive) as zipped:
42
+ zipped.extractall(partial)
43
+ (partial / name).rename(folder)
44
+ shutil.rmtree(partial)
45
+ if file is None:
46
+ return folder
47
+ path = folder / file
48
+ if not path.is_file():
49
+ files = sorted(p.relative_to(folder).as_posix() for p in folder.rglob("*") if p.is_file())
50
+ raise ValueError(f"{name!r} has no file {file!r}; its files are: {', '.join(files)}.")
51
+ return path
@@ -0,0 +1,16 @@
1
+ import argparse
2
+
3
+ import geostats_datasets
4
+
5
+ parser = argparse.ArgumentParser(prog="python -m geostats_datasets")
6
+ commands = parser.add_subparsers(dest="command", required=True)
7
+ commands.add_parser("list", help="print the dataset names")
8
+ fetch = commands.add_parser("fetch", help="download a dataset and print its local path")
9
+ fetch.add_argument("name", help="dataset name, e.g. walker-lake")
10
+ fetch.add_argument("file", nargs="?", help="one file of the dataset, e.g. sample.csv")
11
+ args = parser.parse_args()
12
+
13
+ if args.command == "list":
14
+ print("\n".join(geostats_datasets.list()))
15
+ else:
16
+ print(geostats_datasets.fetch(args.name, args.file))
@@ -0,0 +1,23 @@
1
+ bangladesh.zip 2450384fbaff3576e2ce687f4c613a200d48e0fe4ed7b0e881e94bbde913cd95
2
+ coal-seam.zip 34cdad454f464c463406bdfc62f22e563cd91828bc76f09e7c7d7bfeb5bd2fe5
3
+ deviated-well-logs.zip 4da728c258998c4e173b23a7021da502f1abe420d716feae8b4fa67c15dd6640
4
+ dunes.zip 7fbe419adc03983c356b3114cd37502f75dab22f04af69949d6735703841b104
5
+ f3-survey.zip f253c4366fec1c3a24878d7e491db40e479768c8948f590b180466d50b1d4a18
6
+ facies-between-horizons.zip fa00c17846406402e6cddee5256b375e0104951a0087e75d581622ad8e958e8e
7
+ fluvial-channel-reservoir.zip b2369f33f5d1d21960f1981bb86eb4a49f2b7bb570125ec142838597a489e3f2
8
+ gold-copper-soils.zip 69c8dcc72f21b5588f0d9a9e7123479eb12e3d6a9f4a0da75601ab4af90f4cfe
9
+ gold-tailings.zip c6d813c76bedbd203aef133be3ca962d116df81e7ff506ded5faf71f73569d38
10
+ gold-veins.zip 42a19417ef2e7d85b6d65409ba5628dc46e1717baa29edfb83facedc1ba456a2
11
+ iron-formation.zip ed4e69df09dc77655f7303d87efd5939e40e7a7b0c2e55a9545e3776c7049581
12
+ jura.zip 8ef4e256d65bcb8e2b48f7d49fce86cc649dc6d17de55c232a84dc3f32c5fb79
13
+ lena-delta.zip b7c60719b011a00198d6629423815c75e41342c896ffc240a2669bdfa58f1e23
14
+ nickel-laterite.zip 5e7f89ec46961fdd2c32e967020660813e5bb80698cfbd7b94b81e71645631e3
15
+ ohau.zip cacb1b404d456ad5fc9c4eb888e3f311918c4f941df26ce11c6e85da13fe1bfe
16
+ phosphate-regolith.zip ca880095043bc6a281bdb415f33d1ebb5e36050a0d63ce4b5c08745b7cc801aa
17
+ pore-scale-grain-image.zip 9f36cfd9c07b39ee230da688d403d2f8a6ccca75cdf0bb9d3387d34cf681f286
18
+ porphyry-geometallurgy.zip 07e8494148f8c7a6c9e89a7f4ed232ae23f6490e29241d61963d52447971aa15
19
+ seismic-guided-porosity.zip 2f709807e6075b6fc48812c451394d9a38b69202ad411a522e88917be85e28f1
20
+ strebelle.zip 60130de1de0a4ec178566f519f337a70a718be13c70fc2d80fd659696fbbe073
21
+ walker-lake.zip b3491d4fe13b61fbc155f2b4a7ee8e39f25e95224f354294ce9290dc6b0afdf8
22
+ west-coast-africa.zip 0cdcbfc6cdca32ba1b0bfe5d6247c8e0e32ddac2b3d67bcd6819951caab1b7fb
23
+ zinc-vms-lenses.zip d1c8720c639811c41ca36eed7fbea236c97541d79f15d7f93cfdb160bf0cf969