Skip to main content

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

Metadata

Release files for coorddetect 0.1.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 coorddetect 0.1.1
File Size Uploaded
coorddetect-0.1.1.tar.gz 8.6 kB Details

Built distribution (wheel)

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

Total release size: 17.3 kB

Release files / coorddetect-0.1.1.tar.gz

Download URL coorddetect-0.1.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ac430c968be2e48bbe662d02c222b26181f341b5d20f9cb93c9f493fd2be1afd
BLAKE2b-256 checksum
How to use checksums
98877f404ff1aa112d4c3c3673c4e5aeb69648acf797cbad9ab0e6989a7979af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / coorddetect-0.1.1-py3-none-any.whl

Download URL coorddetect-0.1.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f1d29d28eda3999e613dc2d481ee0a3877a658ca0c2b79b07316193f44606f8
BLAKE2b-256 checksum
How to use checksums
ef3e0aad8bb4b1a0ba20fd90a49de6254cc28c9f7dbcd878c01803a289a3584d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.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