No project description provided
Project description
groundmeas: Grounding System Measurements & Analysis
groundmeas is a comprehensive Python package designed for the management, analysis, and visualization of earthing (grounding) system measurements. It provides a robust toolset for engineers and researchers to handle field data, perform complex physical analysis, and generate interactive reports.
See the full documentation here: https://ce1ectric.github.io/groundmeas/
๐ Physical Background
Understanding the behavior of grounding systems is critical for electrical safety and system performance. groundmeas implements several standard and advanced methods for analyzing measurement data.
Earthing Impedance ($Z_E$)
The earthing impedance is a frequency-dependent parameter defined as the ratio of the Earth Potential Rise (EPR) to the current flowing into the earth ($I_E$). $$ Z_E(f) = \frac{V_{EPR}(f)}{I_E(f)} $$
Soil Resistivity ($\rho$)
Soil resistivity is a key factor influencing the grounding resistance. It is typically measured using the Wenner or Schlumberger method and varies with depth and frequency.
The Rho-f Model
To characterize the frequency dependence of a grounding system, groundmeas implements the Rho-f Model. This empirical model correlates the earthing impedance with soil resistivity ($\rho$) and frequency ($f$) using a linear regression approach with complex coefficients:
$$ Z(\rho, f) = k_1 \cdot \rho + (k_2 + j \cdot k_3) \cdot f + (k_4 + j \cdot k_5) \cdot \rho \cdot f $$
Where $k_1 \dots k_5$ are coefficients determined by fitting the model to measured data. This allows for the prediction of impedance behavior under varying soil conditions and frequencies.
Determination of Earthing Impedance (Fall-of-Potential)
When measuring impedance using the Fall-of-Potential method, the challenge is to determine the "true" impedance from a distance vs. impedance profile. groundmeas offers multiple algorithms to extract this value:
- Maximum: Returns the highest measured value (conservative approach).
- 62% Rule: Interpolates the value at 62% of the distance to the current injection point (valid for homogeneous soil).
- Minimum Gradient: Identifies the flat portion of the curve where the gradient ($\Delta Z / \Delta d$) is minimal.
- Minimum Standard Deviation: Uses a sliding window to find the region with the lowest variance (flattest part of the curve).
- Inverse Extrapolation: Fits a function $1/Z = a \cdot (1/d) + b$ to extrapolate the value at infinite distance ($d \to \infty$).
๐ Features
- Data Management: robust SQLite database with SQLModel (Pydantic) ORM for
Measurements,MeasurementItems, andLocations. - Interactive Dashboard: A Streamlit-based web interface with:
- Map Visualization: Geospatial view of measurement locations using Folium.
- Interactive Plots: Plotly-based charts for Impedance vs. Frequency, Voltage profiles, and more.
- Engineering Notation: Automatic formatting of axis labels (e.g., $k\Omega$, $mA$).
- CLI (Command Line Interface): A powerful Typer-based CLI for all operations.
- Analytics: Built-in functions for:
- Split factor calculation (shield currents).
- Touch voltage ($V_t$) and Prospective Touch Voltage ($V_{tp}$) analysis.
- Complex number processing (Real/Imaginary/Magnitude/Angle).
- Import/Export: Support for JSON import/export, including batch processing of folders.
๐ฆ Installation
Prerequisites: Python 3.12+
Using Poetry (Recommended)
git clone https://github.com/Ce1ectric/groundmeas.git
cd groundmeas
poetry install
poetry shell
Using Pip
pip install groundmeas
License check & third-party notices
List installed package licenses:
poetry run python scripts/license_check.py
Generate a Markdown report (including license texts) for compliance:
poetry install --with dev
poetry run pip-licenses --format=markdown --with-license-file > THIRD_PARTY_NOTICES.md
Commit THIRD_PARTY_NOTICES.md if you want the notices tracked.
๐ฅ๏ธ Usage
1. The Command Line Interface (CLI)
The gm-cli tool is the main entry point for managing your data.
Setup Database:
By default, groundmeas looks for a database. You can specify one via the --db flag or set a default path in ~/.config/groundmeas/config.json.
Common Commands:
-
Dashboard: Launch the interactive visualization tool.
gm-cli dashboard -
Import Data: Import measurements from a JSON file or a folder of JSON files.
gm-cli import-json ./data/measurements/
-
List Data: View stored measurements.
gm-cli list-measurements -
Analytics: Calculate the characteristic impedance using the minimum gradient method.
gm-cli distance-profile 1 --algorithm minimum_gradient
-
Help: See all available commands.
gm-cli --help
2. The Interactive Dashboard
The dashboard provides a user-friendly interface to explore your data.
- Run
gm-cli dashboard. - Map View: Select measurement points on the map. Use "Multi-select mode" to compare multiple datasets.
- Analysis Tabs:
- Impedance vs Frequency: Compare frequency responses ($Z_E$).
- Rho-f Model: Fit and visualize the model parameters.
- Voltage / EPR: Analyze Earth Potential Rise and Touch Voltages ($V_t$, $V_{tp}$).
- Value vs Distance: Visualize Fall-of-Potential curves with filtering by frequency.
3. Python API
You can use groundmeas directly in your Python scripts or Jupyter notebooks.
from groundmeas import connect_db, read_measurements_by, impedance_over_frequency
# Connect to DB
connect_db("groundmeas.db")
# Fetch data
measurements, _ = read_measurements_by(location_id=1)
# Analyze
for meas in measurements:
z_f = impedance_over_frequency(meas["id"])
print(f"Measurement {meas['id']}: {z_f}")
๐ Project Structure
groundmeas/
โโโ src/groundmeas/
โ โโโ __init__.py # Public API exports
โ โโโ core/
โ โ โโโ db.py # DB connection + CRUD
โ โ โโโ models.py # SQLModel data definitions
โ โโโ services/
โ โ โโโ analytics.py # Physical models and algorithms
โ โ โโโ export.py # JSON/CSV/XML export helpers
โ โ โโโ vision_import.py # OCR import pipeline
โ โโโ visualization/
โ โ โโโ plots.py # Matplotlib plots
โ โ โโโ vis_plotly.py # Plotly figures
โ โ โโโ map_vis.py # Folium map generation
โ โโโ ui/
โ โโโ cli.py # Typer CLI entry point
โ โโโ dashboard.py # Streamlit dashboard
โโโ tests/ # Pytest suite
โโโ pyproject.toml # Project configuration and dependencies
๐ค Contributing
- Fork the repository.
- Create a feature branch (
git checkout -b feat/new-feature). - Commit your changes.
- Push to the branch.
- Open a Pull Request.
๐ License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file groundmeas-1.3.4.tar.gz.
File metadata
- Download URL: groundmeas-1.3.4.tar.gz
- Upload date:
- Size: 46.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0e7c7f001a52a4ab1b6381957d87af04e8fbbab359c4806a39cf6d2aaa9159a
|
|
| MD5 |
8c06e94afc8c1b8ac6cdfc4932a34642
|
|
| BLAKE2b-256 |
412e3a136d95c28f12b84c6c3a3dda5aee9cb2b109775aaf17ecfeca99647d61
|
Provenance
The following attestation bundles were made for groundmeas-1.3.4.tar.gz:
Publisher:
ci-cd.yml on Ce1ectric/groundmeas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
groundmeas-1.3.4.tar.gz -
Subject digest:
a0e7c7f001a52a4ab1b6381957d87af04e8fbbab359c4806a39cf6d2aaa9159a - Sigstore transparency entry: 779940609
- Sigstore integration time:
-
Permalink:
Ce1ectric/groundmeas@8213e181f00bb6b9a2c7935d646f430ed4237e8b -
Branch / Tag:
refs/tags/v1.3.4 - Owner: https://github.com/Ce1ectric
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@8213e181f00bb6b9a2c7935d646f430ed4237e8b -
Trigger Event:
push
-
Statement type:
File details
Details for the file groundmeas-1.3.4-py3-none-any.whl.
File metadata
- Download URL: groundmeas-1.3.4-py3-none-any.whl
- Upload date:
- Size: 52.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dd0035753cc2859e847b68c2aaed91cc872ad40e8d180d9e29fc5030a145860
|
|
| MD5 |
50f14b761f057a384798190bf20b4d82
|
|
| BLAKE2b-256 |
d4f8f59156d774f4b34c972dd8ceeef485bade5da4778957f99d415dd75c9f90
|
Provenance
The following attestation bundles were made for groundmeas-1.3.4-py3-none-any.whl:
Publisher:
ci-cd.yml on Ce1ectric/groundmeas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
groundmeas-1.3.4-py3-none-any.whl -
Subject digest:
4dd0035753cc2859e847b68c2aaed91cc872ad40e8d180d9e29fc5030a145860 - Sigstore transparency entry: 779940612
- Sigstore integration time:
-
Permalink:
Ce1ectric/groundmeas@8213e181f00bb6b9a2c7935d646f430ed4237e8b -
Branch / Tag:
refs/tags/v1.3.4 - Owner: https://github.com/Ce1ectric
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@8213e181f00bb6b9a2c7935d646f430ed4237e8b -
Trigger Event:
push
-
Statement type: