Skip to main content

A Python library for geotechnical engineering calculations.

Project description

geoeq

A Python library for geotechnical engineering calculations.

geoeq brings common geotechnical formulas into one consistent, validated, and well-documented Python package. It is built for engineers, students, and researchers who want to replace repetitive spreadsheet work with clean, reusable code.


Status

This is v0.0.1, the first public release. It covers soil property and phase-relationship formulas -- the building blocks for everything else in geotechnical engineering.

Future releases will add effective stress, bearing capacity, settlement, consolidation, earth pressure, slope stability, pile capacity, liquefaction assessment, and more.


Installation

pip install geoeq

Requires Python 3.9 or later. No external dependencies.


Quick start

from geoeq.soil import properties as sp

# Dry unit weight from specific gravity and void ratio
gamma_d = sp.dry_unit_weight(Gs=2.65, e=0.72)
print(f"Dry unit weight: {gamma_d:.2f} kN/m3")

# Saturated and submerged unit weights
gamma_sat = sp.saturated_unit_weight(Gs=2.65, e=0.72)
gamma_sub = sp.submerged_unit_weight(Gs=2.65, e=0.72)

# Phase relations
n = sp.porosity_from_void_ratio(0.72)
S = sp.degree_of_saturation(w=0.18, Gs=2.65, e=0.72)
w = sp.water_content(S=0.80, Gs=2.65, e=0.72)
e = sp.void_ratio_from_porosity(0.42)

# Relative density
Dr = sp.relative_density(e=0.60, e_max=0.85, e_min=0.45)

# Atterberg limits
PI = sp.plasticity_index(LL=48, PL=22)
LI = sp.liquidity_index(w=35, PL=22, PI=26)
CI = sp.consistency_index(w=35, LL=48, PI=26)

What is included in v0.0.1

Soil property and phase-relationship formulas

All functions validate inputs, document units in docstrings, and reference their source methods.

Void ratio and porosity

  • void_ratio_from_porosity(n) -- convert porosity to void ratio
  • porosity_from_void_ratio(e) -- convert void ratio to porosity

Degree of saturation and water content

  • degree_of_saturation(w, Gs, e) -- compute S from water content, Gs, and e
  • water_content(S, Gs, e) -- compute w from saturation, Gs, and e

Unit weights

  • dry_unit_weight(Gs, e) -- dry unit weight (kN/m3)
  • saturated_unit_weight(Gs, e) -- saturated unit weight (kN/m3)
  • bulk_unit_weight(Gs, e, S) -- moist/total unit weight (kN/m3)
  • submerged_unit_weight(Gs, e) -- buoyant unit weight (kN/m3)

Density

  • dry_density(Gs, e) -- dry density (kg/m3)
  • bulk_density(Gs, e, S) -- bulk density (kg/m3)

Void ratio from other quantities

  • void_ratio_from_water_content(w, Gs, S) -- compute e from w, Gs, S
  • void_ratio_from_dry_unit_weight(gamma_d, Gs) -- compute e from gamma_d

Relative density

  • relative_density(e, e_max, e_min) -- density index for granular soils

Atterberg limits and consistency

  • plasticity_index(LL, PL) -- PI = LL - PL
  • liquidity_index(w, PL, PI) -- LI
  • consistency_index(w, LL, PI) -- CI

Core utilities

  • Validation -- input checking (positive, non-negative, range, fraction, angle)
  • Constants -- gravity, unit weight of water, atmospheric pressure
  • Types -- Soil dataclass for passing soil properties between functions

Design principles

  • Validated inputs. Every function checks that values are physically meaningful. Negative void ratios, impossible saturation, and bad angles raise clear errors.
  • Documented units. Every docstring states what units are expected and returned.
  • Traceable methods. Docstrings reference the source formula or textbook.
  • No hidden dependencies. v0.0.1 uses only the Python standard library.
  • Tested. Every formula is tested against hand-calculated values and textbook examples.

Roadmap

Version Scope
v0.0.1 Soil properties and phase relations
v0.1.x Effective stress, pore pressure, seepage
v0.2.x Shallow foundations, bearing capacity, settlement
v0.3.x Soil classification (USCS), SPT/CPT correlations
v0.4.x Earth pressure, consolidation, slope stability
v0.5.x Pile capacity, liquefaction, advanced methods
v1.0.0 Stable API, full documentation, examples

Running the tests

From a clone of this repository:

pip install -e ".[dev]"
pytest

If you only install pytest, tests still run from the project root (see pythonpath in pyproject.toml):

pip install pytest
pytest

The wheel on PyPI does not include the test files; run tests from a source checkout.


Contributing

The repository is private until around v0.5; it will then be opened for public contributions. Until then, feedback and feature requests are appreciated.

Every contribution should include the code, a test, a documentation update, and a reference for the method.


License

MIT License. See LICENSE for details.

Copyright (c) 2026 Ripon Chandra Malo

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

geoeq-0.0.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

geoeq-0.0.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file geoeq-0.0.1.tar.gz.

File metadata

  • Download URL: geoeq-0.0.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for geoeq-0.0.1.tar.gz
Algorithm Hash digest
SHA256 175dd4bd68845f1ada9aef50b79a94a8c6e85245dc8a728e620b2217374c228a
MD5 be9ece069d44b7aa4c6bb3c51c3229fe
BLAKE2b-256 c111ae0d2acb932bf32729b50b8d66d2d229d926249bef10cd808caf7a9c4661

See more details on using hashes here.

File details

Details for the file geoeq-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: geoeq-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for geoeq-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5969133fbed2663ac4f285ac9fbbaa7862c71e68abaf0f426fb4c0cac03b7c52
MD5 cfa092e18d8cc2b1ab50968c6bb1a378
BLAKE2b-256 7099c1ffd5829a06e43651d45fa4f919ec6082c743b664a9580b68d1b019a6b0

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