Skip to main content

GLiM lithology + GLHYMPS hydrogeology attributes for watersheds and regions

Project description

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)
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 ❤️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygeoglim-1.3.1.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygeoglim-1.3.1-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file pygeoglim-1.3.1.tar.gz.

File metadata

  • Download URL: pygeoglim-1.3.1.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pygeoglim-1.3.1.tar.gz
Algorithm Hash digest
SHA256 109e20d32a5bd29ce2dc5b6c063d45ad2da93be1dfa4efd622d633c219213d40
MD5 1b4afb402d7aa04068364fd01a681395
BLAKE2b-256 ec6f4d080f6cb2e8d84cfa58b6b94c98942738224bea2ff95571685d08426bf5

See more details on using hashes here.

File details

Details for the file pygeoglim-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: pygeoglim-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pygeoglim-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1badc9880b2644121af6f2df61648c9b207a28912fed51b01cf59d69c6b05b43
MD5 b2d7a79fa8295f1b9515d43b6f0902e9
BLAKE2b-256 03a8003ec1603453a94e575c1fae2e7ff235fa5c2916f2ad44eb1d371c518b1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page