Automatic XYZ coordinate detection and spatial diagnostics for messy tabular data
Project description
coorddetect
coorddetect automatically detects X, Y, Z coordinate columns from messy tabular
data (CSV and Excel) using a robust, file-order–preserving heuristic.
It also provides optional spatial QA/QC diagnostics such as robust bounding boxes,
convex hull geometry, and point density metrics.
The XYZ detection logic does not rely on column names and is designed for real-world geomatics applications, GIS, and survey datasets.
Installation
pip install coorddetect
Quick Usage
import pandas as pd
from coorddetect import detect_xyz
df = pd.read_csv("points.csv")
xyz, meta = detect_xyz(df)
print(xyz.head())
print("Selected XYZ columns:", meta["selected_columns"])
Preserve an ID Column
xyz, meta = detect_xyz(
df,
id_col="WallStationID"
)
Output columns
ID, X, Y, Z
Spatial Diagnostics (All Features)
By default, detect_xyz() can return:
- Robust bounding box
- Convex hull geometry
- Point density metrics
xyz, meta = detect_xyz(
df,
return_bounds=True,
robust_bounds=True,
bounds_quantiles=(0.01, 0.99),
return_hull=True,
hull_dim=2, # 2 = XY hull, 3 = XYZ hull
return_density=True
)
print("Bounds:", meta["bounds"])
print("Hull dimension:", meta["convex_hull_dim"])
print("Density:", meta["density"])
Robust vs Raw Bounding Box
# Outlier-resistant (recommended)
xyz, meta = detect_xyz(
df,
robust_bounds=True,
bounds_quantiles=(0.01, 0.99)
)
# Raw min / max bounds
xyz, meta = detect_xyz(
df,
robust_bounds=False
)
Disable Diagnostics (Pure XYZ Detection)
xyz, meta = detect_xyz(
df,
return_bounds=False,
return_hull=False,
return_density=False
)
Batch Processing (CSV & Excel)
Process all .csv, .xlsx, and .xls files in a folder.
from coorddetect import detect_xyz_batch
results = detect_xyz_batch(
input_folder="data/raw",
output_folder="data/out",
recursive=True,
export_format="csv", # or "xlsx"
excel_sheet=None, # sheet name or index for Excel
id_col="WallStationID",
return_bounds=True,
robust_bounds=True,
return_hull=True,
hull_dim=2,
return_density=True
)
print(results)
Each file is exported as:
<original_name>_xyz.csv
Command Line Interface (CLI)
After installation, the CLI is available:
coorddetect INPUT_FOLDER OUTPUT_FOLDER
Common Examples
# Process a folder recursively
coorddetect data/raw data/out --recursive
# Export Excel instead of CSV
coorddetect data/raw data/out --export-format xlsx
# Use raw min/max bounds
coorddetect data/raw data/out --raw-bounds
# Use 3D convex hull
coorddetect data/raw data/out --hull-dim 3
# Disable hull and density metrics
coorddetect data/raw data/out --no-hull --no-density
View all options
coorddetect --help
Notes
- Convex hull and point density metrics require
scipy - Convex hull requires at least 3 points (2D) or 4 non-coplanar points (3D)
- All diagnostics are computed after XYZ detection
- XYZ detection logic does not rely on column names
Applications
- GIS applications
- Survey data validation
- Geomatics research pipelines
License
MIT
Project details
Release history Release notifications | RSS feed
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 coorddetect-0.1.1.tar.gz.
File metadata
- Download URL: coorddetect-0.1.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac430c968be2e48bbe662d02c222b26181f341b5d20f9cb93c9f493fd2be1afd
|
|
| MD5 |
e2735aefb451a491df16a7fc067f3d32
|
|
| BLAKE2b-256 |
98877f404ff1aa112d4c3c3673c4e5aeb69648acf797cbad9ab0e6989a7979af
|
File details
Details for the file coorddetect-0.1.1-py3-none-any.whl.
File metadata
- Download URL: coorddetect-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f1d29d28eda3999e613dc2d481ee0a3877a658ca0c2b79b07316193f44606f8
|
|
| MD5 |
701a2a10db7454b4923b3c27586f2d1a
|
|
| BLAKE2b-256 |
ef3e0aad8bb4b1a0ba20fd90a49de6254cc28c9f7dbcd878c01803a289a3584d
|