Skip to main content

pygeoglim

PyPI version Python versions License: MIT Downloads

pygeoglim is a Python package for fetching raw lithology and hydrogeology data from GLiM and GLHYMPS 2.0 for any watershed on Earth. It returns GeoDataFrames of geology polygons that callers can analyse freely, with CAMELS-style attribute summaries as an integrated convenience layer. Built for hydrological modelling, large-sample hydrology, and Earth system research.

📋 Table of Contents

📦 Installation

From PyPI (Recommended)

pip install pygeoglim

From GitHub

pip install git+https://github.com/galib9690/pygeoglim.git

Development Mode

git clone https://github.com/galib9690/pygeoglim.git
cd pygeoglim
pip install -e .

🚀 Quick Start

Basic Usage

from shapely.geometry import box
from pygeoglim import fetch_glim, fetch_glhymps, glim_attributes, glhymps_attributes

# Define a watershed bounding box (lon_min, lat_min, lon_max, lat_max)
watershed = box(-85.5, 39.5, -85.0, 40.0)

# Fetch raw geology polygons (GeoDataFrames)
lithology  = fetch_glim(watershed)      # GLiM — lithology polygons
hydrogeol  = fetch_glhymps(watershed)   # GLHYMPS — permeability polygons

# CAMELS-style attribute summaries
glim   = glim_attributes(lithology)
glhymp = glhymps_attributes(hydrogeol)

print(glim)    # {'geol_1st_class': ..., 'carbonate_rocks_frac': ..., ...}
print(glhymp)  # {'geol_porosity': ..., 'geol_permeability': ..., ...}

Global Watersheds (non-CONUS)

from shapely.geometry import box
from pygeoglim import fetch_glim, fetch_glhymps

# Rhine headwaters, Germany — pass region="global" for non-CONUS
rhine = box(6.0, 46.5, 8.5, 48.5)

lithology = fetch_glim(rhine, region="global")
hydrogeol = fetch_glhymps(rhine, region="global")

Requires a HuggingFace token for global tiles. Run huggingface-cli login once or set the HF_TOKEN environment variable.

Using Shapefile Input

from pygeoglim import load_geometry, fetch_glim

# Load geometry from a shapefile
geom = load_geometry(shapefile="path/to/watershed.shp")
lithology = fetch_glim(geom)

📊 Extracted Attributes

Lithology (GLiM Dataset)

Attribute Description
geol_1st_class Dominant lithology class
glim_1st_class_frac Fraction of dominant class
geol_2nd_class Second most common lithology class
glim_2nd_class_frac Fraction of second most common class
carbonate_rocks_frac Fraction of carbonate rocks

Hydrogeology (GLHYMPS Dataset)

Attribute Description Units
geol_porosity Area-weighted porosity fraction
geol_permeability Area-weighted permeability log₁₀ m²
geol_permeability_linear Permeability (linear scale) m²
hydraulic_conductivity Hydraulic conductivity m/s

🌍 Data Sources

GLiM – Global Lithological Map

  • Citation: Hartmann, J. & Moosdorf, N. (2012). The new global lithological map database GLiM: A representation of rock properties at the Earth surface. Geochemistry, Geophysics, Geosystems, 13. doi:10.1029/2012GC004370
  • Dataset DOI: 10.1594/PANGAEA.788537
  • License: Personal research use only — redistribution requires written permission from the Commission for the Geological Map of the World (CCGM).

GLHYMPS 2.0 – Global Hydrogeology Maps

📋 Requirements

  • Python ≥ 3.9
  • geopandas ≥ 0.13
  • shapely ≥ 2.0
  • numpy ≥ 1.24
  • pyproj ≥ 3.6
  • huggingface_hub ≥ 0.20

📖 Citation

If you use this package in your research, please cite:

@software{galib2025pygeoglim,
  author = {Galib, Mohammad and Merwade, Venkatesh},
  title  = {pygeoglim: A Python package for extracting geological attributes from GLiM and GLHYMPS datasets},
  url    = {https://github.com/galib9690/pygeoglim},
  doi    = {10.5281/zenodo.17314746},
  year   = {2025}
}

Please also cite the original datasets (GLiM and GLHYMPS) as referenced in the Data Sources section.

🐛 Issues and Support

If you encounter any problems or have questions:

  • Check the Issues page
  • Create a new issue with a detailed description
  • Include your Python version, package version, and error messages

🤝 License

Distributed under the MIT License. See LICENSE for more information.

👨‍💻 Author

Mohammad Galib
Purdue University


Made with ❤️

Metadata

Release files for pygeoglim 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygeoglim 1.3.1
File Size Uploaded
pygeoglim-1.3.1.tar.gz 31.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygeoglim 1.3.1
File Interpreter ABI Platform
pygeoglim-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 64.8 kB

Release files / pygeoglim-1.3.1.tar.gz

Download URL pygeoglim-1.3.1.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
109e20d32a5bd29ce2dc5b6c063d45ad2da93be1dfa4efd622d633c219213d40
BLAKE2b-256 checksum
How to use checksums
ec6f4d080f6cb2e8d84cfa58b6b94c98942738224bea2ff95571685d08426bf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / pygeoglim-1.3.1-py3-none-any.whl

Download URL pygeoglim-1.3.1-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1badc9880b2644121af6f2df61648c9b207a28912fed51b01cf59d69c6b05b43
BLAKE2b-256 checksum
How to use checksums
03a8003ec1603453a94e575c1fae2e7ff235fa5c2916f2ad44eb1d371c518b1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page